views:

60

answers:

2

Im using a linux machine, and I followed the instructions seen on http://jm2.php.net/manual/en/install.php to setup php, apache and my sql.

I did exactly what it said and nothing more, but when I try to open a .php file with firefox or chrome, it downloads...?

Im following a tutorial on learning php seen here: http://devzone.zend.com/node/view/id/625

Is there something im not doing or doing wrong?

All answers are appreciated.

+1  A: 

Hi,

According to this howto:

http://jm2.php.net/manual/en/install.unix.apache.php

Please make sure you did steps 14 and 15, what is happening - probably your webserver doesn't recognize php scripts AS php scripts, and sends those to your browser - resulting in either download or displaying the source.

Thanks

Kuba Tyszko
I have Apache 2.x on my machine. But I will attempt your suggestion, thanks for response
ihaveitnow
I ran the code 'LoadModule php5_module libexec/libphp5.so' in the terminal, it says 'command not found'.So I didnt bother to go to number 15
ihaveitnow
LoadModule is not a command, you need to put it into apache's config.For v2.0: Steps 7 and8 from this howto:http://jm2.php.net/manual/en/install.unix.apache2.php
Kuba Tyszko
+1  A: 

Note that if you have a file:// URL in the browser address bar it isn't interacting with the server to process the page.

You will need to use http://localhost/path/to/page/page.php

Josh K
So all im doing is replacing the 'file' with 'http'?Thanks for the response
ihaveitnow
`file://` forces you browser to act as a very dumb version of the regular file manager on your OS. It will not cause the script to be run by the webserver, as the webserver never gets involved. Switching to `http://` will send a request to the webserver, which will load the script on your behalf.
Marc B
Well I just did the replacement. and it redirected me to 'www.home.com' ?
ihaveitnow
then your apache is not listening (not running?) on port 80, so the browser tries to find a website which "sounds similar"..
Peter Parker
You need to know where Apache is set to point to by default. Load `http://localhost` in your browser and see what happens.
Josh K
It works!This is the default web page for this server.The web server software is running but no content has been added, yet.Thats exactly what pops up...What does that mean?
ihaveitnow
Means that the server is running but you need to put your PHP scripts in that directory.
Josh K
Well it seems like the default directory is '/var/www'Thats where I found the html file, but when I saved my php file there...The same thing happened.
ihaveitnow
Define "nothing happened" better please. You saved the php file to `/var/www` and then loaded `http://localhost/[filename].php` into your web browser and nothing happened? No errors? Nothing?
Josh K
Same thing happened = Was still downloading the php file.Bt for whatever reason, what you typed works. :SDo I have to type 'http://localhost/filname.php' EVERYTIME I want to test the php file?Is there no other way that I can go about testing my .php files ?
ihaveitnow
Yeah, rename the file `index.php` and you can just type in `http://localhost/`. Also, you don't have to retype it everytime, just refresh the page.
Josh K
Thanks alot for your help Josh
ihaveitnow