湖濱散記部落格的樹心幽徑[login][主頁]
296:20140903在fedora19裝妥php-5.6.0網頁伺服程式

(0)現況
login as: root
root@163.25.20.91's password: ************
Last login: Thu Jul 31 07:48:26 2014 from 163.25.20.90
[root@blackbear ~]#
[root@blackbear ~]# cd lnx
[root@blackbear lnx]# ls
apr-1.5.1         apr-util-1.5.3.tar.gz  httpd-2.4.10.tar.gz
apr-1.5.1.tar.gz  download.cgi           pcre-8.35
apr-util-1.5.3    httpd-2.4.10           pcre-8.35.tar.bz2
[root@blackbear lnx]# date
二  9月  2 15:15:56 CST 2014
[root@blackbear lnx]# pwd
/root/lnx
[root@blackbear lnx]# uname -a
Linux blackbear.kmvs.km.edu.tw 3.9.5-301.fc19.i686.PAE #1 SMP Tue Jun 11 19:46:4                                             4 UTC 2013 i686 i686 i386 GNU/Linux
[root@blackbear lnx]# 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 --enab                                             le-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++,obj                                             c,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --enab                                             le-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/b                                             uild/BUILD/gcc-4.8.3-20140624/obj-i686-redhat-linux/isl-install --with-cloog=/bu                                             ilddir/build/BUILD/gcc-4.8.3-20140624/obj-i686-redhat-linux/cloog-install --with                                             -tune=generic --with-arch=i686 --build=i686-redhat-linux
執行緒模型:posix
gcc version 4.8.3 20140624 (Red Hat 4.8.3-1) (GCC)
[root@blackbear lnx]#

(1)下載php-5.6.0.tar.gz
[root@blackbear lnx]# wget http://tw1.php.net/get/php-5.6.0.tar.gz/from/this/mirror
--2014-09-02 15:18:07--  http://tw1.php.net/get/php-5.6.0.tar.gz/from/this/mirror
正在查找主機 tw1.php.net (tw1.php.net)... 114.35.79.92
正在連接 tw1.php.net (tw1.php.net)|114.35.79.92|:80... 連上了。
已送出 HTTP 要求,正在等候回應... 302 Found
位置: http://tw1.php.net/distributions/php-5.6.0.tar.gz [跟隨至新的 URL]
--2014-09-02 15:18:07--  http://tw1.php.net/distributions/php-5.6.0.tar.gz
正在連接 tw1.php.net (tw1.php.net)|114.35.79.92|:80... 連上了。
已送出 HTTP 要求,正在等候回應... 200 OK
長度: 17482147 (17M) [application/x-gzip]
Saving to: ‘mirror.1’

100%[===================================================================================>] 17,482,147   130KB/s   in 94s

2014-09-02 15:19:42 (183 KB/s) - ‘mirror.1’ saved [17482147/17482147]

[root@blackbear lnx]# mv mirror.1 php-5.6.0.tar.gz
[root@blackbear lnx]#



(2)解開php-5.6.0.tar.gz

[root@blackbear lnx]# tar xvzf php-5.6.0.tar.gz
[root@blackbear lnx]# cd php-5.6.0/
[root@blackbear php-5.6.0]# ls
acinclude.m4      generated_lists  mkinstalldirs             README.NEW-OUTPUT-API             server-tests-config.php
aclocal.m4        genfiles         netware                   README.PARAMETER_PARSING_API      server-tests.php
build             header           NEWS                      README.REDIST.BINS                snapshot
buildconf         INSTALL          pear                      README.RELEASE_PROCESS            stamp-h.in
buildconf.bat     install-sh       php5.spec.in              README.SELF-CONTAINED-EXTENSIONS  stub.c
CODING_STANDARDS  LICENSE          php.gif                   README.STREAMS                    tests
config.guess      ltmain.sh        php.ini-development       README.SUBMITTING_PATCH           travis
config.sub        main             php.ini-production        README.TESTING                    TSRM
configure         makedist         README.EXT_SKEL           README.TESTING2                   UPGRADING
configure.in      Makefile.frag    README.GIT-RULES          README.UNIX-BUILD-SYSTEM          UPGRADING.INTERNALS
CREDITS           Makefile.gcov    README.input_filter       README.WIN32-BUILD-SYSTEM         vcsclean
ext               Makefile.global  README.MAILINGLIST_RULES  run-tests.php                     win32
EXTENSIONS        makerpm          README.md                 sapi                              Zend
footer            missing          README.namespaces         scripts


(3)察看安裝說明
[root@blackbear php-5.6.0]# cat INSTALL |more

