centos 安装php5.3

scofone查看全部>> 05-06

人气 2,049

亲们该页面内会员们分享的“作品”,版权为才华横溢的原作者们所有滴,不得商业使用!

先卸载本机已经安装的PHP包,这些软件包将会通过接下来的编译方式安装,安装必须软件
# yum remove php php-*

yum install -y httpd-devel libtool-ltdl libtool-ltdl-devel openssl-devel curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libc-client libc-client-devel gd gd-devel libmcrypt libmcrypt-devel sqlite sqlite-devel mysql-devel libicu libicu-devel pcre-devel postgresql84 postgresql84-libs postgresql84-server postgresql84-devel

yum install libxml2 libxml2-devel

yum install bzip2 bzip2-devel

yum install gmp-devel

yum install gcc-c++

下载源代码到 src 目录并解压:
# cd /usr/local/src
# wget http://cn.php.net/get/php-5.3.6.tar.bz2/from/this/mirror
# tar -xjf php-5.3.6.tar.bz2

编译并安装
# make && make install
安装结果摘要,里面有几个主要的安装路径变量
libtool: install: warning: remember to run `libtool --finish /usr/local/src/php-5.3.6/libs'
[activating module `php5' in /etc/httpd/conf/httpd.conf]
Installing PHP CLI binary: /usr/local/bin/
Installing PHP CLI man page: /usr/local/share/man/man1/
Installing shared extensions: /usr/local/lib/php/20090626/
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/share/man/man1/
Installing PEAR environment: /usr/local/share/pear/
貌似要运行一次libtool --finish ....,不过我运行后也没什么奇特效果~

更新httpd配置文件以便apache能解析php文件
# vim /etc/httpd/conf/httpd.conf
添加以下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
如果在卸载原有PHP之前没备份php.ini文件,那么可以从PHP编译目录中把 php.ini-production 拷贝到 /etc目录下并改名为 php.ini
# mv /usr/local/src/php-5.3.6/php.ini-production /etc/php.ini
添加或者更新相关设置,比如:
extension_dir = "/usr/local/lib/php/20090626"
include_path = ".:/usr/local/share/pear"

# 以下六个模块可根据需要添加
extension = bz2.so
extension = calendar.so
extension = curl.so
extension = mcrypt.so
extension = pdo_sqlite.so
extension = sqlite.so

max_execution_time = 30
max_input_time = 60
memory_limit = 128M
variables_order = "EGPCS"
register_globals = Off
register_long_arrays = Off
post_max_size = 30M
upload_max_filesize = 30M
mbstring.internal_encoding = UTF-8
date.timezone = Asia/Chongqing

标签
相关作品
centos 安装php5.3:等您坐沙发呢!



会员登陆还没有账号 立即注册

用户登录

忘记密码 ?

用第三方帐号直接登录

微博账号登陆 QQ账号登陆