手动编译php

来源:互联网 发布:网店数据分析讲稿 编辑:程序博客网 时间:2024/06/07 06:40
总是用套件搭建环境导致对环境的内在关联关系不是很明白,因为套件吧一切都帮你搞定了。
最近手动编译了nginx发现其实光编译还不够还要知道相关的东西才能够保证系统正常运转。好了不说废话了开始手动编译php
1、从php官网下载5.6版本http://124.205.69.131/files/A0630000026D9A5F/cn2.php.net/distributions/php-5.6.16.tar.gz
2、解压文件 tar -zxvf php-5.6.16.tar.gz
3、cd php-5.6.16
4、./configure --prefix=/usr/local/php --with-curl--with-freetype-dir --with-gd --with-gettext --with-iconv-dir--with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli--with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite--with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib--enable-fpm --enable-bcmath --enable-libxml--enable-inline-optimization --enable-gd-native-ttf--enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl--enable-shmop --enable-soap --enable-sockets --enable-sysvsem--enable-xml --enable-zip
检查php环境是否完整
5、根据提示补充 yum install XXXX即可
6、补充完毕后再执行配置检查,ok后 make && make install
7、
cp
php.ini-production /usr/local/php/etc/php.ini #复制php配置文件到安装目录
rm-rf/etc/php.ini#删除系统自带配置文件
ln-s/usr/local/php/etc/php.ini/etc/php.ini#添加软链接到 /etc目录
cp/usr/local/php/etc/php-fpm.conf.default/usr/local/php/etc/php-fpm.conf#拷贝模板文件为php-fpm配置文件
ln-s/usr/local/php/etc/php-fpm.conf/etc/php-fpm.conf#添加软连接到/etc目录
8、设置开机启动
cp/home/php-5.6.5/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm#拷贝php-fpm到启动目录
chmod +x /etc/rc.d/init.d/php-fpm #添加执行权限
chkconfig php-fpm on #设置开机启动
9、配置nginx.conf
首先从 /usr/local/php/etc/php-fpm.conf
这里查看listen的端口
根据监听的类型修正nginx.conf文件
       location ~ \.php$ {
               include fastcgi_params;
               #fastcgi_pass unix:/tmp/php-cgi.sock;
               fastcgi_pass 127.0.0.1:9000;
               fastcgi_index index.php;
               fastcgi_param SCRIPT_FILENAME/usr/local/nginx/html$fastcgi_script_name;
       }
这样基本上配置成功了。
0 0