WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: How to enable php on apache  (Read 8033 times)

Offline flawd

  • Newbie
  • *
  • Posts: 16
How to enable php on apache
« on: April 10, 2015, 08:28:14 PM »
Hi

I have the following extensions installed.

Apache2.4.tcz
Apache2-mod-php5.tcz
Mariadb.tcz


I placed a index.php file in my /usr/local/apache2/htdocs folder, the php was not working. Do I need anything else to enable php or do I need to edit a config file somewhere?

Sorry if I am asking too many questions :S
« Last Edit: April 10, 2015, 08:29:46 PM by flawd »

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: How to enable php on apache
« Reply #1 on: April 10, 2015, 09:11:28 PM »
Read the info file.

Offline flawd

  • Newbie
  • *
  • Posts: 16
Re: How to enable php on apache
« Reply #2 on: April 10, 2015, 11:06:15 PM »
Read the info file.

Already read it.

Says to install and restart Apache and that if httpd.conf is not in the default location that I should add "Include conf/php/mod_php5.conf" to add it manually. It does not specify default location of httpd.conf so there is no way for me to tell if I need to modify it or not. I assumed that was not in the default location(since it didn't work) and added the include anyway and tried restart apache again. Didn't work.

I assume that If I have Apache2.tcz installed then installed apache2-mod-php5.tcz it will build on top of that directory then when it is restarted it should run right out of the box. The extension is from 2012 and Apache2 has been replaced by Apache2.4 since then (also needs an update to current version of php). So I do not know if anything major has changed in the directory structure or if this even compatible with Apache 2.4.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11627
Re: How to enable php on apache
« Reply #3 on: April 10, 2015, 11:27:08 PM »
Hi flawd
If you have not done so already, I would copy:
Code: [Select]
usr/local/apache2/conf/httpd.conf.origto:
Code: [Select]
usr/local/apache2/conf/httpd.confso that Apache has a config file. I would then search that file for php entries and see if they are commented out with a ; (semi colon).
You might also want to take a look in:
Code: [Select]
usr/local/apache2/conf/php5/extensions/dist.ini.sample
usr/local/apache2/conf/php5/mod_php5.conf
usr/local/apache2/conf/php5/php.ini.sample
for some guidance. Maybe copy the  .ini.sample  files to  .ini  files.

Offline flawd

  • Newbie
  • *
  • Posts: 16
Re: How to enable php on apache
« Reply #4 on: April 11, 2015, 12:08:53 AM »
Hey Rich, thanks for the assistance.

I have copied over the previously existing httpd.conf with httpd.conf.orig and php.ini with php.ini.sample.

I looked into mod_php5.conf and it looks like something that will help apache identify .php and .phps files?
Code: [Select]
LoadModule php5_module modules/mod_php5.so
<IfModule mod_php5.c>
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
</IfModule>

The dist.ini contains a list of enabled and disabled extensions and I do not see php mentioned anywhere in there. Do I need to add it to enabled list?

If so, how do I add it? extension=???.so
I have tried extension=mod_php5.so with no luck.


Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11627
Re: How to enable php on apache
« Reply #5 on: April 11, 2015, 09:30:53 AM »
Hi flawd
There's probably a section in  usr/local/apache2/conf/httpd.conf  that has a bunch of  include  statements. Try adding a line that reads:
Code: [Select]
Include conf/php/mod_php5.confto it. Restart apache and see what happens.

Offline flawd

  • Newbie
  • *
  • Posts: 16
Re: How to enable php on apache
« Reply #6 on: April 11, 2015, 02:13:48 PM »
I have already tried this, the includes are located at the bottom of the file and is placed there by default when you install apache2-mod-php5.tcz. However, it does not seem to be working.

Here is the full file.

http://pastebin.com/Y42Y5hYM

And here is what is showing up on web-browser.





I have also tried looking around for other httpd.conf incase it is reading it from another location, but was unable to find another http.conf file.

And I have tried manually adding the contents of mod_php5.conf to the httpd.conf file as well. Nothing...
« Last Edit: April 11, 2015, 02:33:39 PM by flawd »

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: How to enable php on apache
« Reply #7 on: April 11, 2015, 04:06:36 PM »
apache2-mod-php5.tcz is for apache2.tcz not apache2.4.tcz
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline flawd

  • Newbie
  • *
  • Posts: 16
Re: How to enable php on apache
« Reply #8 on: April 11, 2015, 05:21:38 PM »
apache2-mod-php5.tcz is for apache2.tcz not apache2.4.tcz

Breaking my heart :(

Was looking forward to running it on Tiny Core.

Would there be any security issues with downgrading to apache2? Or is it possible to get php working with more current version?