Apache安裝
安裝apr和apr-util
yum install -y apr.x86_64
yum install -y apr-util.x86_64
解壓源碼文件,進入源碼目錄
./configure --prefix=/usr/local/apache/
make && make install
prefix為Apache的安裝地址
Apache安裝完成
PHP安裝
解壓,進入源碼目錄
./configure --prefix=/usr/local/php7.0.5 --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-openssl --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-jpeg-dir --with-xmlrpc --with-xsl --with-zlib --with-bz2 --with-mhash --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-sysvshm --enable-xml --enable-zip --enable-maintainer-zts --with-apxs2=/usr/local/apache/bin/apxs
make && make install
其中第一個參數prefix是要安裝php的目錄,最后一個參數apxs2是Apache安裝目錄下的bin/apxs文件
PHP擴展安裝
擴展安裝基本步驟就是 下載源碼,運行phpize,運行configure,編譯安裝,php.ini添加相應擴展,重啟php-fpm以加載擴展
以phptars安裝進行演示
1:下載擴展包源碼
git clone https://github.com/TarsPHP/tars-extension.git
2:進入源碼包
cd tars-extension
3:運行phpize命令,寫全phpize的路徑
/usr/local/php7.0.5/bin/phpize
4:運行configure命令,配置時 要將php-config的路徑附上
./configure --with-php-config=/usr/local/php7.0.5/bin/php-config
5:編譯
make && make install
6:修改php.ini
extension = phptars.so
9:重啟對應的php-fpm
Apache配置PHP
在編譯安裝php之后,會根據--with-apxs2指示的路徑,在Apache安裝目錄的modules下生成對應的libphp.so,需要配置Apache的httpd.conf來加載這個模塊,同時允許調用php引擎執行php文件
LoadModule php7_module modules/libphp7.so
AddType application/x-httpd-php .php AddType
然后配置index
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
ssh配置
在拉取git代碼時,默認通過36000端口拉取,所以需要對git.code.oa.com的端口做特殊配置
在/root/.ssh/config中進行配置(沒有則創建該文件)
HostName git.code.oa.com
Port 22