分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 技术分享

编译安装PHP7

发布时间:2023-09-06 01:12责任编辑:郭大石关键词:PHP编译

CentOS6.6编译安装PHP7

  • 首先安装依赖包

yum install gcc gcc-c++ pcre* openssl* gd-devel* zlib-devel pcre-devel libxml2-devel curl-devel

  

        下载安装libmcrypt

        地址:http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/

        编译安装即可

tar -zxvf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8./configuremake && make install

        编辑  /etc/ld.so.conf  末行添加

/usr/local/lib

  

  • 下载PHP7

wget http://cn2.php.net/distributions/php-7.0.1.tar.gztar zxvf php-7.0.1.tar.gz
  • 编译安装PHP7

./configure --prefix=/usr/local/php7 --exec-prefix=/usr/local/php7 --bindir=/usr/local/php7/bin --sbindir=/usr/local/php7/sbin --includedir=/usr/local/php7/include --libdir=/usr/local/php7/lib/php --mandir=/usr/local/php7/php/man --with-config-file-path=/usr/local/php7/etc --with-mcrypt=/usr/include --with-mhash --with-openssl --with-mysqli=shared,mysqlnd --with-pdo-mysql=shared,mysqlnd --with-gd --with-iconv --with-zlib --enable-zip --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-mbregex --enable-mbstring --enable-ftp --enable-gd-native-ttf --enable-pcntl --enable-sockets --with-xmlrpc --enable-soap --without-pear --with-gettext --enable-session --with-curl --with-jpeg-dir --with-freetype-dir --enable-opcache --enable-fpm --without-gdbm --disable-fileinfo
View Code
make && make install
  • 配置文件

cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.confcp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf cp php.ini-production /usr/local/php/etc/php.inicp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpmchmod +x /etc/rc.d/init.d/php-fpmchkconfig --add php-fpmchkconfig php-fpm on
  • 启动

/etc/init.d/php-fpm start
  • nginx链接php

cat /etc/nginx/nginx.conf

user ?nginx;worker_processes ?1;#error_log ?logs/error.log;#error_log ?logs/error.log ?notice;#error_log ?logs/error.log ?info;#pid ???????logs/nginx.pid;events { ???worker_connections ?1024;}http { ???include ??????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 ?logs/access.log ?main;server_names_hash_bucket_size 128;client_header_buffer_size 32k;large_client_header_buffers 4 32k;client_max_body_size 300m;sendfile ???????on;tcp_nopush ????on;fastcgi_connect_timeout 300;fastcgi_send_timeout 300;fastcgi_read_timeout 300;fastcgi_buffer_size 64k;fastcgi_buffers 4 64k;fastcgi_busy_buffers_size 128k;fastcgi_temp_file_write_size 128k;keepalive_timeout ?60;tcp_nodelay on;server_tokens off;gzip ?on;gzip_min_length ?1k;gzip_buffers ????4 16k;gzip_http_version 1.1;gzip_comp_level 2;gzip_types ??????text/plain application/x-javascript text/css application/xml;gzip_vary on; ???server { ???????listen ??????80; ???????server_name ?www.qy.com; ???????#access_log ?logs/host.access.log ?main; ???????location / { ???????????root ??html; ???????????index ?index.html index.htm; ???????} ???????error_page ??500 502 503 504 ?/50x.html; ???????location = /50x.html { ???????????root ??html; ??????} ??}include /etc/nginx/vhost/*.conf;}
View Code

cat /etc/nginx/vhost/zabbix.conf 

server ???????{ ???????????????listen ??????80; ???????????????server_name 192.168.80.11; ???????????????index index.php index.html index.htm default.html default.htm default.php; ???????????????root ?/usr/local/nginx/html; ???????location ~ \.php$ { ???????root ??????????/usr/local/nginx/html; ???????fastcgi_pass ??192.168.80.11:9000; ???????fastcgi_index ?index.php; ???????fastcgi_param ?SCRIPT_FILENAME ?/usr/local/nginx/html/$fastcgi_script_name; ???????include ???????fastcgi_params; } ??????????????????????????location /status { ???????????????stub_status on; ???????????????access_log ??off; ???????????????} ??????location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ ??????????????{ ????expires 30d; ????????????????????????????????????} ??????location ~ .*\.(js|css)?$ { ??????expires 12h; ???????????????????????????????????} ??????access_log off; ???????????????????????????????????}
View Code

编译安装PHP7

原文地址:http://www.cnblogs.com/hanwei999/p/7542641.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved