Compile and install php under Apple MacOSX

Source: Internet
Author: User
Tags mcrypt
The PHP version that comes with OSXYosemite10.10.3 is 5.5.20. thanks to the tossing spirit and the controllability of the installation details, the author adds a new version of PHP 5.6.8 to the system by compiling and installing it, some common extension modules are enabled. The PHP version of OS X Yosemite 10.10.3 is 5.5.20. it is difficult to understand and control the installation details, the author adds a new version of PHP 5.6.8 to the system by compiling and installing it, and opens some common extension modules.

The purpose of this compilation and installation is to run PHP in FastCGI mode for Nginx to build the LNMP environment under OS X.

Download the dependencies required in the installation and compilation options

All dependent libraries are compiled and installed in the/usr/local/lib path. if the path does not exist, create it manually.

Libmhash (encrypted Extension Library)

# Download Page: http://sourceforge.net/projects/mhash/# Current version: tar zxvf mhash-0.9.9.9.tar.gz $ cd mhash-0.9.9.9 $./configure -- prefix =/usr/local/lib/libmhash $ make $ sudo make install

Libmcrypt (encrypted Extension Library)

# Download Page: http://mcrypt.hellug.gr/lib/# Current version: tar zxvf libmcrypt-2.5.7.tar.gz $ cd libmcrypt-2.5.7 $./configure -- prefix =/usr/local/lib/libmcrypt $ make $ sudo make install

Libiconv (character encoding conversion Library)

# Download Page: http://www.gnu.org/software/libiconv/# Current version: tar zxvf libiconv-1.14.tar.gz $ cd libiconv-1.14 $./configure -- prefix =/usr/local/lib/libiconv $ make $ sudo make install

Libpng (png image processing, GD Library dependency)

# Download Page: http://www.libpng.org/pub/png/libpng.html# Current version: tar zxvf libpng-1.6.17.tar.gz $ cd libpng-1.6.17 $./configure -- prefix =/usr/local/lib/libpng $ make $ sudo make install

Libjpeg (jpgimage processing, GD Library dependency)

# Download Page: http://www.ijg.org/# Current version: tar zxvf ready src.v9a.tar.gz $ cd jpeg-9a $./configure -- prefix =/usr/local/lib/libjpeg $ make $ sudo make install

Compile and install PHP

$ tar zxvf php-5.6.8.tar.gz$ cd php-5.6.8$ ./configure \    --prefix=/usr/local/php \    --with-config-file-path=/usr/local/php \    --with-mysql \    --with-mysqli \    --enable-pdo \    --with-pdo-mysql \    --with-mysql-sock=/tmp/mysql.sock \    --enable-opcache \    --enable-cgi \    --enable-fpm \    --enable-sockets \    --enable-mbstring \    --enable-mbregex \    --enable-bcmath \    --enable-xml \    --enable-zip \    --with-zlib \    --with-gd \    --with-png-dir=/usr/local/lib/libpng \    --with-jpeg-dir=/usr/local/lib/libjpeg \    --with-openssl \    --with-curl \    --with-mhash=/usr/local/lib/libmhash \    --with-mcrypt=/usr/local/lib/libmcrypt \    --with-iconv=/usr/local/lib/libiconv$ make$ sudo make install$ sudo cp php.ini-development /usr/local/php/php.ini$ cd /usr/local/php/etc$ sudo cp php-fpm.conf.default php-fpm.conf

If no error is reported in the preceding steps, the new PHP installation is successful.

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.