: This article mainly introduces how to build a PHP environment on mac. For more information about PHP tutorials, see. 1. install various plug-ins first. The first is the command line tool. after the terminal is opened, enter xcode-select-install and install it with your consent. The second is HomeBrew, terminal input ruby-e "$ (curl-fsSL https://raw.github.com/Homebrew/homebrew/go/install )"
Third install autoconf, enter brew install autoconf
2. start importing PHP packages in Mac.
Terminal input./buildconf -- force
. /Configure -- prefix =/usr/local/php7 -- with-apxs2 =/usr/sbin/apxs -- enable-fpm -- with-fpm-user = www -- with-fpm-group = www -- with-mysqli -- with-pdo-mysql -- with-iconv-dir -- with-freetype-dir -- with-jpeg-dir -- with-png-dir -- with-zlib -- -libxml-dir =/usr -- enable-xml -- disable-rpath -- enable-bcmath -- enable-shmop -- enable-sysvsem -- enable-inline-optimization -- with-curl -- enable-xml- mbregex -- enable-mbstring -- with-mcrypt -- enable-ftp -- with-gd -- enable-gd-native-ttf -- with-openssl -- with-mhash -- enable-pcntl -- enable- sockets -- with-xmlrpc -- enable-zip -- enable-soap -- without-pear -- with-gettext -- disable-fileinfo -- enable-maintainer-zts
3. Solve the error
1) configure: error: Cannot find OpenSSL's
Brew install openssl
Brew link openssl-force
2) configure: error: Invalid Lib. h not found.
Brew install libjpeg
3) configure: error: png. h not found.
Brew install libpng
4) freetype
Go to the official open-source support site of Apple: http://www.apple.com/opensource/find and download the zlib/libpng/jpeg/freetype/libgd file of gd1_. here we provide a package and execution script:
Tar-zxf gd.tar.gz
Cd gd
Sudo./install
4) configure: error: Cannot locate header file libintl. h
Install gettext
Sudo brew install gettext
Edit The configure file and find the path $ PHP_GETTEXT/usr/local/usr followed by gettext $ PHP_GETTEXT/usr/local/opt/gettext.
5) configure: error: mcrypt. h not found. Please reinstall libmcrypt.
Brew install wget
Http://www.tuicool.com/articles/yaQnmi2
The above describes how to set up a PHP environment for mac, including some content, and hope to help those who are interested in the PHP Tutorial.