Administration
  Home arrow Administration arrow Page 5 - Building Apache, MySQL, and PHP on Mac...
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ADMINISTRATION

Building Apache, MySQL, and PHP on Mac OS X
By: Lucas Marshall
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 8
    2001-05-21

    Table of Contents:
  • Building Apache, MySQL, and PHP on Mac OS X
  • Prerequisites
  • Making MySQL
  • Making WebDAV
  • Making PHP
  • Caveats

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    FaxWave - Free Trial.
     
    ADVERTISEMENT

    PCmover - $15 Off with Coupon Code CJPH7Q

    Building Apache, MySQL, and PHP on Mac OS X - Making PHP
    (Page 5 of 6 )

    The last step is to get PHP set up.

    % cd .. % gnutar zxf php-4.0.5.tar.gz % cd php-4.0.5
    Now PHP is decompressed and ready to be configured.

    % ./configure --with-mysql=/usr/local ¬ --with-apxs=/usr/sbin/apxs \
    --with-zlib=/usr

    The --with-mysql option tells the configure script that we want to use the MySQL libraries that were installed with MySQL instead of the ones that come with PHP. The --with-apxs option does the same thing it does in the mod_dav configuration, tells the configure script that we want PHP compiled as a DSO, and the --with-zlib option tells the configure script where to find the zlib libraries it needs (These are included in Mac OS X).

    Running the configure script strangely breaks one file in the distribution, main/internal_functions.c. In that file, some of the #include lines are run together into one line, and have the letter "n" separating them.

    You can edit this file manually to fix this, but I've made a Perl script that will do the trick, if you'd rather use it.

    Execute the following commands to use my script.

    % wget http://www.devshed.com/article-images/fix_php.pl
    % chmod +x fix_php.pl

    This will get the script and allow you to execute it, and

    % ./fix_php.pl
    will run it, fixing the problem.

    % make
    % sudo make install

    These commands will compile, install, and enable the PHP module.

    You're not done yet, you need to tell Apache to use the PHP module for all files with a .php extension. Edit the Apache configuration file:

    % sudo pico /etc/httpd/httpd.conf
    and remove the #s from the lines that look like this:

    # And for PHP 4.x, use:
    #
    #AddType application/x-httpd-php .php
    #AddType application/x-httpd-php-source .phps

    so they end up looking like this:

    # And for PHP 4.x, use:
    #
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps

    and restart your Apache server.

    % sudo apachectl restart
    Now, to test your PHP setup, you'll need to make a PHP script. Type the following:

    % pico /Library/WebServer/Documents/phpinfo.php
    and paste this in:

    <?php phpinfo(); ?>
    Save and exit, then open up your web browser and go to http://localhost/phpinfo.php If everything is working correctly, your browser will display a nicely formatted page with info about your PHP installation, and we're done!

    More Administration Articles
    More By Lucas Marshall


     

       

    ADMINISTRATION ARTICLES

    - Configuring Load-Balanced Clusters
    - Load-Balanced Clusters
    - UNIX Time Format Demystified
    - Making Changes in the CVS
    - Building Your First CVS Repository
    - CVS Quickstart Guide
    - Authorizing Users in Samba
    - Handling User Accounts in Samba
    - Authentication in Samba
    - Accounts, Authentication, and Authorization
    - Advanced Concepts on Dealing with Files and ...
    - Dealing with Files and Filesystems
    - More Hacks for the User Environment in BSD
    - Personalizing the User Environment in BSD
    - Customizing the User Environment in BSD

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway