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

Re: Can't execute PHP script





2007/9/13, Randy Patterson <tech@patterson-pcc.com>:
On Wednesday 12 September 2007 15:19, Jeff D wrote:
> On Wed, 12 Sep 2007, Randy Patterson wrote:
> > Hey,
> >
> > I installed apache like;
> >
> > aptitude install apache2 php5 libapache2-mod-php5
> >
> > As returned by apache2ctl, I am running;
> >
> > Apache/2.2.4 (Debian) PHP/5.2.3-1+b1
> >
> > I point my browser to;
> >
> > http://localhost/apache2-default/test.php
> >
> > The file test.php contains this code;
> >
> > <html><body>
> > <h1>PHP Test</h1>
> > <br />
> > <?php print "Hello World!"; ?>
> > </body></html>
> >
> > The browser outputs only;
> >
> > PHP Test
> >
> > The script doesn't get executed.
> >
> > There seems to be a large number of ways to setup a LAMP server so it's
> > difficult to know if a particular set of instructions apply to your
> > setup. I have posted this problem here several weeks back and then tried
> > the PHP-Users list to no avail. I would really like the get this setup on
> > my Linux system and not have to use Windows, which I have no problem at
> > all running PHP on IIS. Any help is appreciated!
> >
> > Thanks,
> > Randy
> >
> > PS. I'm running Lenny
>
> I had a lenny box sitting here with no apache on it, this is what I did to
> get it up and running:
>
> apt-get update
> apt-get install apache2
> (checked to make sure apache was running, lsof -i:80 )

Here's my output;

debian: lsof -i:80
COMMAND  PID     USER   FD   TYPE DEVICE SIZE NODE NAME
apache2 3663     root    3u  IPv4  10079       TCP *:www (LISTEN)
apache2 3690 www-data    3u  IPv4  10079       TCP *:www (LISTEN)
apache2 3691 www-data    3u  IPv4  10079       TCP *:www (LISTEN)
apache2 3692 www-data    3u  IPv4  10079       TCP *:www (LISTEN)
apache2 3693 www-data    3u  IPv4  10079       TCP *:www (LISTEN)
apache2 3694 www-data    3u  IPv4  10079       TCP *:www (LISTEN)
apache2 4848 www-data    3u  IPv4  10079       TCP *:www (LISTEN)
apache2 4852 www-data    3u  IPv4  10079       TCP *:www (LISTEN)
apache2 4853 www-data    3u  IPv4  10079       TCP *:www (LISTEN)

> apt-get install libapache2-mod-php5
> a2enmod php5 (it should report that php5 is already enabled, never hurts
> to check though)

Here's my output;

debian:# a2enmod php5
This module is already enabled!

> lynx --dump http://localhost/test.php

When I run this I get exactly the same result as running it with Iceweasel.

Randy

That's very strange. No error in error.log, apache2 running with php5_mod enables...

Have a look at test.php and its perms, they must be 755 if you want apache2 to execute the script instead of html only.

raffaele



Reply to: