问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

centos6.5怎么安装php5.5

发布网友 发布时间:2022-04-26 19:49

我来回答

1个回答

热心网友 时间:2022-04-28 09:17

1.******已安装Nginx******
ps -aux | grep nginx
netstat -anptu | grep 80

2.清除系统中php痕迹:
yum remove php
rm -rvf /etc/php
rm -rvf /etc/php.ini
rm -f /usr/bin/php

3.安装php所需软件包:
tar zxvf autoconf-2.68.tar.gz -C /usr/src
cd /usr/src/autoconf-2.68/
./configure && make && make install
tar zxvf libiconv-1.14.tar.gz -C /usr/src
cd /usr/src/libiconv-1.14/
./configure && make && make install
tar zxvf libmcrypt-2.5.8.tar.gz -C /usr/src
cd /usr/src/libmcrypt-2.5.8/
./configure && make && make install
ldconfig
cd libltdl/
./configure --enable-ltdl-install
make && make install
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
tar zxvf mhash-0.9.9.9.tar.gz -C /usr/src
cd /usr/src/mhash-0.9.9.9/
./configure && make && make install
tar zxvf mcrypt-2.6.8.tar.gz -C /usr/src
cd /usr/src/mcrypt-2.6.8/
./configure && make && make install

4.加载php动态模块:
ln -s /usr/local/lib/libmcrypt.la /usr/lib64/libmcrypt.la
ln -s /usr/local/lib/libmcrypt.so /usr/lib64/libmcrypt.so
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4
ln -s /usr/local/lib/libmcrypt.so.4.4.8
/usr/lib64/libmcrypt.so.4.4.8
ln -s /usr/local/lib/libmhash.a /usr/lib64/libmhash.a
ln -s /usr/local/lib/libmhash.la /usr/lib64/libmhash.la
ln -s /usr/local/lib/libmhash.so /usr/lib64/libmhash.so
ln -s /usr/local/lib/libmhash.so.2 /usr/lib64/libmhash.so.2
ln -s /usr/local/lib/libmhash.so.2.0.1
/usr/lib64/libmhash.so.2.0.1
cp -R /usr/lib64/libpng.* /usr/lib/
cp -R /usr/lib64/libjpeg.* /usr/lib/
echo "/lib" >> /etc/ld.so.conf
echo "/usr/lib" >> /etc/ld.so.conf
echo "/usr/lib64" >> /etc/ld.so.conf
echo "/usr/local/lib" >> /etc/ld.so.conf
echo "* soft nproc 65535" >> /etc/security/limits.conf
echo "* hard nproc 65535" >> /etc/security/limits.conf
echo "* soft nofile 65535" >> /etc/security/limits.conf
echo "* hard nofile 65535" >> /etc/security/limits.conf
echo "fs.file-max=65535" >> /etc/sysctl.conf

ldconfig

5.解压、配置、编译、安装php:
tar zxvf php-5.5.25.tar.gz -C /usr/src
cd /usr/src/php-5.5.25/
./configure --prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--enable-opcache \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-mbstring \
--with-mcrypt \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--with-gettext \
--disable-fileinfo
make ZEND_EXTRA_LIBS='-liconv'
make install

6.链接php可执行文件:
ln -s /usr/local/php/bin/php /usr/bin/php
ln -s /usr/local/php/bin/phpize /usr/bin/phpize
ln -s /usr/local/php/sbin/php-fpm /usr/bin/php-fpm

