Jump to content
New Reality: Ads For Members ×

Apache won't serve PHP files


Koobi

Recommended Posts

i'm running Apache v2.x on linux

 

the server itself is running, but apache doesn't recognize PHP files, it asks me if i want to download them.

 

i had to reinstall Apache the other day because i made a mess of it while messing about with it.

i've edited /etc/apache2/apache2.conf to add the following:

 

AddType application/x-httpd-php .php

 

and done a graceful restart with apache2ctl but it doesnt seem to work.

i also don't have an .ht* file in any of my dir's that might tell .php files are anything but applicatoin/x-httpd-php files.

 

i've tried everything i know but nothing works.

either i've forgotten something, or apache is reading another .conf file from somewhere else...but other changes to apache2.conf seem to work.

for example, i enabled the server-status and server-info options in that same conf file, and while server status doesnt seem to work, server-info gives a 403 header (forbidden) even when i run it as root via lynx.

 

does anyone know if there's an apache tool that i can use which will tell me the order of the conf files being read?

 

i'm open to any suggestions. i just can't figure out what i've missed out. i've done this a million times before :/

 

thanks.

Link to comment
https://forums.phpfreaks.com/topic/2508-apache-wont-serve-php-files/
Share on other sites

hey, thanks for the reply.

 

 

 

all the paths i mention here are relative to /etc/apache2/

 

mods-available/ has php4.conf and php4.load

 

mods-available/php4.conf has this:

<IfModule mod_php4.c>
 AddType application/x-httpd-php .php .phtml .php3
 AddType application/x-httpd-php-source .phps
</IfModule>

 

 

and mods-available/php4.load ahs this:

LoadModule php4_module /usr/lib/apache2/modules/libphp4.so

 

 

and mods-enabled/ has php4.conf and php4.load which are both symlinks to their counterparts in mods-available/

 

 

 

so everything seems in order to me. am i missing something?

 

and all files in mods-enabled/ and mods-available/ are included via apache2.conf...but just to double-check things, i added the LoadModule directive for the PHP module in apache2.conf as well and when i tried graceful via apache2ctl, it throws an error saying that the module was already loaded.

 

 

thanks for your time.

it probably does. i haven't touched my PHP installation. i just reinstalled Apache, i did it again a few minutes ago but using Ubuntu's apt-get system, i didnt compile it manually.

 

 

i tried this:

php -in /etc/php4/apache2/

 

so that i could see the options but it still loads the php.ini from /etc/php4/cli/

 

got any ideas, effigy?

 

thanks so far.

ooops, i used -n instead of -c for PHP cli heh heh, anyway i just tried this:

 

php -c /etc/php4/apache2/php.ini -i | grep -i apache

 

 

and all i get is this:

Configuration File (php.ini) Path => /etc/php4/apache2/php.ini

 

so i guess i don't have that flag in my PHP install...but i don't recall touching my PHP installation in the last two days...

 

 

 

in any case, as long as i have the proper AddType directive in apache2.conf, Apache shouldn't ask me if i want to download the PHP file, right?

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.