PDA

View Full Version : Can't test php files



mike_g
February 8th, 2008, 06:09 PM
I want to run some php code. I had it working on my old Ubuntu PC before it broke. I just installed wordpress on another computer and dumped my php files in /var/www.

Now when i go to local host it displays the files, and that I have apache and php installed. The problem is when I select a php file it wont run in FF. Instead i get a dialog asking if i want to open it with gedit.

Is there something I missed here? Or anyone know what i could do to get php to work?

Cheers.

DrMega
February 8th, 2008, 06:20 PM
Have you set the permissions on the directory to allow execute?

mike_g
February 8th, 2008, 06:26 PM
Yeah I set: a+rwx -R on the directory.

I just created an Index.html file from which i seem to be able to link to a php file, the only problem is that none of the script seems to execute, and I also cant seem to access pages in subdirectories.

Edit: it seems to have something to do with directory paths, as they dont seem to work the same as in windows

Majorix
February 8th, 2008, 10:40 PM
It is probably a problem with FF.

Can you view .php with FF on that installation? I know for one that these forums work with PHP, so can you view them on your comp?

aks44
February 8th, 2008, 10:50 PM
To me, it rather looks like something went wrong with the LAMP install.

Check that LAMP is correctly installed:

sudo taskselThen check LAMP (DON'T uncheck anything, it could screw your installation up).


AFAIK FF has nothing to do with it, it only handles the pages according to the information the Apache server sends.

eggdeng
February 8th, 2008, 11:20 PM
Check that you have installed libapache2-mod-php5. If not, install it.Then run

sudo a2enmod php5
then
sudo /etc/init.d/apache2 restart

tosk
February 8th, 2008, 11:27 PM
Check that you have installed libapache2-mod-php5. If not, install it.Then run

sudo a2enmod php5
then
sudo /etc/init.d/apache2 restart

eggdeng is correct. Apache has to be instructed to load the PHP module before it will source PHP scripts.

mike_g
February 9th, 2008, 07:48 PM
Thnks for the input. I'll try out the suggestions when I'm on my Ubuntu machine :)

Hilko
February 10th, 2008, 03:33 AM
Now when i go to local host it displays the files, and that I have apache and php installed. The problem is when I select a php file it wont run in FF. Instead i get a dialog asking if i want to open it with gedit.


Hi mike,

I just installed a LAMP server using tasksel in synaptic package manager. I tried to test my server and i had exactly the same problem.

I solved it by stopping and restarting apache:

$ sudo /usr/sbin/apache2ctl stop
$ sudo /usr/sbin/apache2ctl restart

Hope this works for you too.