Cannot run php script with the good configuration on Mac OS Lion

Go To StackoverFlow.com

1

I have a problem that is driving me crazy.I just want to execute a simple php script on my macbook pro with the native apache of mac OS.

I did all the step of configurations succesfully: -Activate the web sharing -Uncomment LoadModule php5_module libexec/apache2/libphp5.so in /etc/apache2/httpd.conf -Uncomment Include /private/etc/apache2/extra/httpd-userdir.conf -Restart apache in the terminal with:sudo apachectl restart -I put the php script in the folder Site

The script is just:

<?php
echo "Hello";
?>

When I try to launch it in the url with:http://localhost/~user/connect.php I always see the code over and not Hello. I don't see what I did wrong and I can't find the solution on the Web

Thank you for your answers.

Quentin

2012-04-04 17:57
by Quentin91360


0

Make sure you mark files ending in .php to be excecuted as a script, you can do that with a .htaccess

AddType application/x-httpd-php .php
2012-04-04 17:59
by gosukiwi
I did it and nothing change :- - Quentin91360 2012-04-04 19:08
Did you name the file ".htaccess" and put it in the same folder as the php file? That's so weird.. - gosukiwi 2012-04-04 19:15
Yes, I did it exactly the way you said me - Quentin91360 2012-04-04 19:28
Ads