Build your own Apache server and PHP interpreter on Mac OS, _php tutorial

Source: Internet
Author: User

Build your own Apache server and PHP interpreter on Mac OS,

Apache 2.2.27 and PHP 5.5.12 in Mac OS X 10.8.5 Compile the installation process:
Before you begin, upgrade the components of Xcode: Preferences = Downloads = Download command line tools package

Then enter the Apache source package, for most of the source package can use the following command to see the compilation options:


To configure compilation options:



Checking for Apr-util ... Yeschecking for GCC .../applications/ Ccchecking whether the C compiler works ... noconfigure:error:in '/users/levin/downloads/httpd-2.2.27 ': configure:error : C compiler cannot create Executablessee ' config.log ' for more details

The above error refers to the path:


does not exist


Cd/applications/ ln-s Xcodedefault.xctoolchain OSX10.8.xctoolchain

Then compile and install:

Makemake Install

Edit the configuration file httpd.conf, generally modify the listening port, run Apache users and groups, server name, open gzip configuration.

Go to the installed directory to start Apache:

./bin/apachectl Start

Install PHP

For PHP Compile options refer to: Php:list of core Configure Options-manual

./configure--prefix=/users/levin/dev/php5.5.12--with-apxs2=/users/levin/dev/apache2.2.27/bin/apxs-- With-config-file-path=/users/levin/dev/php5.5.12/etc--with-openssl--with-zlib--enable-bcmath--with-bz2-- With-curl--enable-ftp--with-gd--enable-gd-native-ttf--with-mhash--enable-mbstring--enable-soap--enable-zip-- Enable-sockets--with-mysql=/usr/local/mysql-5.6.12-osx10.7-x86_64--with-mysqli=/usr/local/ Mysql-5.6.12-osx10.7-x86_64/bin/mysql_config--with-iconv--with-pear--enable-opcachemake

The entire compilation process takes 5-10 minutes, depending on the hardware configuration, you can get a cup of milk to drink first

Error occurred:

Undefined Symbols for Architecture x86_64: ' _res_9_init ', referenced from:   _zif_dns_get_mx in DNS.O   _zif_dns_ Get_record in DNS.O   _zif_dns_check_record in DNS.O "_res_9_search", referenced from:   _zif_dns_get_mx in dns.o< C4/>_zif_dns_get_record in DNS.O   _zif_dns_check_record in DNS.O "_res_9_dn_skipname", referenced from:   _zif_ Dns_get_mx in DNS.O   _zif_dns_get_record in DNS.O "_res_9_dn_expand", referenced from:   _zif_dns_get_mx in dns.o< C9/>_php_parserr in Dns.old:symbol (s) is found for architecture X86_64collect2:ld returned 1 exit statusmake: * * * [libs /libphp5.bundle] Error 1




Dyld:library not loaded:libmysqlclient.18.dylib referenced from:/users/levin/downloads/php-5.5.12/sapi/cli/php Reason:image not found...make: * * * [ext/phar/phar.php] Error 133


Cd/usr/libln-s/usr/local/mysql-5.6.12-osx10.7-x86_64/lib/libmysqlclient.18.dylib Libmysqlclient.18.dylib

Recompile and install:

Make clean && makemake install

Installation is completed, you need to copy a configuration file from PHP source directory to the installation directory under the ETC folder and renamed to PHP.ini, you need to change the configuration of PHP to use the file.

Articles you may be interested in:

    • Apache + MySql + PHP build Web development environment under Mac true techarticle Build your own Apache server and PHP interpreter on Mac OS, Apache 2.2.27 and PHP 5.5.12 in Mac OS X 10.8.5 compile the installation process: First upgrade the components of Xcode before you start: Prefe ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.