[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PHP5 scripts not served by apache2 on Squeeze

Kristian Lampen wrote:
> I have a fresh install of apache2 and php on my server and I can not
> get php to work, php-scripts are not executed by apache, just the
> plain script is served to the browser.
> ...
> I have the following packages installed:
> ...
> libapache2-mod-php5

This should work out of the box by default.  Since it isn't working
for you then it must be a local modification somewhere.  

This is where it really helps if you have a second machine that you
can play on.  Because then you will install apache2 and
libapache2-mod-php5 on this second machine and you will find that
everything works fine out of the box.  Then you will compare the two
systems and find what is different about the broken one.

The "magic" included in libapache2-mod-php5 is:


That file includes the needed configuration.  Your message included
all of the right debugging to show that it was installed and enabled
okay.  So it should be working at that point.

> Now I have a PHP Test file:
> root@server:~# echo "<?php phpinfo(); ?>" > /var/www/test.php

Yes.  Looks good.

> root@server:~# chmod 755 /var/www/test.php

No.  PHP files should not be executable.  That is actually a little
dangerous because if you were to actually try to execute them then the
result with your shell could be "interesting" in the curse sense of
that word.

> A simple purge of all related packages and reinstalling changes nothing.

Darn.  I hate it when that happens.

> I hope this problem is solved already, but I have not found any solution yet.
> What have I or the server done wrong?

I have no idea.  All I can reinforce is that it should be working out
of the box based upon the configurationn installed in the php5.conf file.

You didn't by any chance delete this line from the
/etc/apache2/apache2.conf file did you?

  Include mods-enabled/*.conf

That is what loads all of the snippets.  If you were to do something
such as having replaced that file with one from a different system
then it would be missing a lot of needed configuration.


Attachment: signature.asc
Description: Digital signature

Reply to: