Download:
help:
./configure \ --prefix=/www/server/php/7.2 --with-config-file-path=/www/server/php/7.2/etc \ --enable-fpm --with-fpm-user=www --with-fpm-group=www \ --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \ --with-pdo-sqlite \ --with-freetype-dir --with-jpeg-dir --with-png-dir --with-gd --enable-gd-jis-conv \ --with-openssl --with-kerberos --with-curl \ --with-zlib --enable-zip --with-bz2 \ --with-iconv-dir --with-xmlrpc \ --with-gettext --with-pear --with-iconv --with-pcre-regex \ --with-libxml-dir=/usr \ --with-xsl --with-readline --with-gdbm --with-libdir=lib64 --with-mhash \ --enable-mbregex --enable-mbstring --enable-bcmath \ --enable-xml --enable-soap --enable-sockets --enable-shmop --enable-pcntl --enable-intl --enable-ftp \ --disable-rpath \ --enable-short-tags --enable-dba --enable-libxml \ --enable-static --enable-shared --enable-sysvshm --enable-sysvsem --enable-inline-optimization --enable-opcache \ # --enable-gd-native-ttf 废弃
依赖: libxml2 openssl openssl-devel curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel gdbm-devel error: Unable to detect ICU prefix or no failed. yum install libicu-devel perl(yum install perl-ExtUtils-MakeMaker package) yum install tcl build-essential tk gettext autoconf yum -y install gcc+ gcc-c++
文件及文件夹:安装前后,新增的文件及文件夹
header, include, config.log, config.nice, config.status, Makefile.fragments, Makefile.objects, modules, libs, libtool, php7.spec
配置:
--prefix=/www/server/php/7.2 --with-config-file-path=/www/server/php/7.2/etc # 制定配置文件,默认:Set the path in which to look for php.ini [PREFIX/lib] cp php.ini-development /www/server/php/7.2/etc /www/server/php/7.2/etc/php-fpm.conf /www/server/php/7.2/etc/php-fpm.d/www.conf ;listen = 127.0.0.1:9000 # listen on a TCP socket listen = /tmp/php-cgi-72.sock # listen on a unix socket listen.owner = www listen.group = www # /tmp/php-cgi-72.sock 权限:srw-rw---- www www /www/server/php/7.2/etc/php.ini disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru max_execution_time = 300 error_reporting = E_ALL & ~E_NOTICE post_max_size = 50M cgi.fix_pathinfo=1 # 为了当文件不存在时,阻止Nginx将请求发送到后端的PHP-FPM模块,从而避免恶意脚本注入的攻击,所以此项应该去掉注释并设置为0 upload_max_filesize = 50M date.timezone = PRC sendmail_path = /usr/sbin/sendmail -t -i mail.add_x_header = On curl.cainfo =/etc/pki/tls/certs/ca-bundle.crt openssl.cafile=/etc/pki/tls/certs/ca-bundle.crt
扩展模块:
mcrypt memcache mongodb rdkafka redis swoole imap
Nginx: 使用:fastcgi_pass unix:/tmp/php-cgi-72.sock;
apache 是把PHP当做自己的一个模块来启动的,而nginx则是把http请求变量(如 get,user_agent等)转发给PHP进程,即PHP独立进程,与nginx进行通信,成为fastcgi运行方式; Apache所编译的PHP是不能用于nginx;nginx把请求的信息转发个9000端口的PHP进程,让PHP进程处理指定目录下的PHP文件;
====================================================================================
Composer:
curl -sS https://getcomposer.org/installer | /usr/local/php/bin/php mv composer.phar /usr/local/bin/composer ln -s /usr/local/php/bin/php /usr/local/bin/php
====================================================================================
--enable-bcmath \ # 前空格格式错误
================================================================
======================================================
Linux下的编译参数
1、nginx编译参数: nginx -v your_nginx_dir/sbin/nginx -v 2、apache编译参数: cat your_apache_dir/build/config.nice 3、php编译参数: your_php_dir/bin/php -i |grep configure 4、mysql编译参数: cat your_mysql_dir/bin/mysqlbug |grep configure