(1)下載[root@stop ~]# wget http://tw1.php.net/get/php-5.6.26.tar.gz/from/this/mirror:2016-09-21 10:32:01 (210 KB/s) - ‘mirror’ saved [19225892/19225892] [root@stop ~]# mv mirror php-5.6.26.tar.gz (2)解開php-5.6.26.tar.gz [root@stop ~]# pwd/root[root@stop ~]# tar xvzf php-5.6.26.tar.gz
(3)察看安裝說明[root@stop ~]# cd php-5.6.26/[root@stop php-5.6.26]# cat INSTALL |more (4)組態 [root@stop php-5.6.26]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql:configure: error: xml2-config not found. Please check your libxml2 installation.[root@stop php-5.6.26]# [root@stop php-5.6.26]# yum install libxml2-devel:Installed: libxml2-devel.x86_64 2.9.3-1.fc22 xz-devel.x86_64 5.2.0-2.fc22 zlib-devel.x86_64 1.2.8-7.fc22 Complete! [root@stop php-5.6.26]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql :Thank you for using PHP. config.status: creating php5.specconfig.status: creating main/build-defs.hconfig.status: creating scripts/phpizeconfig.status: creating scripts/man1/phpize.1config.status: creating scripts/php-configconfig.status: creating scripts/man1/php-config.1config.status: creating sapi/cli/php.1config.status: creating sapi/cgi/php-cgi.1config.status: creating ext/phar/phar.1config.status: creating ext/phar/phar.phar.1config.status: creating main/php_config.hconfig.status: executing default commands
(5)編譯 [root@stop php-5.6.26]# make:Build complete.Don't forget to run 'make test'. [root@stop php-5.6.26]# [root@stop php-5.6.26]# make test:Thank you for helping to make PHP better. (6)安裝[root@stop php-5.6.26]# make installInstalling PHP SAPI module: apache2handler/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apr/build-1/libtool' libphp5.la /usr/local/apache2/modules/usr/local/apr/build-1/libtool --mode=install install libphp5.la /usr/local/apache2/modules/libtool: install: install .libs/libphp5.so /usr/local/apache2/modules/libphp5.solibtool: install: install .libs/libphp5.lai /usr/local/apache2/modules/libphp5.lalibtool: install: warning: remember to run `libtool --finish /root/php-5.6.26/libs'chmod 755 /usr/local/apache2/modules/libphp5.so[activating module `php5' in /usr/local/apache2/conf/httpd.conf]Installing shared extensions: /usr/local/lib/php/extensions/no-debug-zts-20131226/Installing PHP CLI binary: /usr/local/bin/Installing PHP CLI man page: /usr/local/php/man/man1/Installing PHP CGI binary: /usr/local/bin/Installing PHP CGI man page: /usr/local/php/man/man1/Installing build environment: /usr/local/lib/php/build/Installing header files: /usr/local/include/php/Installing helper programs: /usr/local/bin/ program: phpize program: php-configInstalling man pages: /usr/local/php/man/man1/ page: phpize.1 page: php-config.1Installing PEAR environment: /usr/local/lib/php/[PEAR] Archive_Tar - installed: 1.4.0[PEAR] Console_Getopt - installed: 1.4.1[PEAR] Structures_Graph- installed: 1.1.1[PEAR] XML_Util - installed: 1.3.0[PEAR] PEAR - installed: 1.10.1Wrote PEAR system config file at: /usr/local/etc/pear.confYou may want to add: /usr/local/lib/php to your php.ini include_path/root/php-5.6.26/build/shtool install -c ext/phar/phar.phar /usr/local/binln -s -f phar.phar /usr/local/bin/pharInstalling PDO headers: /usr/local/include/php/ext/pdo/[root@stop php-5.6.26]#
[root@stop htdocs]# libtool --finish /root/php-5.6.26/libsbash: libtool: 找不到指令...是否要安裝「libtool」軟體包以提供「libtool」指令? [N/y] y
* 正在依佇列等待... * 正在載入軟體包清單。...下列軟體包必須安裝: automake-1.15-1.fc22.noarch A GNU tool for automatically creating Makefiles autoconf-2.69-20.fc22.noarch A GNU tool for automatically configuring source code m4-1.4.17-6.fc22.x86_64 The GNU macro processor perl-Thread-Queue-3.11-1.fc22.noarch Thread-safe queues要處理變更嗎? [N/y] y
* 正在依佇列等待... * 正在等候認證... * 正在依佇列等待... * 正在下載軟體包... * 正在請求資料... * 正在測試變更... * 正在安裝軟體包...libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /root/php- 5.6.26/libs----------------------------------------------------------------------Libraries have been installed in: /root/php-5.6.26/libs If you ever happen to want to link against installed librariesin a given directory, LIBDIR, you must either use libtool, andspecify the full pathname of the library, or use the `-LLIBDIR'flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries formore information, such as the ld(1) and ld.so(8) manual pages.---------------------------------------------------------------------- [root@stop htdocs]# libtool --finish /root/php-5.6.26/libs
(7)重啟httpd[root@stop php-5.6.26]# /usr/local/apache2/bin/apachectl stop[root@stop php-5.6.26]# /usr/local/apache2/bin/apachectl start[root@stop php-5.6.26]# ps ax|grep httpd20979 ? Ss 0:00 /usr/local/apache2/bin/httpd -k start20980 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start20981 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start20982 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start21065 pts/0 S+ 0:00 grep --color=auto httpd[root@stop php-5.6.26]# (8)PHP 順利運作 [root@stop htdocs]# vi /usr/local/apache2/conf/httpd.conf[root@stop htdocs]# cat /usr/local/apache2/conf/httpd.conf|grep phpLoadModule php5_module modules/libphp5.so DirectoryIndex index.html index.php AddType application/x-httpd-php .php .phtml .php3[root@stop htdocs]# http://163.25.20.74/index.php (9)裝GD並重編PHP[root@stop php-5.6.26]# yum install libpng:Nothing to do.Complete![root@stop php-5.6.26]# yum install libpng-devel:Installed: libpng-devel.x86_64 2:1.6.19-1.fc22 Complete![root@stop php-5.6.26]# [root@stop php-5.6.26]# yum install libjpeg:Nothing to do.Complete![root@stop php-5.6.26]#
[root@stop php-5.6.26]# yum install libjpeg-devel:Installed: libjpeg-turbo-devel.x86_64 1.4.0-2.fc22Complete! [root@stop php-5.6.26]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-jpeg- dir=/root/jpeg-6b --with-gd[root@stop php-5.6.26]# make [root@stop php-5.6.26]# make test:=====================================================================FAILED TEST SUMMARY---------------------------------------------------------------------file_get_contents() test using offset parameter out of range [ext/standard/tests/file/file_get_contents_error001.phpt]===================================================================== =====================================================================WARNED TEST SUMMARY---------------------------------------------------------------------Phar: bug #69958: Segfault in Phar::convertToData on invalid file [ext/phar/tests/bug69958.phpt] (warn: XFAIL section but test passes)Bug #69111 Crash in SessionHandler::read() [ext/session/tests/bug69111.phpt] (warn: XFAIL section but test passes)Bug #70172 - Use After Free Vulnerability in unserialize() [ext/standard/tests/serialize/bug70172.phpt] (warn: XFAIL section but test passes)Bug #72663: Create an Unexpected Object and Don't Invoke __wakeup() in Deserialization [ext/standard/tests/strings/bug72663_3.phpt] (warn: XFAIL section but test passes)===================================================================== [root@stop php-5.6.26]# make installInstalling PHP SAPI module: apache2handler/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apr/build-1/libtool' libphp5.la /usr/local/apache2/modules/usr/local/apr/build-1/libtool --mode=install install libphp5.la /usr/local/apache2/modules/libtool: install: install .libs/libphp5.so /usr/local/apache2/modules/libphp5.solibtool: install: install .libs/libphp5.lai /usr/local/apache2/modules/libphp5.lalibtool: install: warning: remember to run `libtool --finish /root/php-5.6.26/libs'chmod 755 /usr/local/apache2/modules/libphp5.so[activating module `php5' in /usr/local/apache2/conf/httpd.conf]Installing shared extensions: /usr/local/lib/php/extensions/no-debug-zts-20131226/Installing PHP CLI binary: /usr/local/bin/Installing PHP CLI man page: /usr/local/php/man/man1/Installing PHP CGI binary: /usr/local/bin/Installing PHP CGI man page: /usr/local/php/man/man1/Installing build environment: /usr/local/lib/php/build/Installing header files: /usr/local/include/php/Installing helper programs: /usr/local/bin/ program: phpize program: php-configInstalling man pages: /usr/local/php/man/man1/ page: phpize.1 page: php-config.1Installing PEAR environment: /usr/local/lib/php/[PEAR] Archive_Tar - already installed: 1.4.0[PEAR] Console_Getopt - already installed: 1.4.1[PEAR] Structures_Graph- already installed: 1.1.1[PEAR] XML_Util - already installed: 1.3.0[PEAR] PEAR - already installed: 1.10.1Wrote PEAR system config file at: /usr/local/etc/pear.confYou may want to add: /usr/local/lib/php to your php.ini include_path/root/php-5.6.26/build/shtool install -c ext/phar/phar.phar /usr/local/binln -s -f phar.phar /usr/local/bin/pharInstalling PDO headers: /usr/local/include/php/ext/pdo/[root@stop php-5.6.26]# [root@stop php-5.6.26]# libtool --finish /root/php-5.6.26/libslibtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/sbin" ldconfig -n /root/php- 5.6.26/libs----------------------------------------------------------------------Libraries have been installed in: /root/php-5.6.26/libs If you ever happen to want to link against installed librariesin a given directory, LIBDIR, you must either use libtool, andspecify the full pathname of the library, or use the `-LLIBDIR'flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries formore information, such as the ld(1) and ld.so(8) manual pages.----------------------------------------------------------------------[root@stop php-5.6.26]# |