7.编辑php.ini配置文件:
cp /usr/src/php-5.5.25/php.ini-proction
/usr/local/php/etc/php.ini
ln -s /usr/local/php/etc/php.ini /etc/php.ini
vim /etc/php.ini
[PHP]
engine = On
zend.ze1_compatibility_mode = Off
short_open_tag = On
asp_tags = Off
precision
= 12
y2k_compliance = On
output_buffering = On
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
safe_mode = Off
safe_mode_gid = Off
safe_mode_include_dir =
safe_mode_exec_dir =
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
disable_functions =
passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket
disable_classes =
expose_php = On
error_reporting = E_ALL & ~E_NOTICE
display_errors = On
display_startup_errors = Off
log_errors = Off
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
variables_order = "EGPCS"
register_globals = Off
register_long_arrays = Off
register_argc_argv = On
auto_globals_jit = On
post_max_size = 50M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
doc_root =
user_dir =
extension_dir =
"/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/"
enable_dl = On
cgi.fix_pathinfo=0
file_uploads = On
upload_max_filesize = 50M
max_file_uploads = 20
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
[Date]
date.timezone = PRC
[filter]
[iconv]
[sqlite]
[Pcre]
[Syslog]
define_syslog_variables = Off
[mail function]
SMTP = localhost
smtp_port = 25
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mSQL]
msql.allow_persistent = On
msql.max_persistent = -1
msql.max_links = -1
[OCI8]
[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[Sybase]
sybase.allow_persistent = On
sybase.max_persistent = -1
sybase.max_links = -1
sybase.min_error_severity = 10
sybase.min_message_severity = 10
sybase.compatability_mode = Off
[Sybase-CT]
sybct.allow_persistent = On
sybct.max_persistent = -1
sybct.max_links = -1
sybct.min_server_severity = 10
sybct.min_client_severity = 10
[bcmath]
bcmath.scale = 0
[browscap]
[Informix]
ifx.default_host =
ifx.default_user =
ifx.default_password =
ifx.allow_persistent = On
ifx.max_persistent = -1
ifx.max_links = -1
ifx.textasvarchar = 0
ifx.byteasvarchar = 0
ifx.charasvarchar = 0
ifx.blobinfile = 0
ifx.nullformat = 0
[Session]
session.save_handler = files
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor
= 100
session.gc_maxlifetime = 1440
session.bug_compat_42 = 1
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 4
url_rewriter.tags =
"a=href,area=href,frame=src,input=src,form=,fieldset="
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[Assertion]
[COM]
[mbstring]
[FrontBase]
[gd]
[exif]
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
[Zend Optimizer]
zend_extension =
/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/opcache.so
zend_loader.enable = 1
zend_loader.disable_licensing = 0
zend_loader.obfuscation_level_support = 3

8.编辑php-fpm.conf配置文件:
cp /usr/local/php/etc/php-fpm.conf.default
/usr/local/php/etc/php-fpm.conf
vim /usr/local/php/etc/php-fpm.conf
[global]
pid = /home/php/pid/php-fpm.pid
error_log = /home/php/log/php-fpm_error.log
log_level = notice
[www]
listen = 127.0.0.1:9000
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 6
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = /home/php/log/slow.log

9.编写php-fpm启动脚本
vim /etc/init.d/php-fpm
#!/bin/sh
# chkconfig:
2345 90
10
#
Description:
Start and
Stop php-fpm
# Provides:

php-fpm
#
Default-Start:
2 3 4 5
#
Default-Stop:
0 1 6
prefix=/usr/local/php
exec_prefix=${prefix}
php_fpm_BIN=${prefix}/sbin/php-fpm
php_fpm_CONF=${prefix}/etc/php-fpm.conf
php_fpm_PID=/home/php/pid/php-fpm.pid
php_opts="--fpm-config $php_fpm_CONF --pid $php_fpm_PID"
wait_for_pid () {
try=0
while test $try -lt 35 ; do
case "$1" in
'created')
if [ -f "$2" ] ; then
try=''
break
fi
;;
'removed')
if [ ! -f "$2" ] ; then
try=''
break
fi
;;
esac
echo -n .
try=`expr $try + 1`
sleep 1
done
}
case "$1" in
start)
echo -n "Starting php-fpm..."
$php_fpm_BIN --daemonize $php_opts
if [ "$?" != 0 ] ; then
echo " failed"
exit 1
fi
wait_for_pid created $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
stop)
echo -n "Stoping php-fpm..."
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -QUIT `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed. Use force-quit"
exit 1
else
echo " done"
fi
;;
force-quit)
echo -n "Terminating php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -TERM `cat $php_fpm_PID`
wait_for_pid removed $php_fpm_PID
if [ -n "$try" ] ; then
echo " failed"
exit 1
else
echo " done"
fi
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reload service php-fpm "
if [ ! -r $php_fpm_PID ] ; then
echo "warning, no pid file found - php-fpm is not running ?"
exit 1
fi
kill -USR2 `cat $php_fpm_PID`
echo " done"
;;
*)
echo "Usage: $0 {start|stop|force-quit|restart|reload}"
exit 1
;;
esac

10.创建目录并修改权限,重启nginx服务:
mkdir -p /home/php/log
mkdir -p /home/php/pid
chown -R www:www /home/php/log
chown -R www:www /home/php/pid
service nginx restart

11.添加php-fpm系统服务:
chmod +x /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig --level 2345 php-fpm on
chkconfig --list | grep php-fpm

12.启动php-fpm服务:
service php-fpm start
ps -aux | grep php-fpm
netstat -anptu | grep 9000

13.配置php测试页:
vim /home/www/html/phpinfo.php
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
神九返回后轨道舱分离去哪里了,是在轨道继续运行,还是不管了。天宫一... 空间站通常由对接舱、气闸舱、轨道舱、生活舱、服务舱、专用设备... 为什么不让神舟七号的轨道舱留在天上让神州八号去追? 洗衣机生产厂家 狗鱼好吃吗? 洪霞的爷爷知识很丰富,你能用哪些成语来形容他 用什么成语可以形容包罗各种各样的想法 什么万千的成语有哪些 重庆哪些考研大学 重庆师范大学考研好不好考 我想学php石家庄有没有专门教这个的学校啊 我想学php石家庄有没有专门教这个的学校啊 弱弱的问个问题:扩展名是.php和.asp是什么文件啊,干什么用的啊? 弱弱的问个问题:扩展名是.php和.asp是什么文件啊,干什么用的啊? 请问一个asp,net的问题? 请问一个asp,net的问题? 懂行的人说下国产经典收音机哪种质量最好 安装sqlmap时出现的问题 最后出现 No module named thirdparty.clientform.clientform 安装sqlmap时出现的问题 最后出现 No module named thirdparty.clientfo... 动态网页该学ASP,JSP,还是PHP?哪一种比较好比较流行一些? 我想为我公司申请一人免费的空间,把公司的资料发布出去 EMS SQL Manager 破解版 for PostgreSQL好不好 EMS SQL Manager 破解版 for PostgreSQL好不好 如何接经典轩逸车收音机 有哪位知道为什么说数据库技术是信息资源管理最有效的手段 有哪位知道为什么说数据库技术是信息资源管理最有效的手段 收音机经典老歌在哪个台 如何使用c++调用postgis 函数 如何使用c++调用postgis 函数 我在北京石景山区黑石头路,有什么共享汽车的APP? centos6.5怎么安装php5.5 什么收音机信号最强? 微信被冻结,什么鬼? 我的微信显示账号冻结,冻结费用两块钱是啥意思啊? 微信提示“小程序该账号已冻结刚刚登录”是什么意思? 1.2厘米是多长 0.2cm有多大图片 1.2cm多远 请问1.2寸照片是多少*多少 1.2乘1.4cm是多大。最好用图片给我说明。 0.6cm比1.2厘米大吗 1.2m的床有多大? 求助想要在A4纸张上放多很多直径为1.2cm圆形的图片 圆形图片里面时有图片的如何保持清晰度求解 请问照片宽高比例1比1.2是多大? 急需知道,一寸照片和小一寸照片一样大吗? 什么是长方形周长 长方形的周长就是它什么条边的什么 长方形的周长就是它四条边长度的和.___.(判断对错) 长方形的周长是长方形什么的长度之和? 长方体的周长公式是什么?