First, the source installation
1. Compiling the installation
./configure--Prefix=/usr/Local/php\-- with-config-file-path=/usr/Local/php/etc-- with-bz2-- with-curl\--Enable-ftp--Enable-sockets--Disable-ipv6-- with-GD\-- with-jpeg-dir=/usr/Local-- with-png-dir=/usr/Local\-- with-freetype-dir=/usr/Local--Enable-GD-native-ttf\-- with-iconv-dir=/usr/Local--Enable-mbstring--Enable-calendar\-- with-gettext-- with-libxml-dir=/usr/Local-- with-zlib\-- with-pdo-mysql=Mysqlnd-- with-mysqli=Mysqlnd-- with-mysql=Mysqlnd\--Enable-dom--Enable-xml--Enable-FPM-- with-libdir=Lib64--Enable-bcmath
makemake install
2. Error handling
[Error]-1
fornoifofisyesconfigureerror: Cannot find libz
[Error]-2
to enable JIS-mappedin GD...If--with-vpx-dir=<DIR>configure: error: jpeglib.not found.
"Solution"
wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gztar zxvf gd-2.0.33.tar.gzcd gd-2.0.33./configure --prefix=/usr/local/gd2makemake instal
Found on the Internet libjpeg, you can use this library to achieve a variety of JPG image operations; Download: http://freeware.sgi.com/source/libjpeg/libjpeg-6b.tar.gz,
Refer to the Readme installation library for the following steps:
install
[Error]-3
If--with-xpm-dir=<DIR>configure: error: freetype-confignot found.
[Error]-4
to enable JIS-mappedin GD... no configure: error: vpx_codec.not found.
[Bzip2 Install]
tar -xzvf bzip2-1.0.6.tar.gz
Enter the extracted directory:cd bzip2-1.0.6
To prepare for compilation, create a libbz2.so dynamic link library (This step is important, if you do not have this step when you install Python, Python does not install the BZ2 module):
-f Makefile-libbz2_so
Compile and install:make && make install
Second, RPM installation
[Root@kallen ~]# RPM-IVH php-common-5.4.40-1.el6.remi.x86_64.rpmwarning:php-common-5.4.-1.El6.remi.x86_64.rpm:Header V3 dsa/sha1 Signature, key IDxxF97f56:nokeypreparing ...########################################### [100%]file/etc/php.ini fromInstall ofphp-common-5.4.-1.el6.remi.x86_64 conflicts withfile fromPackage php-common-5.3. 3-.El6.x86_64file/usr/lib64/php/modules/curl.so fromInstall ofphp-common-5.4.-1.el6.remi.x86_64 conflicts withfile fromPackage php-common-5.3. 3-.El6.x86_64file/usr/lib64/php/modules/fileinfo.so fromInstall ofphp-common-5.4.-1.el6.remi.x86_64 conflicts withfile fromPackage php-common-5.3. 3-.El6.x86_64file/usr/lib64/php/modules/json.so fromInstall ofphp-common-5.4.-1.el6.remi.x86_64 conflicts withfile fromPackage php-common-5.3. 3-.El6.x86_64file/usr/lib64/php/modules/phar.so fromInstall ofphp-common-5.4.-1.el6.remi.x86_64 conflicts withfile fromPackage php-common-5.3. 3-.El6.x86_64file/usr/lib64/php/modules/zip.so fromInstall ofphp-common-5.4.-1.el6.remi.x86_64 conflicts withfile fromPackage php-common-5.3. 3-.El6.x86_64Error: Failed dependencies:libmysqlclient.so.()( -Bit isNeeded byphp-mysql-5.4.-1.El6.remi.x86_64 libmysqlclient.so.(LIBMYSQLCLIENT_16) ( -Bit isNeeded byphp-mysql-5.4.-1.El6.remi.x86_64 libmysqlclient.so.(LIBMYSQLCLIENT_18) ( -Bit isNeeded byphp-mysql-5.4.-1.El6.remi.x86_64
Third, yum installation
1.php-5.4
php5.4 was released on May 8, 2012, starting with the php5.4.0 PHP has added some new features such as:
- Traits support
- Built-in a simple Web server
- Provides an array of short syntax
- Array values directly on function return values
- Final removal of magic method and Safe mode
We recommend the use of Webtatic EL6 yum Source to install php5.4, we first install webtatic EL6 yum Source, about the installation configuration of the Yum source, please refer to the "Configuring Yum Source in RHEL6" article;
rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm
-y install php54w php54w-bcmath php54w-cli\php54w-common php54w-devel php54w-fpm php54w-gd\php54w-imap php54w-ldap php54w-mbstring php54w-mcrypt\php54w-mysql php54w-odbc php54w-pdo php54w-pear\php54w-pecl-igbinary php54w-xml php54w-xmlrpc\php54w-opcache php54w-intl php54w-pecl-memcache
If the installation fails, it is recommended that you uninstall the previous PHP before installing, using
remove php php-*
List of included PHP extensions:
| Package
provides |
php54w mod_php |
|
Php54w-bcmath |
|
Php54w-cli |
php-cgi, Php-pcntl, Php-readline |
Php54w-common |
Php-api, php-bz2, Php-calendar, Php-ctype, Php-curl, Php-date, Php-exif, Php-fileinfo, Php-ftp, Php-gettext, Php-gmp, PHP -hash, Php-iconv, Php-json, Php-libxml, Php-openssl, Php-pcre, Php-pecl-fileinfo, Php-pecl-phar, Php-pecl-zip, Php-reflection, Php-session, Php-shmop, Php-simplexml, Php-sockets, PHP-SPL, Php-tokenizer, Php-zend-abi, Php-zip, Php-zlib |
Php54w-dba |
|
Php54w-devel |
|
php54w-embedded |
Php-embedded-devel |
Php54w-enchant |
|
php54w-fpm |
|
Php54w-gd |
|
Php54w-imap |
|
Php54w-interbase |
Php_database, Php-firebird |
Php54w-intl |
|
Php54w-ldap |
|
Php54w-mbstring |
|
Php54w-mcrypt |
|
Php54w-mssql |
|
Php54w-mysql |
Php-mysqli, Php_database |
Php54w-odbc |
PHP-PDO_ODBC, Php_database |
Php54w-pdo |
|
Php54w-pgsql |
Php-pdo_pgsql, Php_database |
Php54w-process |
Php-posix, Php-sysvmsg, Php-sysvsem, PHP-SYSVSHM |
Php54w-pspell |
|
Php54w-recode |
|
Php54w-snmp |
|
Php54w-soap |
|
Php54w-tidy |
|
Php54w-xml |
Php-dom, Php-domxml, PHP-WDDX, php-xsl |
Php54w-xmlrpc |
|
Php54w-zts |
|
[root@kallen ~]# yum install php54w-gd.x86_64Loaded plugins: product-id, security, subscription-managerThis system isnot registered to Red Hat Subscription Management. You can use subscription-manager toregister.Setting up Install ProcessResolving Dependencies--> Running transaction check---> Package php54w-gd.x86_64 0:5.4.41-1.w6 will be installed--> Processing Dependency: libt1.so.5()(64bit)for package: php54w-gd-5.4.41-1.w6.x86_64--> Finished Dependency ResolutionError: Package: php54w-gd-5.4.41-1.w6.x86_64 (webtatic) Requires:libt1.so.5()(64bit) You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest
Workaround:
[root@kallen ~]# rpm -ivh t1lib-5.1.2-6.el6_2.1.x86_64.rpm warning: t1lib-5.1.2-6.el6_2.1.x86_64.rpmc105b9de: NOKEYPreparing... ########################################### [100%]1:t1lib ########################################### [100%]
2.php-5.5
[root@kallen ~]# yum remove php php-bcmath php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-mcrypt php-mysql php-odbc php-pdo php-pear php-pecl-igbinary php-xml php-xmlrpc
[root@kallen ~]# yum install php55w php55w-bcmath php55w-cli php55w-common php55w-devel php55w-fpm php55w-gd php55w-imap php55w-ldap php55w-mbstring php55w-mcrypt php55w-mysql php55w-odbc php55w-pdo php55w-pear php55w-pecl-igbinary php55w-xml php55w-xmlrpc php55w-opcache php55w-intl php55w-pecl-memcache
Iv. Version Testing
1. View PHP Version information
-v5.5.9-1ubuntu4.11 (cli) (built: Jul 2201515:23:081997-2014GroupZend Engine v2.5.01998-2014 Zend Technologies with Zend OPcache v7.0.31999-2014by
phpinfo();?>
2. View PHP installed modules
kallen@kallen:~$ php -m[PHPModules]bcmathbz2calendarCorectypedatedbadomeregexiffileinfofilterftpgdgettexthashiconvjsonldaplibxmlmbstringmhashmysqlmysqliopensslpcntlpcrePDOpdo_mysqlpdo_pgsqlpgsqlPharposixreadlineReflectionsessionshmopSimpleXMLsoapsocketsSPLstandardsysvmsgsysvsemsysvshmtokenizerwddxxmlxmlreaderxmlwriterZendOPcachezipzlib[ZendModules]ZendOPcache
3.MySQL Connection Test
$link=mysql_connect('localhost','root','*'); if(!$link) echo"Connection Error!"; elseecho"Connected Successfully!" mysql_close();?>
Not finished!
Copyright NOTICE: This article for Bo Master original article, without BO Master permission cannot reprint |copyright©2011-2015, Kallen Ding, All rights Reserved.
The above describes the LNMP environment to build--php, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.