编译安装PHP 所需的支持库
注:php在5.3.3以后的版本都已经集成了php-fpm
tar zxvf libiconv-1.11.tar.gz
cd libiconv-1.11/
./configure --prefix=/usr/local
make
make install
cd ../
tar zxvf freetype-2.3.5.tar.gz
cd freetype-2.3.5/
./configure
make
make install
cd ../
tar zxvf libpng-1.2.20.tar.gz
cd libpng-1.2.20/
./configure
make
make install
cd ../
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure
make
make install
make install-lib
cd ../
#----If your system was install libxml2, you do not need to install it.----
#tar zxvf libxml2-2.6.30.tar.gz
#cd libxml2-2.6.30/
#./configure
#make
#install
#cd ../
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make
make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install
make
make install
cd ../../
tar zxvf mhash-0.9.9.tar.gz
cd mhash-0.9.9/
./configure
make
make install
cd ../
cp /usr/local/lib/libmcrypt.* /usr/lib
ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2
tar zxvf mcrypt-2.6.6.tar.gz
cd mcrypt-2.6.6/
./configure
make
make install
cd ../
apt-get install libcurl4-gnutls-dev
apt-get install libjpeg-dev
apt-get install libpng-dev
配置,编译,安装 PHP
./configure --prefix=/usr/local/server/php --with-config-file-path=/usr/local/server/php/etc --with-mysql=/opt/mariadb/ --with-mysqli=/opt/mariadb/bin/mysql_config --with-iconv-dir=/usr/local --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --with-freetype-dir --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear
ln -s /opt/mariadb/lib/libmysqlclient.so.18 /usr/lib/libmysqlclient.so.18
make && make install
安装 Nginx
从nginx.org下载nginx源码包
./configure
apt-get install libpcre3-dev
make && make install
配置 nginx
# 编辑nginx的配置文件nginx.conf
vim /usr/local/nginx/conf/nginx.conf
root "/home/bob/php/workspace/"; #指定PHP文件目录
index index.html index.htm index.php;
# location / {
# root html;
# index index.html index.htm;
# }
location ~ .*\.(php|php5)?$ # URI参数可使用正则表达式,前面这句话代表,匹配所有包涵php的请求
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
配置 PHP fast cgi模式
cp /usr/local/server/php/etc php-fpm.conf.default php-fpm.conf
start nginx
./usr/local/nginx/sbin/nginx
start php
./usr/local/server/php/sbin/php-fpm
验证PHP和Nginx是否正确启动
# netstat -ntlp
激活Internet连接 (仅服务器)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6624/nginx
tcp 0 0 127.0.1.1:53 0.0.0.0:* LISTEN 1485/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 5048/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1236/cupsd
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 6689/php-fpm.conf)
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 10960/mysqld
tcp6 0 0 :::22 :::* LISTEN 5048/sshd
tcp6 0 0 ::1:631 :::* LISTEN 1236/cupsd
在 /home/bob/php/workspace/ 路径下创建一个index.php,内容如下:
<?php
echo "PHP fast cgi finished!"
?>
在本机浏览器上输入:http://localhost
浏览器将显示 PHP fast cgi finished!
分享到:
相关推荐
LINUX搭建PHP5.4+Nginx1.3.9+Mysql5.5.21
PHP运行环境配置(Centos 64位 PHP5.4 Nginx)
ubuntu20.04无网dpkg安装nginx
ubuntu开机自启动nginx服务
PHP 5.4 & Nginx 1.4.2 [整合Zend Debuger for PHP 5.4]
ubuntu自动安装nginx php脚本ubuntu自动安装nginx php脚本
资源内容:ubuntu 1804 nginx离线安装包 适用场景:无互联网环境的ubuntu 1804服务器的nginx离线部署 适用人群:运维,学习离线部署的学生 所需技能:常用的linux操作命令
基于CentOS 5.4搭建nginx+php+spawn-fcgi+mysql高性能php平台
ubuntu 20.04 离线安装Nginx(nginx-full_1.18.0)及相关依赖文件
解压后 执行: dpkg -i *.deb 里面包含gcc make 和nginx
ubuntu安装tfs tfs-nginx的方法 ######################################################################################## tfs安装 1.降级安装gcc4.1.2 2.安装依赖包 3.安装tb-common-utils 4.安装TFS ########...
Windows下Nginx和php-cgi的bat批处理快速启动方法!!!!
Ubuntu14.04.2下nginx1.6和sticky1.1模块的安装与简单配置,包括像文档和支持包
CentOS5.4简易安装NginxPHPMysql.pdf
Ubuntu12.04下安装 nginx + php + mysql 的源代码文件 里面包含如下文件 ibiconv-1.14.tar.gz libmcrypt-2.5.8.tar.gz mcrypt-2.6.8.tar.gz mhash-0.9.9.9.tar.gz pcre-8.30.tar.gz mysql-5.5.22.tar.gz nginx-...
本篇文章主要介绍了Ubuntu安装PHP和PHP Nginx配置方法,具有一定的参考价值,有兴趣的可以了解一下
1、本安装包并非本人原创,仅仅是对原安装包进行了一些细微的修改,让大家能更方便的安装nginx+php-cgi+mysql平台,进行测试和学习所用。本着学习的精神,希望大家能更快掌握这个平台。 2、文件全部解压缩到/usr/...
ubuntu docker 镜像配置php和nginx
Ubuntu12.04 nginx python uwsgi Django安装步骤
Ubuntu中Nginx服务器安装配置教程