PHP7编译安装与配置
1 2 3
| $ yum -y install gcc gcc-c++ autoconf automake libtool make cmake $ yum -y install zlib zlib-devel openssl openssl-devel pcre-devel libxml2-devel curl-devel libmcrypt-devel $wget http://cn2.php.net/get/php-7.0.10.tar.gz/from/this/mirror
|
解压后
1 2 3
| $ ./configure --prefix=/usr/local/php7 \ --with-config-file-path=/usr/local/php7/etc \ --with-config-file-scan-dir=/usr/local/php7/etc/php.d \ --with-mcrypt=/usr/include \ --enable-mysqlnd \ --with-mysqli \ --with-pdo-mysql \ --enable-fpm \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --with-gd \ --with-iconv \ --with-zlib \ --enable-xml \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --enable-mbregex \ --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-curl \ --with-jpeg-dir \ --with-freetype-dir \ --enable-opcache make make install
|
查看ini的位置。然后看看是否存在ini。如果没有去编译好的源码里面复制一个
1
| cd /usr/local/php7/bin/php --ini
|
1 2 3 4
| php.ini pid = run/php-fpm.pid error_log = log/php-fpm.log log_level = notice
|
也把php-fpm配置文件复制
1 2
| $ cp php-fpm.conf.default php-fpm.conf $ cp php-fpm.d/www.conf.defualt php-fpm.d/www.conf
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| php-fpm.conf listen = 127.0.0.1:9000 listen.allowed_clients = 127.0.0.1 pm = dynamic pm.max_children = 50 pm.start_servers = 5 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 env[HOSTNAME] = $HOSTNAME env[PATH] = /usr/local/bin:/usr/bin:/bin env[TMP] = /tmp env[TMPDIR] = /tmp env[TEMP] = /tmp
|
运行php-fpm
1 2
| /usr/local/php7/sbin/php-fpm netstat -antpl (如果看到9000端口,PHP-FPM配置成功)
|
Nginx安装与配置
1 2 3 4 5 6
| yum install libbz2 yum install readline-devel yum install sqlite-devel yum install zlib-devel yum install openssl-devel yum install nginx
|
nginx.conf配置文件
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| nginx.conf # For more information on configuration, see: # * Official English Documentation: http://nginx.org/en/docs/ # * Official Russian Documentation: http://nginx.org/ru/docs/ user nginx; worker_processes 1; error_log /var/log/nginx/error.log; #error_log /var/log/nginx/error.log notice; #error_log /var/log/nginx/error.log info; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; # Load config files from the /etc/nginx/conf.d directory # The default server is in conf.d/default.conf #include /etc/nginx/conf.d/*.conf; server { listen 80; root html/wordpress; location /{ index index.php; } location ~\.php.*$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /$document_root$fastcgi_script_name; include fastcgi_params; } } }
|