Self-compiling on Mac OS install Apache server and PHP interpreter _php instance

Source: Internet
Author: User

The Apache 2.2.27 and PHP 5.5.12 compile the installation process in Mac OS X 10.8.5:
Upgrade Xcode components first before starting: Preferences => Downloads => download command line tools Kit

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

./configure--help

To configure compilation options:

./configure--prefix=/users/levin/dev/apache2.2.27--enable-modules=most--enable-mods-shared=all

Error:

Checking for Apr-util ... Yes
checking for gcc .../applications/xcode.app/contents/developer/toolchains/osx10.8.xctoolchain/usr/bin/cc
checking whether the C compiler works ... no
configure:error:in '/users/levin/downloads/httpd-2.2.27 ':
Configure:error:c compiler cannot create executables
' config.log ' for more details

The above error refers to the path:

/applications/xcode.app/contents/developer/toolchains/osx10.8.xctoolchain/usr/bin/cc

does not exist

Workaround:

Cd/applications/xcode.app/contents/developer/toolchains
sudo ln-s xcodedefault.xctoolchain Osx10.8.xctoolchain

Then compile and install:

Make make
Install

Edit Profile httpd.conf, general modify listening port, run Apache user and group, server name, turn on gzip configuration.

Go to the installed directory to start Apache:

./bin/apachectl Start

Installing PHP

About PHP Compile options can 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-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-opcache make

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

An 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
   _zif_dns_get_record into 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
   _php_parserr on DNS.O
Ld:symbol (s) not found for architecture
Collect2:ld returned 1 exit status make
: * * * [libs/libphp5.bundle] Error 1

Solve:

Export LDFLAGS=-LRESOLV

Error:

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

Solve:

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

Recompile and install:

Make-clean && make-make
install

Installation completed, at this time need to copy a configuration file from the PHP source directory to the installation directory, etc folder and renamed to PHP.ini, you need to change the configuration of PHP to use the file can be.

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: info-contact@alibabacloud.com 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.