• {{ item.name }}
  • Home
  • Linux
  • Programming
    • Python
  • Life
  • Other
  • Tools
  • 投资者该如何参与优秀的区块链项目- NuLink社区圆桌会议
  • 什么是NuLink?- 项目中文社区与项目研究组成员 Rookie 对话实录
  • NuLink 融资 400 万美元用于开发隐私保护技术
  • NuLink的零知识证明介绍(1)
  • 用bitwarden_rs搭建属于自己的密码管理器
  • 修复 CentOS vps 网卡失效
  • 记录用mac给Nexus6P刷Android10的错误
  • Centos 6.8启用 TCP BBR拥塞控制算法
  • Nginx 启用HTTP2功能
  • Mac 安装adb工具
  • WordPress 默认编辑器代码按钮

Centos PHP5.6.2 编译安装和一些错误

  • iansiu
  • 2015-12-08
  • 0

由于网站程序需要高版本的php支持,所以需要安装php5.6.2版本,在网上找了教程,可以成功安装,但是由于没有安装GD和一些图片库的支持,所以网站上的验证码不能现实,所以,需要重新编译安装了。

下面的配置其实在 CentOS6.5 系统中是没有问题的,但是 vps是CentOS6.7 系统,编译和安装的过程中出现了问题,这里就记录下。

下载

php-5.6.2 wget http://cn2.php.net/distributions/php-5.6.2.tar.gz

Make错误:

make *** ext/openssl/openssl.lo error 1

需要在 --with-openssl \ 指定libssl.so的路径

比如这样:

--with-openssl=/usr/local/ssl

可以搜索一下在哪里,一般默认安装的openssl是没有的问题的,多出现在自己编译安装的openssl上。

find / -name libssl.so

配置错误:make:

*** [ext/fileinfo/libmagic/apprentice.lo] Error 1

这个是内存小于1GB,编译加上:

--disable-fileinfo

configure

./configure  \
--prefix=/usr/local/php \
--with-config-file-path=/usr/local/php/etc \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-opcache \
--enable-fpm \
--with-fpm-user=php-fpm \
--with-fpm-group=php-fpm \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gettext \
--enable-mbstring \
--with-iconv \
--with-mcrypt \
--with-mhash \
--with-openss \
--enable-bcmath \
--enable-soap \
--with-libxml-dir \
--enable-pcntl \
--enable-shmop \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-curl \
--with-zlib \
--enable-zip \
--with-bz2 \
--with-readline \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir \
--enable-gd-native-ttf \
--enable-ftp \
--enable-exif

编译 & 安装

make && make install
cp php.ini-production /usr/local/php/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
mv /usr/local/php/etc/php-fpm.conf.default  /usr/local/php/etc/php-fpm.conf
chmod 755 /etc/init.d/php-fpm
chkconfig --add php-fpm
service php-fpm start          //成功会返回:Starting php-fpm  done
chkconfig php-fpm on

最后重启服务

service php-fpm restart
© 2025 laowang's blog
Theme by Wing