Install PHP5.6 with the source code in linux
Install PHP5.6 with the source code in linux
From php5.4, you need to download and install libXpm-dev by yourself. However, due to the package dependency, I chose the yum method for installation, and downloaded and installed it directly through the network yum source.
Download php and related library files (Baidu Online Storage: http:/pan.baidu.com/s/1bnL31c7)
Gd library and php function feature extension library file
Libgd-2.1.1.tar.gz gd Library File (enable php to support the following features)
Jpegsrc.v7.tar.gz jpeg Library File (enable php to support jpeg format images)
Zlib-1.2.7.tar.gz data compression function library (enable php to support data compression)
Freetype-2.6.tar.gzFreetype library File (for php supportMultiple Font format files)
Libpng-1.2.56.tar.gzLibpng Library File (enables php to support images in png format)
Install libXpm
After yum-y install libXpm is installed, the directory/usr/lib64/in the libXpm configuration file
Install autoconf-2.69.tar.gz auto
[root@end LAMP-php]# tar -zxvf autoconf-2.69.tar.gz [root@end LAMP-php]# cd autoconf-2.69[root@end autoconf-2.69]# ./configure [root@end autoconf-2.69]# make ; make install
Install libxml2-2.7.8.tar.gz
[Root @ end LAMP-php] # tar-zxvf libxml2-2.7.8.tar.gz [root @ end LAMP-php] # cd libxml2-2.7.8 will $ RM "keep file" this line with # Comment [root @ end libxml2-2.7.8] #. /configure -- prefix =/usr/local/libxml2 [root @ end libxml2-2.7.8] # make; make install
Install libmcrypt-2.5.8.tar.gz
[root@end LAMP-php]# tar -zxvf libmcrypt-2.5.8.tar.gz [root@end LAMP-php]# cd libmcrypt-2.5.8[root@end libmcrypt-2.5.8]# ./configure --prefix=/usr/local/libmcrypt[root@end libmcrypt-2.5.8]# make ; make install
Install zlib-1.2.7.tar.gz
[root@end LAMP-php]# tar -zxvf zlib-1.2.7.tar.gz [root@end LAMP-php]# cd zlib-1.2.7[root@end zlib-1.2.7]# ./configure --prefix=/usr/local/zlib[root@end zlib-1.2.7]# make ; make install
Install libpng-1.2.56.tar.gz
[root@end LAMP-php]# tar -zxvf libpng-1.2.56.tar.gz[root@end LAMP-php]# cd libpng-1.2.56[root@end libpng-1.2.56]# ./configure --prefix=/usr/local/libpng[root@end libpng-1.2.56]# make ; make install
Install jpegsrc.v7.tar.gz
[Root @ end LAMP-php] # tar-zxvf ready src.v7.tar.gz [root @ end LAMP-php] # cd jpeg-7/[root @ end jpeg-7] # mkdir/usr/local/ready 6 build six 6 software installation directory [root @ end jpeg-7] # mkdir/usr/local/six 6/bin create a directory for storing commands [root @ end jpeg-7] # mkdir/usr/local/six 6/ lib create idea 6 library file directory [root @ end jpeg-7] # mkdir/usr/local/idea 6/include create storage header file directory [root @ end jpeg-7] # mkdir-p/usr/ local/users 6/man/man1 create the Directory of the storage Manual [root @ end jpeg-7] #. /configure \> -- prefix =/usr/local/libraries 6/\> -- enable-shared \ create the GNUd libtool used by the shared Library> -- enable-static create the GNUlibtool used by the static library. /configure -- prefix =/usr/local/Tables 6/-- enable-shared -- enable-static [root @ end jpeg-7] # make; make install
Install freetype-2.6.tar.gz
[root@end LAMP-php]# tar -zxvf freetype-2.6.tar.gz [root@end LAMP-php]# cd freetype-2.6[root@end freetype-2.6]# ./configure --prefix=/usr/local/freetype[root@end freetype-2.6]# make ; make install
Install gd-2.0.32.tar.gz
[Root @ end LAMP-php] # tar-zxvf gd-2.0.32.tar.gz [root @ end LAMP-php] # cd gd-2.0.32 [root @ end gd-2.0.32] #. /configure \ enter vim gd_png.c and change 16 rows to # include "/usr/local/libpng/include/png. h "> -- prefix =/usr/local/gd2/\ gd library file installation directory> -- with-zlib =/usr/local/zlib/\ specify the zlib installation path> -- -jpeg =/usr/local/iis6 // \ specify the iis6 installation path> -- with-png =/usr/local/libpng/\ specify the libpng installation path> -- with-freetype =/ usr/local/freetype/specifies the freetype installation path. /configure -- prefix =/usr/local/gd2/-- with-zlib =/usr/local/zlib/-- with-jpeg =/usr/local/defaults 6/-- with-png =/usr/local/libpng/-- with-freetype =/usr/local/freetype [root @ end gd-2.0.32] # make; make install
Install PHP
[Root @ end AMP] # tar-zxvf php-5.6.9.tar.gz [root @ end AMP] # cd php-5.6.9 [root @ end php-5.6.9] #. /configure \ execute the configuration command that comes with the software in the current directory> -- prefix =/usr/local/php \ set the installation path of PHP5> -- with-config-file-path =/usr /local/php/etc \ specify the path where the PHP5 configuration file is stored> -- with-apxs2 =/usr/local/apache2/bin/apxs \ specify the location where PHP locates Apache2> -- with-mysql =/usr/local/mysql/\ specify the mysql installation directory> -- with-libxml-dir =/usr/local/libxml2/\ specify the location where php is placed in the libxml2 library> -- -png-dir =/usr/local/libpng/\ specify the location where php is placed in the libpng Library> -- with-jpeg-dir =/usr/local/limit 6/\ specify that php is placed in jpeg library location> -- with-freetype-dir =/usr/local/freetype/\ specify the location where php is placed in the freetype library> -- with-gd =/usr/local/gd2 /\ specify the location where php is placed in the gd Library> -- with-zlib-dir =/usr/local/zlib/\ specify the location where php is placed in the zlib library> -- with-mcrypt =/usr/local /libmcrypt/\ specify the location where php is placed in the libcrypt Library> -- with-mysql =/usr/local/mysql/bin/mysql_config \ variable activation new mysqli function> -- enable-soap \ variable activation support for soap and web services> -- enable-mbstring = all \ enable multi-byte strings> -- enable-sockets variable activation socket communication features [root @ end php-5.6.9] #. /configure -- prefix =/usr/local/php -- with-config-file-path =/usr/local/php/etc -- with-apxs2 =/usr/local/apache2/bin/ apxs -- with-mysql =/usr/local/mysql -- with-libxml-dir =/usr/local/libxml2 -- with-png-dir =/usr/local/libpng -- -jpeg-dir =/usr/local/Versions 6 -- with-freetype-dir =/usr/local/freetype -- with-gd =/usr/local/gd2 -- with-zlib- dir =/usr/local/zlib -- with-mcrypt =/usr/local/libmcrypt -- with-xpm-dir =/usr/lib64/-- with-mysqli =/usr/local /mysql/bin/mysql_config -- enable-soap -- enable-mbstring = all -- enable-sockets [root @ end php-5.6.9] # make; make install
Configure php
Cp php. ini-development/usr/local/php/etc/php. ini create a php configuration file
Configure Apache
Add Addtype application/x-httpd-php. php. phtmlAddType application/x-httpd-php. php. php4. php5 to the Apache Main configuration file/etc/httpd/http. conf.
Create a php test file
Cp php. ini-development/usr/local/php/etc/php. ini: create the php configuration file kdir/usr/local/apache2/htdocs/test. php enters test. php editing
Restart Apache to make the settings take effect.
[root@localhost php-5.6.9]# service httpd restart
Open the webpage and enter the URL http: // ip: test. php
The php version information page indicates that the test is successful !!!
So far, php source code installation has ended.