1.安装php所需的软件包
[root@zhu1 ~] # yum -y install libjpeg libjpeg-* libpng libpng-* libmcrypt libmcrypt-* fteetype freetype-* zlib zlib-* bzip2 bzip2-* ncurses ncurses-* libxml2 libxml2-* |
2.解压,打补丁,编译,安装
[root@zhu1 ~] # tar zxvf php-5.2.17.tar.gz [root@zhu1 ~] # gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1 [root@zhu1 ~] # ./configure --prefix=/opt/php --with-config-file-path=/opt/php/etc --with-mysql=/opt/mysql/ --with-mysqli=/opt/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-sockets --enable-gd-native-ttf --enable-bcmath --enable-mbstring --with-gettext --enable-fpm --enable-fastcgi [root@zhu1 ~] # make && make install |
3.创建php.ini配置文件
[root@zhu1 php-5.2.17] # cp php.ini-dist /opt/php/etc/php.ini |
4.配置php-fpm.conf
该配置文件的用户名和组必须和nginx.conf配置文件中的用户和组相同
5.启动php-fpm
[root@zhu1 etc] # /opt/php/sbin/php-fpm Usage: /opt/php/sbin/php-fpm {start|stop|quit|restart|reload|logrotate} [root@zhu1 etc] # /opt/php/sbin/php-fpm start |
6.整合nginx和php
前面
location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } 在 /opt/nginx/conf/nginx .conf配置文件中找到上面该段,去掉前面的注释,并修改$document_root 这个地方 |
7.启动nginx
[root@zhu1 etc] # /opt/nginx/sbin/nginx |
點(diǎn)擊查看更多內(nèi)容
為 TA 點(diǎn)贊
評(píng)論
評(píng)論
共同學(xué)習(xí),寫下你的評(píng)論
評(píng)論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