PHP 完整编译日志

23
Mar

PHP 完整编译日志

          操作系统:Centos 6.9
          PHP版本:PHP-5.6.27
    libmcrypt版本:libmcrypt-2.5.8
          PHP路径:/usr/local/php5
   php.ini配置路径:/usr/local/php5/etc/php.ini /etc/php.ini

自己整理,如有问题可在留言区留言。

上述版本文件拷贝至 /usr/local/src 目录

安装libmcrypt

cd /usr/local/src
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8

./configure
make && make install

安装PHP

cd /usr/local/src
tar -zxvf php-5.6.27.tar.gz
cd php-5.6.27
mkdir -p /usr/local/php5

./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-exif --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --enable-session --with-mcrypt --with-curl --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr

make && make install

配置PHP

cp php.ini-production /usr/local/php5/etc/php.ini
rm -rf /etc/php.ini
ln -s /usr/local/php5/etc/php.ini /etc/php.ini
cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf

vi /usr/local/php5/etc/php-fpm.conf
user = www
group = www
pid = run/php-fpm.pid #取消前面的分号

cp /usr/local/src/php-5.6.27/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
chkconfig php-fpm on

vi /usr/local/php5/etc/php.ini

查找disable_functions修改为:
disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,escapeshellcmd,dll,popen,disk_free_space,checkdnsrr,checkdnsrr,getservbyname,getservbyport,disk_total_space,posix_ctermid,posix_get_last_error,posix_getcwd, posix_getegid,posix_geteuid,posix_getgid, posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid, posix_getppid,posix_getpwnam,posix_getpwuid, posix_getrlimit, posix_getsid,posix_getuid,posix_isatty, posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid, posix_setpgid,posix_setsid,posix_setuid,posix_strerror,posix_times,posix_ttyname,posix_uname

列出PHP可以禁用的函数,如果某些程序需要用到这个函数,可以删除,取消禁用。
;date.timezone =
date.timezone = PRC
#设置时区
expose_php = On
expose_php = OFF
#禁止显示PHP版本
short_open_tag = off
short_open_tag = ON
#支持PHP短标签

文件类型错误解析漏洞
vi /usr/local/php5/etc/php.ini
cgi.fix_pathinfo=1替换为cgi.fix_pathinfo=0

添加新评论