开发者

Again, PHP in Mac OS X: PHP loads source code in browser rather than executing [closed]

开发者 https://www.devze.com 2023-02-11 11:33 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

I don't know what to do. I read the related question on this site just like mine but those changes didn't work.

First, I edited the httpd.conf file and uncommented the PHP load module line. Next after getting this error "/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument" I changed ULIMIT_MAX_FILES="ulimit -S -n ulimit -H -n to ULIMIT_MAX_FILES="" or some odd thing. That resolved that error.

Then I finally added AddType x-httpd-php .php to the httpd.conf file because that was also mentioned in the previous question here on stackoverflow.

However I still just see my source code in Safari (actually Chrome decided to download the PHP file instead--different problem/story). Then I found a question similar to mine on this site and added some AddHandler lines to the php5.conf file which mimicked the AddType lines in the file after AddHandler. Still didn't work even after a "sudo apachectl restart".

I'm baffled. Please help. I'm just trying to get started so I can learn to program and I feel like I've spent a lifetime just trying to prin开发者_运维百科t 'Hello World' in my browser.


Whenever a server side script is being served as a file rather than executed as code, it means your server has not been configured properly. Make sure you have enabled the PHP module in your httpd.conf file and restarted the web server by opening preferences and toggling the "Web Sharing" option in the Sharing pane.

As a commenter noted, however, this is not a programming question but is a server administration question. Go look at the resources in serverfault.

0

精彩评论

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