PDA

View Full Version : Trying to get php to work!



nilsh
August 17th, 2008, 11:07 PM
Hi!

I've installed apache2 and php5 on my Ubuntu 8.04 now, but can't get it to work.

I've made a folder inside var/www with a file called phpinfo.php inside of it.

The file contains <?php phpinfo() ?>.

Thing is, when I doubleclick it, and make firefox open it, it asks me to save or open the file. It doesnt show anything! Why is this?

Thanks in advance

nilsh

Kadrus
August 17th, 2008, 11:09 PM
type into your browser: http://localhost/
and you will see your files listed...click from there phpinfo.php and you will be able to see the webpage.

mike_g
August 17th, 2008, 11:10 PM
You might ot have the apache2 service running; you could try restart it. I forgot the command but IIRC if you type apache2 --help it shoudl tell you.

>_< oh yeah, you will have to get to it via your webbrowser from localhost.

Kadrus
August 17th, 2008, 11:10 PM
You might ot have the apache2 service running; you could try restart it. I forgot the command but IIRC if you type apache2 --help it shoudl tell you.


sudo /etc/init.d/apache2 restart

jinksys
August 18th, 2008, 02:42 AM
Hi!

I've installed apache2 and php5 on my Ubuntu 8.04 now, but can't get it to work.

I've made a folder inside var/www with a file called phpinfo.php inside of it.

The file contains <?php phpinfo() ?>.

Thing is, when I doubleclick it, and make firefox open it, it asks me to save or open the file. It doesnt show anything! Why is this?

Thanks in advance

nilsh

If you double click it, you are bypassing your server completely and the php file is not being interpreted. You need to type in your server's URL plus the path to the file, ie) http://localhost/mypage.php

suprfish
August 18th, 2008, 03:02 AM
Installing php5 doesn't automatically enable the apache module (though it used to).


~$ sudo a2enmod php5
~$ sudo /etc/init.d/apache2 restart

nilsh
August 18th, 2008, 11:32 AM
Thanks, that did the trick :D