Page 1 of 1

re: HELP! PHP not working

Posted: Tue Dec 09, 2008 6:35 am
by Floody
I am very very new! So sorry... but I can't get PHP code to be seen by my browser when I'm running it off my local web server, my own computer. I've gone through several tutorials and in the terminal app have uncommented the right lines in my httpd.conf file...

so...

Code: Select all

#LoadModule php4_module libexec/httpd/libphp4.so
reads:

Code: Select all

LoadModule php4_module libexec/httpd/libphp4.so
and...

Code: Select all

#AddModule mod_php4.c
reads...

Code: Select all

AddModule mod_php4.c
this was already there:

Code: Select all

<IfModule mod_php4.c>
    # If php is turned on, we repsect .php and .phps files.
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
 
    # Since most users will want index.php to work we
    # also automatically enable index.php
    <IfModule mod_dir.c>
        DirectoryIndex index.html index.php
    </IfModule>
but under someone's advice I bunged in:

Code: Select all

AddType application/x-httpd-php .php
at the very end of the file. Either way it makes no difference.


I have downloaded the lastest MAMP. I am running Mac OS X 10.4.11. When I ask terminal what version of PHP I have it says "PHP 4.4.7".

I've also tried putting my PHP files in the htdocs files folder recommended by MAMP. When I upload the PHP files to my remote server they read fine.

Please help... I so want to start learning PHP!! Either that or I'm going to chuck myself out the window.

Any help much appreicated.

Re: re: HELP! PHP not working

Posted: Tue Dec 09, 2008 8:18 am
by Eran
LoadModule php4_module libexec/httpd/libphp4.so
Uncommenting is not enough, are you sure this is the correct path to the file? did you check if the file exists at this location?

Re: re: HELP! PHP not working

Posted: Tue Dec 09, 2008 1:59 pm
by nickvd
Floody wrote:I am very very new! So sorry... but I can't get PHP code to be seen by my browser when I'm running it off my local web server, my own computer. I've gone through several tutorials and in the terminal app have uncommented the right lines in my httpd.conf file...

so...

Code: Select all

#LoadModule php4_module libexec/httpd/libphp4.so
reads:

Code: Select all

LoadModule php4_module libexec/httpd/libphp4.so
and...

Code: Select all

#AddModule mod_php4.c
reads...

Code: Select all

AddModule mod_php4.c
this was already there:

Code: Select all

<IfModule mod_php4.c>
    # If php is turned on, we repsect .php and .phps files.
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
 
    # Since most users will want index.php to work we
    # also automatically enable index.php
    <IfModule mod_dir.c>
        DirectoryIndex index.html index.php
    </IfModule>
but under someone's advice I bunged in:

Code: Select all

AddType application/x-httpd-php .php
at the very end of the file. Either way it makes no difference.


I have downloaded the lastest MAMP. I am running Mac OS X 10.4.11. When I ask terminal what version of PHP I have it says "PHP 4.4.7".

I've also tried putting my PHP files in the htdocs files folder recommended by MAMP. When I upload the PHP files to my remote server they read fine.

Please help... I so want to start learning PHP!! Either that or I'm going to chuck myself out the window.

Any help much appreicated.

When I installed MAMP, I was very surprised to find that it worked out of the box... Install run mamp.app and click start servers. They also include a dashboard widget which will let you turn the server(s) on/off from the dashboard.