I don't know what to do. I read the related question on stackoverflow just like mine but those changes didn't work. I asked again on stackoverflow and they sent me here. They sent that I need to load my PHP module, but I've done that (at least to my knowledge). Here is what I posed to them:

First, I edited the httpd.conf file and uncommented LoadModule php5_module libexec/apache2/libphp5.so .

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.

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 stackoverflow 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".

Then I finally added AddType x-httpd-php .php to the httpd.conf file because that was also mentioned in the previous question on stackoverflow. I did it just for good measure. Nada.

I'm baffled. 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 print 'Hello World' in my browser.

  • Please give us your configuration (formatted as a code block so it comes out readable) so we can see what's gone wrong. The symptoms tell us that apache doesn't think that whatever.php needs to be passed to mod_php for processing, but the changes you made should fix it. Other things to check: is the file you're editing the same file apache is using? – DerfK Feb 15 '11 at 22:44
  • What exact URL are you trying to go to when you see your source code? – Matt Gibson Feb 15 '11 at 22:48
  • Oh Jesus... no wonder. All this time I was just opening it as a file. I should have gotten more sleep last night. Thanks. – Storm Holloway Feb 15 '11 at 23:39
  • I know it sounds kind of obvious but did you remember to reload the config or restart Apache? – John Gardeniers Feb 16 '11 at 0:33
  • @Storm Sometimes, it's the obvious things that trip you up :) – Matt Gibson Feb 16 '11 at 0:35

If you're looking to program, and want something that 'just works', you may consider just doing a MAMP (Mac, Apache, MySQL, PHP stack) install and moving on. I've used it a few times under Leopard and it did the trick.

  • Oh I see.. I thought MAMP was just a general name for this combination of platforms, which I thought I was using. I didn't realize this was a download. – Storm Holloway Feb 15 '11 at 22:39
  • @Storm: It is a general name for that combination, but there are packaged solutions that put everything together preconfigured. This one happens to be named MAMP – DerfK Feb 15 '11 at 22:44
  • Here's my problem now: I have MAMP up and running, phpversion works through their link. MAMP tells me things are working, yet a simple Hello World .php file just shows me the code in the browser. How can this be a server issue still? I'm baffled. – Storm Holloway Feb 15 '11 at 23:35
  • Well at least some other poor morons will have this as a resource. – Storm Holloway Feb 15 '11 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.