Apache 和 php 編譯安裝

2021-10-09 14:07:36 字數 4113 閱讀 8036

linux專案環境部署

分別安裝apache 和 php

1.apache安裝

#httpd為apache安裝包,其他三個為前置。

1.全部拷貝到 /usr/local/httpd 目錄下並分別解壓。

./configure && make && make install#/usr/local/httpd/pcre-8.44目錄下執行

yum install zlib#安裝依賴

yum install zlib-devel#安裝依賴

yum install expat-devel#安裝依賴

yum install libxml2-devel#安裝依賴

yum -y install gcc#安裝依賴

./configure --prefix=/usr/local/apache2/ --sysconfdir=/usr/local/apache2/etc/ --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared#/usr/local/httpd/httpd-2.4.46目錄下執行

make

make install

/usr/local/apache2/bin/apachectl start#啟動apache

2.php安裝

yum -y install libjpeg-devel#安裝依賴

yum install libpng#安裝依賴

yum install libpng-devel#安裝依賴

yum install freetype-devel#安裝依賴

yum install libcurl-devel#安裝依賴

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php --enable-mbstring --enable-ftp --with-apxs2=/usr/local/apache2/bin/apxs --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --without-pear --enable-sockets --with-freetype-dir=/usr --with-zlib --with-libxml-dir=/usr --with-xmlrpc --enable-zip --enable-fpm --enable-xml --enable-sockets --with-gd --with-zlib --with-iconv --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli --with-curl#/usr/local/httpd/php7.1.33目錄下執行

make clean

make

make install

cp /usr/local/httpd/php-7.1.33/php.ini-production ./php.ini#在 /usr/local/php目錄下執行

/usr/local/php/sbin/php-fpm#啟動php-fpm,預設已經啟動

安裝openssl擴充套件

9. extension_dir = "/usr/local/php/lib/php/extensions/no-debug-zts-20160303/"#新增

10.extension="openssl.so";#新增

配置php環境變數

echo $path

檢視環境變數

/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

export path=/usr/local/php/bin:$path

echo $path

/usr/local/php/bin:/usr/local/php/bin:/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

vim /etc/profile

在最後一行加上export path="/usr/local/php/bin:$path"

source /etc/profile

安裝composer

curl -ss | php

mv composer.phar /usr/local/bin/composer

composer config -g repo.packagist composer

配置站點

#loadmodule rewrite_module modules/mod_rewrite.so 開啟這一欄,去掉#

#include etc/extra/httpd-vhosts.conf  開啟這一欄,去掉#

寫入以下內容:

serveradmin [email protected]

#php_admin_value open_basedir "/home/prod/project:/tmp/:/var/tmp/:/proc/"

documentroot "/home/prod/project/public"

servername ***.p***x.cn

errorlog "/home/logs/ip-error_log"

customlog "/home/logs/ip-access_log" combined

setoutputfilter deflate

options followsymlinks

allowoverride all

order allow,deny

require all granted

allow from all

directoryindex index.html index.php

Apache編譯安裝

1 apache編譯包 2 apr編譯包 3 apr util編譯包 ps 三個包均在同乙個網頁上 4 pcre編譯包 wget ftp ftp.pcre.org pub pcre pcre 8.44.tar.bz2 1 apr編譯安裝 解壓 tar xjf apr 1.7.0.tar.bz2cd切...

Apache和PHP的安裝

最近看了一些教科書,可能是印刷的緣故,只是乙個空格沒有列印,再加上網上的很多部落格文章只是順手 並沒有仔細的檢查,還有php和apache之間的版本問題,害得我花了4,5小時的時間才搞定環境的搭配。學習過程中,也發現了log檔案不容忽視的最用。php的版本 php 5.2.17 win32 vc6 ...

linux編譯安裝Apache

編譯安裝apache http server,目前最新的版本為2.4.41,做好apr,apr util,pcre的安裝後編譯安裝即可。三個 apr,apr util,pcre,已安裝的可以跳過。tar zxvf apr 1.7.0.tar.gz cd apr 1.7.0 configure pre...