(4)第1次組態失敗:
[root@blackbear php-5.6.0]# ./configure --with-apxs2=/usr/local/apache2/bin/apxs  --with-mysql
:
configure: error: xml2-config not found. Please check your libxml2 installation.

(5)安裝libxml2-devel
[root@blackbear 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!

(6)第2次組態成功:
[root@blackbear 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

(7)編譯php-5.6.0:
[root@blackbear php-5.6.0]# make
:
phar.inc
Build complete.
Don't forget to run 'make test'.
[root@blackbear php-5.6.0]#
[root@blackbear php-5.6.0]# make test
:
=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Testing xpath() with invalid XML [ext/simplexml/tests/SimpleXMLElement_xpath.phpt]
file_get_contents() test using offset parameter out of range [ext/standard/tests/file/file_get_contents_error001.phpt]
http-stream test [ext/standard/tests/network/http-stream.phpt]
Test setlocale() function : usage variations - Setting all available locales in the platform [ext/standard/tests/strings/setlocale_variation2.phpt]
=====================================================================
You may have found a problem in PHP.
This report can be automatically sent to the PHP QA team at
http://qa.php.net/reports and http://news.php.net/php.qa.reports
This gives us a better understanding of PHP's behavior.
If you don't want to send the report immediately you can choose
option "s" to save it.  You can then email it to qa-reports@lists.php.net later.
Do you want to send this report now? [Yns]: Y

Please enter your email address.
(Your address will be mangled so that it will not go out on any
mailinglist in plain text): treehrt@gmail.com
sh: autoconf:命令找不到

Posting to http://qa.php.net/buildtest-process.php

Thank you for helping to make PHP better.
[root@blackbear php-5.6.0]#

(8)安裝php-5.6.0
[root@blackbear php-5.6.0]# make install
Installing PHP SAPI module:       apache2handler
/usr/local/apache2/build/instdso.sh SH_LIBTOOL='/usr/share/apr-1/build/libtool' libphp5.la /usr/local/apache2/modules
/usr/share/apr-1/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 /root/lnx/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
/root/lnx/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@blackbear php-5.6.0]#

(9)補裝libtool
[root@blackbear php-5.6.0]# yum install libtool
:
Installed:
  libtool.i686 0:2.4.2-24.fc19

Dependency Installed:
  autoconf.noarch 0:2.69-10.fc19                                 automake.noarch 0:1.13.4-1.fc19
  m4.i686 0:1.4.16-8.fc19                                        perl-Test-Harness.noarch 0:3.23-266.fc19
  perl-Text-ParseWords.noarch 0:3.27-266.fc19                    perl-Thread-Queue.noarch 0:3.02-1.fc19

Complete!

(10)修改 /usr/local/apache2/conf/httpd.conf
[root@blackbear php-5.6.0]# vi /usr/local/apache2/conf/httpd.conf
[root@blackbear 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@blackbear php-5.6.0]#

(11)重啟httpd

[root@blackbear php-5.6.0]# ps ax|grep httpd
21016 ?        Ss     1:43 /usr/local/apache2/bin/httpd -k start
21017 ?        Sl    16:39 /usr/local/apache2/bin/httpd -k start
21018 ?        Sl    16:40 /usr/local/apache2/bin/httpd -k start
21019 ?        Sl    16:41 /usr/local/apache2/bin/httpd -k start
21480 pts/0    S+     0:00 grep --color=auto httpd
[root@blackbear php-5.6.0]#  /usr/local/apache2/bin/apachectl stop
[root@blackbear php-5.6.0]# ps ax|grep httpd
21510 pts/0    S+     0:00 grep --color=auto httpd
[root@blackbear php-5.6.0]#  /usr/local/apache2/bin/apachectl start
[root@blackbear php-5.6.0]# ps ax|grep httpd
21514 ?        Ss     0:00 /usr/local/apache2/bin/httpd -k start
21515 ?        Sl     0:00 /usr/local/apache2/bin/httpd -k start
21516 ?        Sl     0:00 /usr/local/apache2/bin/httpd -k start
21522 ?        Sl     0:00 /usr/local/apache2/bin/httpd -k start
21600 pts/0    S+     0:00 grep --color=auto httpd
[root@blackbear php-5.6.0]#

(12)關閉防火牆

[root@blackbear ~]# systemctl disable firewalld
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
[root@blackbear ~]#

[root@blackbear ~]# systemctl stop firewalld
[root@blackbear ~]#


(13)PHP 順利運作
http://163.25.20.91/index.php


select id,article_id,topic,text from lt_articles_text where article_id =296; ok. update lt_articles set num_reads=num_reads +1 where id=296; ok.