(1)現況
[root@localhost webadm]# date 五 10月 10 16:36:18 CST 2014
[root@localhost webadm]# uname -a Linux localhost.localdomain 3.9.5-301.fc19.i686.PAE #1 SMP Tue Jun 11 19:46:44 UTC 2013 i686
i686 i386 GNU/Linux [root@localhost webadm]#
[root@localhost webadm]# gcc -v 使用內建 specs。 COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-redhat-linux/4.8.3/lto-wrapper 目的:i686-redhat-linux 配置為:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with
-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-
threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-
libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash
-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --
enable-initfini-array --enable-java-awt=gtk --disable-dssi --with-java-
home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-
maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib -
-with-isl=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-i686-redhat-linux/isl-install --with
-cloog=/builddir/build/BUILD/gcc-4.8.3-20140911/obj-i686-redhat-linux/cloog-install --with-
tune=generic --with-arch=i686 --build=i686-redhat-linux 執行緒模型:posix gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) (GCC) [root@localhost webadm]#
(2)下載並解開php-5.6.0.tar.gz [root@localhost webadm]# wget http://tw1.php.net/get/php-5.6.0.tar.gz/from/this/mirror --2014-10-10 16:38:29-- http://tw1.php.net/get/php-5.6.0.tar.gz/from/this/mirror :
100%[======================================>] 17,482,147 292KB/s in 94s
2014-10-10 16:40:03 (182 KB/s) - ‘mirror’ saved [17482147/17482147]
[root@localhost webadm]#
[root@localhost webadm]# mv mirror php-5.6.0.tar.gz
[root@localhost webadm]# tar xvzf php-5.6.0.tar.gz [root@localhost webadm]# cd php-5.6.0/
(3)要先裝 libxml2-devel [root@localhost php-5.6.0]# yum install libxml2-devel : Installed: libxml2-devel.i686 0:2.9.1-1.fc19
Dependency Installed: xz-devel.i686 0:5.1.2-4alpha.fc19 zlib-devel.i686 0:1.2.7-10.fc19
Complete! [root@localhost php-5.6.0]#
(4)組態並編譯
[root@localhost php-5.6.0]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-
mysql :
Thank you for using PHP.
config.status: creating php5.spec config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: executing default commands [root@localhost php-5.6.0]#
[root@localhost php-5.6.0]# make : Build complete. Don't forget to run 'make test'.
[root@localhost php-5.6.0]# [root@localhost php-5.6.0]# make test :
Warning: fsockopen(): unable to connect to qa.php.net:80 (Connection refused) in
/home/webadm/php-5.6.0/run-tests.php on line 1001
The test script was unable to automatically send the report to PHP's QA Team Please send /home/webadm/php-5.6.0/php_test_results_20141010_0848.txt to qa-
reports@lists.php.net manually, thank you. [root@localhost php-5.6.0]#
(5)安裝 [root@localhost php-5.6.0]# make install Installing PHP SAPI module: apache2handler /usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/local/apache2/build/libtool' libphp5.la
/usr/local/apache2/modules /usr/local/apache2/build/libtool --mode=install install libphp5.la
/usr/local/apache2/modules/ libtool: install: install .libs/libphp5.so /usr/local/apache2/modules/libphp5.so libtool: install: install .libs/libphp5.lai /usr/local/apache2/modules/libphp5.la libtool: install: warning: remember to run `libtool --finish /home/webadm/php-5.6.0/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-config Installing man pages: /usr/local/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/lib/php/ [PEAR] Archive_Tar - installed: 1.3.12 [PEAR] Console_Getopt - installed: 1.3.1 [PEAR] Structures_Graph- installed: 1.0.4 [PEAR] XML_Util - installed: 1.2.3 [PEAR] PEAR - installed: 1.9.5 Wrote PEAR system config file at: /usr/local/etc/pear.conf You may want to add: /usr/local/lib/php to your php.ini include_path /home/webadm/php-5.6.0/build/shtool install -c ext/phar/phar.phar /usr/local/bin ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar Installing PDO headers: /usr/local/include/php/ext/pdo/ [root@localhost php-5.6.0]#
(6)修改設定
[root@localhost php-5.6.0]# cat /usr/local/apache2/conf/httpd.conf|grep php LoadModule php5_module modules/libphp5.so DirectoryIndex index.html index.php AddType application/x-httpd-php .php .phtml .php3 [root@localhost php-5.6.0]#
(7)重啟httpd
[root@localhost php-5.6.0]# /usr/local/apache2/bin/apachectl stop [root@localhost php-5.6.0]# /usr/local/apache2/bin/apachectl stop httpd (no pid file) not running [root@localhost php-5.6.0]# /usr/local/apache2/bin/apachectl start [root@localhost php-5.6.0]# ps ax|grep httpd 7392 ? Ss 0:00 /usr/local/apache2/bin/httpd -k start 7393 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 7394 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 7396 ? Sl 0:00 /usr/local/apache2/bin/httpd -k start 7479 pts/0 S+ 0:00 grep --color=auto httpd [root@localhost php-5.6.0]#
(8)編寫測試的index.php
[root@localhost php-5.6.0]# vi /usr/local/apache2/htdocs/index.php [root@localhost php-5.6.0]# cat /usr/local/apache2/htdocs/index.php <?php
echo phpinfo(); ?> [root@localhost php-5.6.0]# chmod 755 /usr/local/apache2/htdocs/index.php
[root@localhost php-5.6.0]#
(9)安裝lynx Browser並測試成功
[root@localhost php-5.6.0]# yum install lynx : Installed: lynx.i686 0:2.8.8-0.1.dev15.fc19
Complete!
[root@localhost php-5.6.0]# lynx localhost [root@localhost php-5.6.0]# lynx localhost/index.php
(10)關閉防火牆
[root@localhost webadm]# systemctl disable firewalld rm '/etc/systemd/system/basic.target.wants/firewalld.service' rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service' [root@localhost webadm]# systemctl stop firewalld [root@localhost webadm]#
|