centos6.2编译php安装

2012-4-6 王健宇 Linux

今天在虚拟机的centos6.2平台安装好了vsftpd以及nginx和mysql以后就打算安装好php

在php官方网站下载好php5.4.0的源码以后

tar xvfj php-5.4.0.tar.bz2

然后切换到php目录,./configure编译

安装php时的报错

checking libxml2 install dir... no
checking for xml2-config path...
configure: error: xml2-config not found. Please check your libxml2 installation.

 

重新安装libxml2和libxml2-devel包

yum install libxml2

yum install libxml2-devel -y

然后重新运行./configure编译

编译成功后显示

Generating files
configure: creating ./config.status
creating main/internal_functions.c
creating main/internal_functions_cli.c
+--------------------------------------------------------------------+
| License:                                                           |
| This software is subject to the PHP License, available in this     |
| distribution in the file LICENSE.  By continuing this installation |
| process, you are bound by the terms of this license agreement.     |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point.                            |
+--------------------------------------------------------------------+

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 main/php_config.h
config.status: executing default commands
成功以后make

还可以make test一下看看

最后make install安装完成

提示

[root@xiaoyu php-5.4.0]# make install
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 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.7
[PEAR] Console_Getopt - installed: 1.3.0
[PEAR] Structures_Graph- installed: 1.0.4
[PEAR] XML_Util       - installed: 1.2.1
[PEAR] PEAR           - installed: 1.9.4
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/php-5.4.0/build/shtool install -c ext/phar/phar.phar /usr/local/bin
ln -s -f /usr/local/bin/phar.phar /usr/local/bin/phar

如果用phpinfo();输出的信息
Loaded Configuration File 这里还是none。
那查看Configuration File (php.ini) Path => /usr/local/lib

把php.ini-production或者php.ini-development复制到/usr/local/lib/php.ini

标签: 编译php5.4.0

发表评论:

Powered by emlog sitemap