开发者

php appearing as text in browser

PHP files I am trying to test are appearing as text in my browser. Initially they were trying to download instead of display, but I was able to fix that. I have MAMP (Mac OS X Apache MySQL PHP) installed and when I entered php -v into the terminal it returned

PHP 5.2.14 (cli) (built: Oct  6 2010 16:57:10) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies 

indicating that php is installed. I have phpmyadmin in both Sites and MAMP, and (while testing it again right now) it appears that the Sites version is opening as text and the MAMP code from htdocs is still trying to download the php. in my httpd.conf file, i have the line

AddType application/x-httpd-php .php .phtml

edit: my MAMP PHP preferences defaults to PHP 5.3.5 with the option of PHP 5.2.17, however the version I am running seems to be 5.2.14, could this be 开发者_如何学Pythonpart of the problem?


AddType application/x-httpd-php .php .phtml Should be added in the httpd.conf

You'll also wanna make sure that php is included (not commented) out in the libraries that are loaded when apache starts.

also remember to restart apache every time you make a change.


Did you also add the line for loading the PHP module to Apache?

LoadModule php5_module "libexec/apache2/libphp5.so"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