安裝參考環境:php
CentOS Linux release 7.5.1804 (Core)html
httpd安裝的依賴包 # yum -y install pcre-devel # yum -y install openssl-devel # yum -y groupinstall "Development Tools" arp-util安裝的依賴包 # yum install expat-devel
# wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-1.7.0.tar.g # tar xf apr-1.7.0.tar.gz # cd apr-1.7.0 # ./configure -prefix=/usr/local/apr # make && make install
# wget http://mirrors.tuna.tsinghua.edu.cn/apache//apr/apr-util-1.6.1.tar.gz # tar xf apr-util-1.6.1.tar.gz # cd apr-util-1.6.1 # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/ # make && make install
# wget http://mirror.bit.edu.cn/apache//httpd/httpd-2.4.41.tar.gz # tar xf httpd-2.4.41.tar.gz # cd httpd-2.4.41 # ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modeles=most --enable-mpms-shared=all --with-mpm=event # make && make install
一、用chkconfig 方式管理mysql
ln -s /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd vi /etc/rc.d/init.d/httpd #在#/bin/sh 下加上兩行 # chkconfig: 2345 95 10 # description: Activates/Deactivates Apache Web Server #註冊服務 chkconfig --add httpd #開機自啓動 systemctl enable httpd | chkconfig httpd on #管理 service httpd stop|start|restart
# /usr/local/apache/bin/httpd
useradd -U apache
ps -aux | grep apache //源碼編譯apache,運行用戶爲deamon #修改配置文件改變apache運行身份 [root@promote conf]# vim httpd.conf User apache Group apache # #添加php支持 [root@promote conf]# vim httpd.conf <IfModule mime_module> # # TypesConfig points to the file containing the list of mappings from # filename extension to MIME-type. # TypesConfig conf/mime.types # # AddType allows you to add to or override the MIME configuration # file specified in TypesConfig for specific file types. # #AddType application/x-gzip .tgz # # AddEncoding allows you to have certain browsers uncompress # information on the fly. Note: Not all browsers support this. # #AddEncoding x-compress .Z #AddEncoding x-gzip .gz .tgz # # If the AddEncoding directives above are commented-out, then you # probably should define those extensions to indicate media types: # AddType application/x-compress .Z AddType application/x-gzip .gz .tgz # # AddHandler allows you to map certain file extensions to "handlers": # actions unrelated to filetype. These can be either built into the server # or added with the Action directive (see below) # # To use CGI scripts outside of ScriptAliased directories: # (You will also need to add "ExecCGI" to the "Options" directive.) # #AddHandler cgi-script .cgi # For type maps (negotiated resources): #AddHandler type-map var # # Filters allow you to process content before it is sent to the client. # # To parse .shtml files for server-side includes (SSI): # (You will also need to add "Includes" to the "Options" directive.) # #AddType text/html .shtml #AddOutputFilter INCLUDES .shtml ##添加解析php類別文件 AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps </IfModule>
yum -y install libxml2-devel openssl curl-devel libjpeg-devel libpng libpng-devel freetype-devel libmcrypt-devel libzip libzip-devel
./configure --prefix=/usr/local/php7.3 \ --with-config-file-path=/usr/local/php7.3/etc \ --enable-fpm \ --enable-sysvsem \ --enable-sockets \ --enable-pcntl \ --enable-mbstring \ --enable-mysqlnd \ --enable-opcache \ --enable-shmop \ --enable-ftp \ --enable-wddx \ --enable-soap \ --with-apxs2=/usr/local/apache/bin/apxs
cp php.ini-production /usr/local/php7.3/etc/php.ini ls /usr/local/php7.3/etc/
vi /usr/local/php7.3/etc/php.ini #禁用函數 disable_functions=