Install PHP 5.6 on EC2

InstallPHP5.6onEC2

Startwiththisversion

>wgethttp://ar2.php.net/distributions/php-5.6.16.tar.bz2

Unzipthefile

>tar-xvfphp-5.6.16.tar.bz2

Configurethat

>./configure--prefix=/home/ec2-user/tool/php-5.6.16--with-openssl--with-iconv-dir=/usr/lib--with-curl=/opt/local/include/curl--with-mysql--with-pdo-pgsql--with-zlib-dir--with-freetype-dir--enable-mbstring--with-libxml-dir=/usr--enable-soap--enable-calendar--with-curl--with-mcrypt--with-zlib--with-gd--with-pgsql--disable-rpath--enable-inline-optimization--with-bz2--with-zlib--enable-sockets--enable-sysvsem--enable-sysvshm--enable-pcntl--enable-mbregex--enable-exif--enable-bcmath--with-mhash--enable-zip--with-pcre-regex--with-mysql--with-pdo-mysql--with-mysqli--with-jpeg-dir=/usr--with-png-dir=/usr--enable-gd-native-ttf--with-fpm-user=www-data--with-fpm-group=www-data--with-libdir=/lib/x86_64-linux-gnu--enable-ftp--with-imap--with-imap-ssl--with-kerberos--with-gettext--with-xmlrpc--with-xsl--enable-opcache--enable-fpm

1ErrorMessage:

configure:error:xml2-confignotfound.Pleasecheckyourlibxml2installation.

Solution:

sudoyuminstalllibxml2-devel

2ErrorMessage:

configure:error:CannotfindOpenSSL's<evp.h>

Solution:

sudoyuminstallopenssl-devel

3ErrorMessage:

configure:error:PleasereinstalltheBZip2distribution

Solution:

sudoyuminstallbzip2-devel

4ErrorMessage:

configure:error:Pleasereinstallthelibcurldistribution-

easy.hshouldbein<curl-dir>/include/curl/

Solution:

sudoyuminstallcurl-devel

5ErrorMessage:

Ifconfigurefailstry--with-vpx-dir=<DIR>

configure:error:jpeglib.hnotfound.

Solution:

sudoyuminstalllibjpeg-devel

6ErrorMessage:

Ifconfigurefailstry--with-vpx-dir=<DIR>

checkingforjpeg_read_headerin-ljpeg...yes

configure:error:png.hnotfound.

Solution:

sudoyuminstalllibpng-devel

7ErrorMessage:

Ifconfigurefailstry--with-vpx-dir=<DIR>

checkingforjpeg_read_headerin-ljpeg...yes

checkingforpng_write_imagein-lpng...yes

Ifconfigurefailstry--with-xpm-dir=<DIR>

configure:error:freetype-confignotfound.

Solution:

sudoyuminstallfreetype-devel.x86_64freetype.x86_64

8ErrorMessage:

configure:error:utf8_mime2text()hasnewsignature,butU8T_CANONICALismissing.Thisshouldnothappen.Checkconfig.logforadditionalinformation.

Solution:

sudoyuminstalllibc-client-devel

9ErrorMessage:

configure:error:Cannotfindimaplibrary(libc-client.a).Pleasecheckyourc-clientinstallation.

Solution:

http://php.net/manual/en/imap.requirements.php

IdonotthinkIamusingIMAP,soIjustgetridofthat.

>./configure--prefix=/home/ec2-user/tool/php-5.6.16--with-openssl--with-iconv-dir=/usr/lib--with-curl=/opt/local/include/curl--with-mysql--with-pdo-pgsql--with-zlib-dir--with-freetype-dir--enable-mbstring--with-libxml-dir=/usr--enable-soap--enable-calendar--with-curl--with-mcrypt--with-zlib--with-gd--with-pgsql--disable-rpath--enable-inline-optimization--with-bz2--with-zlib--enable-sockets--enable-sysvsem--enable-sysvshm--enable-pcntl--enable-mbregex--enable-exif--enable-bcmath--with-mhash--enable-zip--with-pcre-regex--with-mysql--with-pdo-mysql--with-mysqli--with-jpeg-dir=/usr--with-png-dir=/usr--enable-gd-native-ttf--with-fpm-user=www-data--with-fpm-group=www-data--with-libdir=/lib/x86_64-linux-gnu--enable-ftp--with-kerberos--with-gettext--with-xmlrpc--with-xsl--enable-opcache--enable-fpm

10ErrorMessage:

configure:error:mcrypt.hnotfound.Pleasereinstalllibmcrypt.

Solution:

sudoyuminstalllibmcrypt-devel

11ErrorMessage:

configure:error:Cannotfindlibpq-fe.h.PleasespecifycorrectPostgreSQLinstallationpath

Solution:

DoIusePostgreSQL,no,soIremovethat.

./configure--prefix=/home/ec2-user/tool/php-5.6.16--with-openssl--with-iconv-dir=/usr/lib--with-curl=/opt/local/include/curl--with-mysql--with-zlib-dir--with-freetype-dir--enable-mbstring--with-libxml-dir=/usr--enable-soap--enable-calendar--with-curl--with-mcrypt--with-zlib--with-gd--disable-rpath--enable-inline-optimization--with-bz2--with-zlib--enable-sockets--enable-sysvsem--enable-sysvshm--enable-pcntl--enable-mbregex--enable-exif--enable-bcmath--with-mhash--enable-zip--with-pcre-regex--with-mysql--with-pdo-mysql--with-mysqli--with-jpeg-dir=/usr--with-png-dir=/usr--enable-gd-native-ttf--with-fpm-user=www-data--with-fpm-group=www-data--with-libdir=/lib/x86_64-linux-gnu--enable-ftp--with-kerberos--with-gettext--with-xmlrpc--with-xsl--enable-opcache--enable-fpm

12ErrorMessage:

configure:error:xslt-confignotfound.Pleasereinstallthelibxslt>=1.1.0distribution

Solution:

sudoyuminstalllibxslt-devel

Yeah,itworks.

>make

>makeinstall

WrotePEARsystemconfigfileat:/home/ec2-user/tool/php-5.6.16/etc/pear.conf

Youmaywanttoadd:/home/ec2-user/tool/php-5.6.16/lib/phptoyourphp.iniinclude_path

/home/ec2-user/install/php-5.6.16/build/shtoolinstall-cext/phar/phar.phar/home/ec2-user/tool/php-5.6.16/bin

ln-s-fphar.phar/home/ec2-user/tool/php-5.6.16/bin/phar

InstallingPDOheaders:/home/ec2-user/tool/php-5.6.16/include/php/ext/pdo/

Addthattothepath

>sudoln-s/home/ec2-user/tool/php-5.6.16/opt/php-5.6.16

>sudoln-s/opt/php-5.6.16/opt/php

>vi~/.bash_profile

PATH=$PATH:$HOME/bin:/opt/maven/bin

PATH=$PATH:/opt/sbt/bin

PATH=$PATH:/opt/jdk/bin:/opt/jdk/jre/bin

PATH=$PATH:/opt/node/bin

PATH=$PATH:/opt/php/bin

exportPATH

JAVA_HOME=/opt/jdk

exportJAVA_HOME

JRE_HOME=/opt/jdk/jre

exportJRE_HOME

>sudoln-s/opt/php/bin/php/usr/bin/php

References:

http://supportlobby.com/library-errors-when-compile-php-5-on-centos/

http://www.creativ-tech.com/kb/common-php-compile-errors-and-the-corresponding-missing-lib/

相关推荐