LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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: 346

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: 6,652

Rep: Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388
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: 346

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
Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware64 14.2 Slackware 14.2, Slackware{32,64}-current
Posts: 956
Blog Entries: 10

Rep: Reputation: 441Reputation: 441Reputation: 441Reputation: 441Reputation: 441
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: 1,885

Rep: Reputation: 6084Reputation: 6084Reputation: 6084Reputation: 6084Reputation: 6084Reputation: 6084Reputation: 6084Reputation: 6084Reputation: 6084Reputation: 6084Reputation: 6084
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: 6,652

Rep: Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388Reputation: 4388
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: 346

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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 11:34 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration