Install PHP 5.6 on EC2
Start with this version
> wget http://ar2.php.net/distributions/php-5.6.16.tar.bz2
Unzip the file
> tar -xvf php-5.6.16.tar.bz2
Configure that
> ./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
1 Error Message:
configure: error: xml2-config not found. Please check your libxml2 installation.
Solution:
sudo yum install libxml2-devel
2 Error Message:
configure: error: Cannot find OpenSSL's <evp.h>
Solution:
sudo yum install openssl-devel
3 Error Message:
configure: error: Please reinstall the BZip2 distribution
Solution:
sudo yum install bzip2-devel
4 Error Message:
configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
Solution:
sudo yum install curl-devel
5 Error Message:
If configure fails try --with-vpx-dir=<DIR>
configure: error: jpeglib.h not found.
Solution:
sudo yum install libjpeg-devel
6 Error Message:
If configure fails try --with-vpx-dir=<DIR>
checking for jpeg_read_header in -ljpeg... yes
configure: error: png.h not found.
Solution:
sudo yum install libpng-devel
7 Error Message:
If configure fails try --with-vpx-dir=<DIR>
checking for jpeg_read_header in -ljpeg... yes
checking for png_write_image in -lpng... yes
If configure fails try --with-xpm-dir=<DIR>
configure: error: freetype-config not found.
Solution:
sudo yum install freetype-devel.x86_64 freetype.x86_64
8 Error Message:
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
Solution:
sudo yum install libc-client-devel
9 Error Message:
configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.
Solution:
http://php.net/manual/en/imap.requirements.php
I do not think I am using IMAP, so I just get rid of that.
>./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
10 Error Message:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Solution:
sudo yum install libmcrypt-devel
11 Error Message:
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
Solution:
Do I use PostgreSQL, no, so I remove that.
./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
12 Error Message:
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
Solution:
sudo yum install libxslt-devel
Yeah, it works.
> make
> make install
Wrote PEAR system config file at: /home/ec2-user/tool/php-5.6.16/etc/pear.conf
You may want to add: /home/ec2-user/tool/php-5.6.16/lib/php to your php.ini include_path
/home/ec2-user/install/php-5.6.16/build/shtool install -c ext/phar/phar.phar /home/ec2-user/tool/php-5.6.16/bin
ln -s -f phar.phar /home/ec2-user/tool/php-5.6.16/bin/phar
Installing PDO headers: /home/ec2-user/tool/php-5.6.16/include/php/ext/pdo/
Add that to the path
> sudo ln -s /home/ec2-user/tool/php-5.6.16 /opt/php-5.6.16
> sudo ln -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
export PATH
JAVA_HOME=/opt/jdk
export JAVA_HOME
JRE_HOME=/opt/jdk/jre
export JRE_HOME
> sudo ln -s /opt/php/bin/php /usr/bin/php
References:
http://sillycat.iteye.com/blog/2223621
http://sillycat.iteye.com/blog/2149513
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/
Install PHP 5.6 on EC2
猜你喜欢
转载自sillycat.iteye.com/blog/2276834
今日推荐
周排行