您的位置:首页 > 其它

LAMP编译安装(续)

2016-07-26 22:41 183 查看
搭建环境:Centos 6.8,httpd2.4.18,mysql 5.6.23,php 5.6.17
接上篇:/article/11924001.html ,上篇使用httpd和php模块化安装,php编译安装--with-apxs2,此篇文章作为补充,使用fastcgi,php独立运行。
httpd和mysql安装均前面一样。
tar -xf php-5.6.17.tar.xz
cd php-5.6.17
如果没有安装MySQL(基本就是分布式安装的模式)
./configure --prefix=/usr/local/php --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-sockets --enable-fpm --with-mcrypt  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2  --enable-maintainer-zts
如果已经安装MySQL(基本就是单机模式)
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-openssl --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml  --enable-sockets --enable-fpm --with-mcrypt  --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2  --enable-maintainer-zts
其实php编译模块不同点只是把 --with-apxs2=/usr/local/apache/bin/apxs替换为 --enable-fpm而已。
make ZEND_EXTRA_LIBS='-liconv'
make install
复制PHP配置及设置开机启动(其实LNMP就是使用的php-fpm,此处就做过多描述)
cp php.ini-production /etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm  /etc/rc.d/init.d/php-fpm
chmod +x /etc/rc.d/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
service php-fpm start
在http中增加反向代理模块

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
LoadModule proxy_module modules/mod_proxy.so
配置虚拟主机支持使用fcgi,在相应的主机中添加类似如下两行。
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/PATH/TO/DOCUMENT_ROOT/$1
定位DirectoryIndex
DirectoryIndex  index.php  index.html


LAMP yum安装(一般网站访问量不高,YUM安装是最有效的一种方法)
安装Apache及其扩展
yum -y install httpd
yum -y install httpd-manual mod_ssl mod_perl mod_auth_mysql
安装配置MySQL
yum -y install mysql mysql-server mysql-devel
mysql secure_installation(编译安装可以使用这个,删除测试库,设置密码均更方便)
service mysqld start
/usr/bin/mysql_secure_installation
安装php及其扩展
yum -y install php php-mysql
yum -y install gd php-gd gd-devel php-xml php-common php-mbstring php-ldap php-pear php-xmlrpc php-imap
启动httpd服务

service httpd start
设置开启启动项
chkconfig httpd on
chkconfig mysqld on


本文出自 “Frank” 博客,请务必保留此出处http://zhoufan.blog.51cto.com/4278592/1830439
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: