Home > Backend Development > PHP Tutorial > Compile and install Apache server and PHP interpreter on Mac OS by yourself, _PHP tutorial

Compile and install Apache server and PHP interpreter on Mac OS by yourself, _PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-12 09:02:43
Original
928 people have browsed it

Compile and install the Apache server and PHP interpreter on Mac OS by yourself,

The compilation and installation process of Apache 2.2.27 and PHP 5.5.12 on Mac OS X 10.8.5:
Before starting, first upgrade the components of Xcode: preferences => Downloads => Download the Command Line Tools package

Then enter the Apache source code package. For most source code packages, you can use the following command to view the compilation options:

./configure --help
Copy after login

Configure compilation options:

./configure --prefix=/Users/levin/dev/apache2.2.27 --enable-modules=most --enable-mods-shared=all
Copy after login

Error report:

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
See `config.log' for more details
Copy after login

The above error report refers to the path:

/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain/usr/bin/cc
Copy after login

Does not exist

Solution:

cd /Applications/Xcode.app/Contents/Developer/Toolchains
sudo ln -s XcodeDefault.xctoolchain OSX10.8.xctoolchain
Copy after login

Then compile and install:

make
make install
Copy after login

Edit the configuration file httpd.conf, generally modify the listening port, user and group running Apache, server name, enable gzip and other configurations.

Enter the installed directory and start Apache:

./bin/apachectl start
Copy after login

Install PHP

For information on PHP compilation options, please 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-opcache
make
Copy after login

The entire compilation process takes 5-10 minutes, depending on the hardware configuration. You can get a glass of milk 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 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
   _php_parserr in dns.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1
Copy after login

Solution:

export LDFLAGS=-lresolv
Copy after login

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
Copy after login

Solution:

cd /usr/lib
ln -s /usr/local/mysql-5.6.12-osx10.7-x86_64/lib/libmysqlclient.18.dylib libmysqlclient.18.dylib
Copy after login

Recompile and install:

make clean && make
make install
Copy after login

The installation is complete. At this time, you need to copy a configuration file from the PHP source code directory to the etc folder of the installation directory and rename it to php.ini. Use this file when you need to change the PHP configuration.

Articles you may be interested in:

  • Building a website development environment with Apache MySql PHP under mac

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1084543.htmlTechArticleCompile and install the Apache server and PHP interpreter by yourself on Mac OS. Apache 2.2.27 and PHP 5.5.12 are Compilation and installation process of Mac OS
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
mac use
From 1970-01-01 08:00:00
0
0
0
How to install it on Mac?
From 1970-01-01 08:00:00
0
0
0
Why doesn’t Mac have PHPstudy?
From 1970-01-01 08:00:00
0
0
0
When will phpstudy release a mac version?
From 1970-01-01 08:00:00
0
0
0
Where is the telnet option on mac computer?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template