开发者

.php extension not being parsed by apache on mac os x 10.6

开发者 https://www.devze.com 2023-01-12 08:07 出处:网络
I wanted to use postgres with php, and the default install of mac os x, doesn开发者_开发知识库\'t have the postgres php modules installed. I tried using the entropy.ch install not realizing that it wa

I wanted to use postgres with php, and the default install of mac os x, doesn开发者_开发知识库't have the postgres php modules installed. I tried using the entropy.ch install not realizing that it was incompatible with mac os x 10.6. After removing the entropy code, attempts to render php files responded with a textual representation of the php file.


Additional configuration of php is called out in this line:

Include /private/etc/apache2/other/*.conf

of /private/etc/apache2/httpd.conf

I believe I had accidentally deleted the php configuration file that should be in that directory. I created a file named php.conf and put the following lines into that file:

<FilesMatch
   "\.php$|\.php5$|\.php4$|\.php3$|\.phtml$|\.phpt$">
     SetHandler application/x-httpd-php </FilesMatch> <FilesMatch "\.phps$">
     SetHandler application/x-httpd-php-source
 </FilesMatch>

That enabled apache to set the right mime type on the request, pass it to php which then rendered the code. Painful time wasting mistake.

In addition you need this also:

<IfModule dir_module>
    DirectoryIndex index.html index.php index.htmls index.htm
</IfModule>


You might want to consider using XAMPP or MAMP fore development purposes. I think most Mac devs do and I do as well. It makes things much easier for me.

0

精彩评论

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

关注公众号