LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-26-2020, 07:08 PM   #1
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 468

Rep: Reputation: Disabled
New Install: How to enable PHP?


I have just completed a new install of Slackware 14.2-64 I'm trying to get back the capabilities of my previous Slackware install. The problem I'm dealing with at this moment is I can't seem to run php through apache. My test file (<php>phpinfo(); </php>) only shows text. I have gone into the apache config file and deleted the # before the Include of mod_php.conf. Rebooted apache. Nothing. My test file displays phpinfo(); I was expecting it to execute the command. It did not. Why did it not?
 
Old 03-26-2020, 07:49 PM   #2
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
How is your test file named? If I remember right, by default, it needs to end in .php for it to be parsed by php.

Also, what happens if you run php -f /location/to/test.php
 
Old 03-26-2020, 08:00 PM   #3
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 468

Original Poster
Rep: Reputation: Disabled
Code:
root@caitlyn:/var/www/htdocs# php -f /var/www/htdocs/index.php
<php>
phpinfo();
</php>
 
Old 03-26-2020, 09:48 PM   #4
kingbeowulf
Senior Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware
Posts: 1,266
Blog Entries: 11

Rep: Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744
you need to read up on the apache modules configuration for php. Maybe take a peek at
http://www.slackware.com/~mrgoblin/slackware-lamp2.php
https://docs.slackware.com/howtos:ne...ache_php_mysql
 
Old 03-26-2020, 10:31 PM   #5
volkerdi
Slackware Maintainer
 
Registered: Dec 2002
Location: Minnesota
Distribution: Slackware! :-)
Posts: 2,512

Rep: Reputation: 8478Reputation: 8478Reputation: 8478Reputation: 8478Reputation: 8478Reputation: 8478Reputation: 8478Reputation: 8478Reputation: 8478Reputation: 8478Reputation: 8478
Try nmapping yourself like this:

Code:
nmap -sV 127.0.0.1
If PHP is enabled, you'll see a line like this:

80/tcp open http Apache httpd 2.4.41 ((Unix) PHP/7.4.4)

Next, try this in your index.php instead:

Code:
<?php
phpinfo();
?>
 
Old 03-27-2020, 10:14 AM   #6
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 8,792

Rep: Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656Reputation: 6656
Quote:
Originally Posted by volkerdi View Post
Code:
<?php
phpinfo();
?>
This is likely your issue. PHP requires the question mark in the open/close tags to be able to parse the contents as php code.

https://www.php.net/manual/en/langua...ax.phptags.php
https://www.php.net/manual/en/langua...ax.phpmode.php
 
Old 03-29-2020, 03:21 PM   #7
maschelsea
Member
 
Registered: Dec 2016
Distribution: Slackware 64bit 14.2
Posts: 468

Original Poster
Rep: Reputation: Disabled
Yeah. My PHP is a bit rusty. I corrected the PHP, and then it worked! Thank you to all who have helped me in this thread.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
New install. Additional questions: how to enable autologin. how to enable crystal_hd driver Horia Georgescu 4MLinux 1 12-19-2019 06:17 PM
I forgot enable "enable thin provisioning optimized storage for xendesktop" jokar.mohsen Linux - Virtualization and Cloud 21 12-03-2014 08:56 AM
[SOLVED] Am trying to install packages like net-snmp, php-mysql, php-snmp, php but with errors Maj Linux - Newbie 1 07-26-2013 02:12 PM
how to recompile squid to enable -enable-storeio=coss ejinh Fedora 2 08-11-2010 04:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration