标签:php-fpm配置 amp 3.2 prefork red ddt 2.0 查询 php5
源码编译安装http-2.4yum -y groupinstall "Development Tools"
yum -y install pcre-devel apr-devel apr-util-devel openssl-devel
tar xvf httpd-2.4.35.tar.bz2 -C /usr/local/src/
tar xvf apr-1.6.5.tar.gz
tar xvf apr-util-1.6.1.tar.gz
cd /usr/local/src/httpd-2.4.35/
./configure --prefix=/app/httpd24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork --with-included-apr
make -j 2 && make install
我们再做一些附加操作,我们知道,prefork模式下,我们的子进程用户一般是apache,,这里现在是damen,所以我们将其稍做修改
修改之前:
useradd -r -u 48 -c "Apache" -d /usr/share/httpd -s /sbin/nologin apache
vim /etc/httpd24/httpd.conf
User apache
Group apache
/app/httpd24/bin/apachectl restart
手动关闭httpd24
/app/httpd24/bin/apachectl stop
进入/usr/lib/systemd/system下,编辑http24的配置文件,这里我们随便挑了一个服务配置当作模板进行编辑
cd /usr/lib/systemd/system
cp sshd.service httpd24.service
vim httpd24.service
重新加载配置文件,并启动http服务
systemctl daemon-reload
systemctl start httpd24
systemctl enable httpd24
yum -y install libmcrypt-devel bzip2-devel libxml2-devel
tar xvf php-7.2.11.tar.bz2 -C /usr/local/src/
cd /usr/local/src/php-7.2.11/
./configure --prefix=/app/php --enable-mysqlnd --with-mysqli=mysqlnd --with-openssl --with-pdo-mysql=mysqlnd --enable-mbstring --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/app/httpd24/bin/apxs --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --disable-fileinfo
make -j 2 && make install
[root@localhost ~]# vim /etc/httpd24/httpd.conf
<IfModule>
DirectoryIndex index.php index.html
</IfModule>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
/app/httpd24/bin/httpd -t
systemctl restart httpd24
vim /app/httpd24/htdocs/info.php
yum -y install mariadb-server mariadb-devel
vim /etc/my.cnf.d/server.cnf
[mysqld]
skip_name_resolve=ON
创建账号
编辑测试php脚本
[root@localhost php-7.2.11]# vim /app/httpd24/htdocs/conn.php
浏览器端访问
tar xvf php-5.6.38.tar.bz2 -C /usr/local/src/
cd /usr/local/src/php-5.6.38/
ln -sv /usr/lib64/mysql/libmysqlclient.so /usr/lib
./configure --prefix=/app/php56 --with-mysql=/usr --with-openssl --with-mysqli=/usr/bin/mysql_config --enable-mbstring --with-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --enable-fpm \ #即开启php-fpm
--with-mcrypt --with-config-file-path=/etc/php56 --with-config-file-scan-dir=/etc/php56/php.d --with-bz2
make -j 2 && make install
cd /app/php56/etc/
cp php-fpm.conf.default php-fpm.conf
vim php-fpm.conf
pid = run/php-fpm.pid
error_log = log/php-fpm.log
pm.status_path = /status
ping.path = /ping
ping.response = pong
pm.max_children = 50
mkdir /etc/php56
cp /usr/local/src/php-5.6.38/php.ini-production /etc/php56/php.ini
cp /usr/local/src/php-5.6.38/sapi/fpm/php-fpm.service /usr/lib/systemd/system
vim /usr/lib/systemd/system/php-fpm.service
systemctl daemon-reload
systemctl start php-fpm.service
DirectoryIndex index.php index.html
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
ProxyRequests Off
ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/app/httpd24/htdocs/$1
/app/httpd24/bin/httpd -t
systemctl restart httpd24
vim /app/httpd24/htdocs/index.php
浏览器端访问
至此,http2.4以及php的源码编译安装就全部完成了。
tar xvf xcache-3.2.0.tar.bz2 -C /usr/local/src/
cd /usr/local/src/xcache-3.2.0/
./configure --enable-xcache --with-php-config=/app/php56/bin/php-config
make && make install
查询扩展模块的API
mkdir /etc/php56/php.d
cp /usr/local/src/xcache-3.2.0/xcache.ini /etc/php56/php.d
vim /etc/php56/php.d/xcache.ini
systemctl restart php-fpm.service
浏览器端访问查看php信息
标签:php-fpm配置 amp 3.2 prefork red ddt 2.0 查询 php5
原文地址:http://blog.51cto.com/13866567/2308675