Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- php not working with 'localhost'
July 2, 2007, 2:49 pm
rate this thread
just fine. But when I run the php file using 'localhost', it renders
the source code. It's as if it does not recognize it as php. There are
other variables, but I don't want to make a full page post.
In a nutshell:
(http://184.108.40.206/~username/file.php ) works
(http://localhost/~username/file.php) does not work.
oh.. I'm using a MAMP setup
~mike (new to this group)
Re: php not working with 'localhost'
from the INSTALL file that comes with the php distribution:
14. Edit your httpd.conf to load the PHP module. The path on the
side of the LoadModule statement must point to the path of the PHP
module on your system. The make install from above may have
added this for you, but be sure to check.
For PHP 4:
LoadModule php4_module modules/libphp4.so
For PHP 5:
LoadModule php5_module modules/libphp5.so
15. Tell Apache to parse certain extensions as PHP. For example,
let's have Apache parse the .php extension as PHP. You could
have any extension(s) parse as PHP by simply adding more, with
each separated by a space. We'll add .phtml to demonstrate.
AddType application/x-httpd-php .php .phtml
It's also common to setup the .phps extension to show highlighted
source, this can be done with:
AddType application/x-httpd-php-source .phps
Make sure that you have done this in your apache configuration file
such that apache knows that any requests for localhost handle .php
files with the php module.
That is not particularly helpful, but I hope it at least points you in
the right direction