php5.6编译安装

下载PHP安装包:
wget http://cn.php.net/distributions/php-5.6.34.tar.gz
yum -y install libmcrypt-devel libxml2-devel bzip2 bzip2-devel curl curl-devel libjpeg-devel libpng-devel freetype-devel openldap openldap-devel
这里会报一个错,需要拷贝libldap到/usr/lib下
cp -frp /usr/lib64/libldap* /usr/lib/

解压并编译:
tar zxvf php-5.6.34.tar.gz
cd php- 5.6.34./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-bz2 --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-curl --enable-bcmath --enable-sockets --with-iconv-dir=/usr/local --enable-xml --enable-dom --enable-calendar --with-gettext --with-pdo-mysql=mysqlnd --disable-fileinfo --with-ldap=shared

这里会报一个错,需要拷贝libldap到/usr/lib下
cp -frp /usr/lib64/libldap* /usr/lib/


make && make install
拷贝启动脚本:
cp /usr/local/src/php-5.6.34/php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/src/php-5.6.34/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp /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
chkconfig php-fpm on
service php-fpm start
如果报错,需要创建用户php-fpm和组(或者更改启动php的用户)
groupadd php-fpm
useradd -g php-fpm -s /sbin/nologin php-fpm
 
修改php.ini参数:(zabbix环境需要修改的参数)
max_execution_time = 300 memory_limit = 128M post_max_size = 16M upload_max_filesize = 2M max_input_time = 300 date.timezone = Asia/Shanghai
always_populate_raw_post_data = -1

你可能感兴趣的:(Linux相关)