• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2557
  • Last Modified:

Enable PHP on mac OS X 10.4.10

I am trying to enable PHP on my OS X 10.4.10.   I have been working with PHP on a hosted site but will be traveling and need to install it locally (with mySQL) so that I can work on the plane.  I found articles online which say to modify:
    /etc/httpd/httpd.conf
by un-commenting the two lines and then restarting apache:
    LoadModule php4_module libexec/httpd/libphp4.so
    AddModule mod_php4.c
I have done this and verified that these lines are no longer commented out.  I guess because of the version, my httpd.conf file already has the following relevant entries:
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    <IfModule mod_dir.c>
       DirectoryIndex index.html index.php index.htm
    </IfModule>
It seems this couldn't be easier but when I open local php files in a browser, I see the php code instead of the interpereted info.  I tried a default <?php phpinfo(); ?> and also opened a larger php file that I have been working with on my hosted server but the browser just displays the raw php code.  I have restarted my computer and scowered the web but have found surprisingly little about this issue.  I'd prefer not to install a new version of PHP as it should be unnecessary and I'm afraid it will lead to more challenges (the version of php doesn't matter, I'm not doing anything fancy with my code).  I have also visited my default local web site and I get the apache splash page saying that it is running.
Any help you can provide is greatly appreciated.
0
tolmang
Asked:
tolmang
  • 4
  • 2
1 Solution
 
Eoin OSullivanConsultantCommented:
Did you Switch OFF Internet Sharing in the System Preferences, Sharing Panel  and then RE-enable it as you need to restart Apache to enable PHP or reboot the Mac to activate PHP ??
0
 
tolmangAuthor Commented:
Yes, I restarted Apache by turning Internet Sharing off and then back on.  I also did it from the command line:
 sudo /usr/sbin/apachectl stop
 sudo /usr/sbin/apachectl start
And again by restarting the computer.  Each time I looked at the Apache splash page to ensure it was running before testing PHP.
Do I need to start PHP itself or do something more than modifying the httpd.conf file as described above?
Thanks.
0
 
Eoin OSullivanConsultantCommented:
You've done everyting right .. it should work ..
The quickest solution rather than wasting too much time

1. Download the Entrpy PHP installer
http://www.entropy.ch/software/macosx/php/
It is really easy and fast and will set itself up

2. Try using MAMP - my preferred option
http://www.mamp.info/en/home/
This is a seperate installation of Apache2, MySQL and PHP which sits in your Applications folder and works first time every time!!
You just drop your code into the htdocs folder inside the MAMP folder and away you go!!


0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
tolmangAuthor Commented:
Eoinosullivan,
I tried MAMP but it is not working eiither.  I couldn't download it from their site (broken links) but I downloaded it from sourceforge.net (listed as release 1.6).  It seemed to install fine.  I used the widget to start the servers and moved my test files in to the applications/MAMP/htdocs directory.  Still, when I open the file with Safari, it displays:
<?php
phpinfo();
?>
The widget shows the servers are running.  I rebooted to see if it would make any difference.  I also put one of my large php files in this dir but as with the test file, Safari displays the raw code.
Any other ideas?
Thanks.
0
 
tolmangAuthor Commented:
The Apache log looks fine (most recent entry):
[Wed Aug 01 19:09:12 2007] [notice] Digest: generating secret for digest authentication ...
[Wed Aug 01 19:09:12 2007] [notice] Digest: done
[Wed Aug 01 19:09:13 2007] [notice] Apache/2.0.59 (Unix) PHP/5.2.1 DAV/2 mod_ssl/2.0.59 OpenSSL/0.9.7l configured -- resuming normal operations
0
 
tolmangAuthor Commented:
So it is working after all (no surprise).  I didn't know that I needed to open the files a special way, using the ports, etc.  The files now display correctly in Safari when (instead of just opening the file), I put the following in the address bar:
http://localhost:8888/phpinfo.php
The file phpinfo.php is in the directory:
applications/MAMP/htdocs

Thanks for your help.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now