安装apache和php的过程

环境配置

安装apr和apr-util

#安装依赖
#yum install expat-devel

alias m4='make -j4&&make install -j4'

cd /apps/SourceCode
#wget
#wget
tar zxvf apr-1.7.0.tar.gz
tar zxvf apr-util-1.6.1.tar.gz
tar zxvf pcre-8.45.tar.gz
cd apr-1.7.0
./configure --prefix=/apps/Prefix/apr-1.7.0
#make
#make install
m4
ln -s /apps/Prefix/apr-1.7.0 /apps/apr
cd ../apr-util-1.6.1
./configure --prefix=/apps/Prefix/apr-util-1.6.1 --with-apr=/apps/apr
#make
#make install
m4
ln -s /apps/Prefix/apr-util-1.6.1 /apps/apr-util
cd ../pcre-8.45
./configure --prefix=/apps/Prefix/pcre-8.45 --with-apr=/apps/apr
#make
#make install
m4
ln -s /apps/Prefix/pcre-8.45 /apps/pcre
#

apache2.4

cd /apps/SourceCode
#wget httpd-2.4.48.tar.gz
tar zxvf httpd-2.4.48.tar.gz
cd httpd-2.4.48
./configure --prefix=/apps/Prefix/httpd-2.4.48 --sysconfdir=/etc/httpd --with-apr=/apps/apr --with-apr-util=/apps/apr-util --with-pcre=/apps/pcre --enable-so
#make
#make install
m4
ln -s /apps/Prefix/httpd-2.4.48 /apps/apache
#

php

#安装库
yum install libxml2-devel sqlite-devel libwebp-devel libjpeg-devel libXpm-devel oniguruma-devel

cd /apps/SourceCode
#wget
tar zxvf php-7.4.20.tar.gz
cd php-7.4.20
./configure --prefix=/apps/Prefix/php-7.4.20 --with-config-file-path=/apps/php/etc/php. --enable-mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --enable-fpm --with-mysql-sock=/tmp/mysql.sock --enable-mbstring --with-curl --enable-gd --with-webp --with-jpeg --with-xpm --with-zlib
make -j4
make install -j4
#m4
ln -s /apps/Prefix/php-7.4.20 /apps/php
#
cp php.ini-development /apps/php/etc/php.ini

php在httpd.conf中的一些配置

LoadModule php7_module modules/libphp7.so

<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>

fpm 常用

# 平滑重启
kill -USR2 16550

# 启动
php-fpm

php-fpm 关闭:
kill -INT `cat /apps/php/logs/php.pid`

php-fpm 重启:
kill -USR2 `cat /apps/php/logs/php.pid`

)

最后修改:2025 年 03 月 11 日
如果觉得我的文章对你有用,请随意赞赏