Mac Pro Compiler installation PHP 5.6.21 detailed

Source: Internet
Author: User
Tags bz2 fpm ftp gettext install php install brew openssl pear

Note "Before compiling, you need to install the Xcode kit!"

1, the preparation of related software packages, unified into the/usr/local/src/php directory:

Http://cn2.php.net/distributions/php-5.6.21.tar.gz
Http://ncu.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz
Ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.5.7.tar.gz
Http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz
Https://sourceforge.net/projects/libpng/files/libpng16/1.6.21/libpng-1.6.21.tar.xz/download
Http://www.ijg.org/files/jpegsrc.v9a.tar.gz
Http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
Http://download.savannah.gnu.org/releases/freetype/freetype-2.4.12.tar.gz
Http://ftp.gnu.org/gnu/gettext/gettext-0.19.tar.gz

2. Install dependent library

# Install LIBMCRYP
cd/usr/local/src/php
TAR-XZVF./libmcrypt-2.5.7.tar.gz
CD./libmcrypt-2.5.7
./configure
Make
sudo make install

# Install Libmhash
cd/usr/local/src/php
TAR-XZVF./mhash-0.9.9.9.tar.gz
CD./mhash-0.9.9.9
./configure
Make
sudo make install

# Install MCrypt
cd/usr/local/src/php
TAR-XZVF./libmcrypt-2.5.7.tar.gz
CD./libmcrypt-2.5.7
./configure
Make
sudo make install

# Install Libiconv
cd/usr/local/src/php
TAR-XZVF./libiconv-1.14.tar.gz
CD./libiconv-1.14
./configure
Make
sudo make install

# Install BZIP2
cd/usr/local/src/php
TAR-XZVF./bzip2-1.0.6.tar.gz
CD./bzip2-1.0.6
Make
Make install

# Install libpng (PNG image processing, GD library dependencies)
cd/usr/local/src/php
TAR-XZVF./libpng-1.6.21.tar.xz
CD./libpng-1.6.21
./configure
Make
sudo make install

# install ibjpeg (JPG image processing, GD library dependencies)
cd/usr/local/src/php
TAR-XZVF./jpegsrc.v9a.tar.gz
CD./jpeg-9a
./configure
Make
sudo make install

# Install FreeType
cd/usr/local/src/php
TAR-XZVF./freetype-2.4.12.tar.gz
CD./freetype-2.4.12
./configure
Make
sudo make install

# Install GetText
cd/usr/local/src/php
TAR-XZVF./gettext-0.19.tar.gz
CD./gettext-0.19
./configure
Make
sudo make install

3. Install PHP

# Unzip the PHP installation package
cd/usr/local/src/php
TAR-XZVF./php-5.6.21.tar.gz
CD./php-5.6.21

# Compile

./configure \
--prefix=/usr/local/php \
--WITH-CONFIG-FILE-PATH=/USR/LOCAL/PHP/ETC \
--WITH-OPENSSL \
--with-zlib \
--WITH-BZ2 \
--WITH-GD \
--with-jpeg-dir \
--with-png-dir \
--with-gettext \
--with-mhash \
--with-freetype-dir \
--with-mcrypt \
--with-iconv \
--with-curl \
--with-curlwrappers \
--WITH-XMLRPC \
--with-mysql \
--with-pdo-mysql \
--WITH-MYSQLI \
--enable-calendar \
--ENABLE-PDO \
--enable-zip \
--enable-mbstring \
--enable-mbregex \
--enable-bcmath \
--ENABLE-SOAP \
--enable-sockets \
--ENABLE-FTP \
--ENABLE-GD-NATIVE-TTF \
--ENABLE-SHMOP \
--ENABLE-SYSVMSG \
--enable-sysvsem \
--ENABLE-SYSVSHM \
--enable-xml \
--ENABLE-PCNTL \
--ENABLE-FPM \
--enable-opcache \
--without-pear


"Error"

Configure:error:Cannot find OpenSSL ' s <evp.h>

Solution

1. Installation OpenSSL

Brew Install OpenSSL

2, change--with-openssl to--with-openssl=/usr/local/opt/openssl
(if brew is installed, OpenSSL path is/usr/local/opt/openssl/
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--with-openssl =/USR/LOCAL/OPT/OPENSSL \
--with-zlib \
--with-bz2 \
--with-gd \
--with-jpeg-dir \
--with-png-dir \--with-gettext \
--with-mhash \
--with-freetype-dir \
--with-mcrypt \
--with-iconv \
--with-curl \< br>--with-xmlrpc \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--enable-calendar \
--ENABLE-PD o \
--enable-zip \
--enable-mbstring \
--enable-mbregex \
--enable-bcmath \
--enable-soap \
--enab le-sockets \
--enable-ftp \
--enable-gd-native-ttf \
--enable-shmop \
--enable-sysvmsg \
-- Enable-sysvsem \
--enable-sysvshm \
--enable-xml \
--enable-pcntl \
--enable-fpm \
--enable-opcache \
--without-pear


# Execute Make

Make

Error

Undefined Symbols for Architecture x86_64:
"_pkcs5_pbkdf2_hmac", referenced from:
_ZIF_OPENSSL_PBKDF2 in OPENSSL.O
"_tlsv1_1_client_method", referenced from:
_php_openssl_setup_crypto in XP_SSL.O
"_tlsv1_1_server_method", referenced from:
_php_openssl_setup_crypto in XP_SSL.O
"_tlsv1_2_client_method", referenced from:
_php_openssl_setup_crypto in XP_SSL.O
"_tlsv1_2_server_method", referenced from:
_php_openssl_setup_crypto in XP_SSL.O
...
Ld:symbol (s) not found for architecture x86_64
Clang:error:linker command failed with exit code 1 (use-v to the invocation)
Make: * * * [sapi/cli/php] Error 1

Solution

modifying Makefile files
Locate the Extra_libs node, remove all-lssl and-lcrypto, and then append libssl.dylib and Libcrypto.dylib paths (if you install brew, then/usr/local/opt/openssl/li b/), rerun make command.
Attached to my revised MakeFile Extra_libs line:
Extra_libs =-lz-lresolv-liconv-liconv-lintl-lpng-lz-ljpeg-lcurl-lbz2-lz-lm-lxml2-lz-licucore-lm-lcurl- Lxml2-lz-licucore-lm-lfreetype-lz
-lbz2-lxml2-lz-licucore-lm-lxml2-lz-licucore-lm-lxml2-lz-licucore-lm-lxml2-lz-licucore-lm-lxml2-lz-licu Core-lm-lxml2-lz-licucore-lm/usr/local/opt/openssl/lib/libssl.dylib/usr/local/opt/openssl/lib/libcrypto.dylib

# re-make

Make clean

Make

Error
Ld:library not found For-lresolv-liconv
Clang:error:linker command failed with exit code 1 (use-v to the invocation)
Make: * * * [sapi/cli/php] Error 1
Solution

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.