Jump to content


Photo

Apache won't serve PHP files


  • Please log in to reply
7 replies to this topic

#1 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 15 September 2005 - 02:30 PM

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.

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 15 September 2005 - 04:51 PM

do you also have a LoadModule line?
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 15 September 2005 - 06:36 PM

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.

#4 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 15 September 2005 - 06:40 PM

when php was configured, was the --with-apache2 switch used?
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#5 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 15 September 2005 - 06:51 PM

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.

#6 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 15 September 2005 - 07:01 PM

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?

#7 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 15 September 2005 - 07:30 PM

correct. i have limited knowledge with installs, but all i can say is use the manual. mysql and apache should be installed first then php last, because it's configure options point at those two. i recommend compiling php against using a binary.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#8 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 16 September 2005 - 11:06 AM

yeah you're right. i will probably save more time if i did it all manually all over again.

thanks for the reply anyway :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users