<!-- lang: shell --> 置頂處[lnmp編譯安裝][1]的php安裝在/usr/local/路徑下,本篇爲lamp編譯安裝。apache與nginx共存,適用於apache的php安裝在/usr/下 apache安裝 依賴兩個包apr,apr-util,資源都在apache官網下。 1.apr tar xf apr-1.4.6.tar.bz2 cd apr-1.4.6 sudo ./configure --help | less (能夠查看幫助文件) sudo ./configure --prefix=/usr/local/apr (指定安裝路徑) sudo make sudo make install 2.apr-util tar xf apr-util-1.5.2.tar.bz2 cd apr-util-1.5.2 sudo ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr (--prefix指定安裝路徑;--with-apr指定apr的安裝路徑,apr-util依賴於apr) sudo make && make install 3.appache 開始編譯 tar xf httpd-2.4.4.tar.bz2 cd httpd-2.4.4 sudo ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-mpms-shared=all --with-mpm=event --sysconfdir=/etc/httpd :指定配置文件安裝位置 --enable-so :支持動態共享模塊若是沒有這個模塊PHP將沒法與apache結合工做 --enable-ssl :啓用支持ssl --enable-cgi :支持cgi --enable-rewrite :支持URL重寫 --with-zlib :壓縮庫,在互聯網上傳播時可節約帶寬 --with-apr=/usr/local/apr :指定apr路徑 --with-apr-util=/usr/local/apr-util :指定apr-util路徑 --enable-mpms-shared=all 支持多道處理模塊 --with-mpm=event 設定默認的模塊 sudo make sudo make install 啓動apache sudo /usr/local/apache/bin/apachectl start mysql安裝 與置頂的lnmp安裝方法一致,爲二進制安裝。 php安裝 依賴文件 :libbz2 libfreetype6-dev libltdl-dev libxml2-dev libpng12-dev libjpeg-dev libmcrypt-dev libcurl4-openssl-dev 編譯配置: sudo ./configure --prefix=/usr/php --with-config-file-path=/usr/php/etc --with-config-file-scan-dir=/usr/php/lib/php --with-mcrypt --with-jpeg-dir --with-png-dir --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --with-mysqli=/usr/local/mysql/bin/mysql_config --with-openssl --with-zlib --with-freetype-dir --enable-mbstring --enable-sockets --with-curl --with-gd --with-iconv-dir --with-pcre-dir --with-xmlrpc --enable-ftp --enable-gd-jis-conv --enable-gd-native-ttf --enable-soap --enable-mod-charset --enable-mysqlnd --enable-shmop --enable-zip --enable-static --enable-debug --enable-exif --enable-bcmath --enable-fpm --with-apxs2=/usr/local/apache/bin/apxs --with-bz2 --enable-maintainer-zts sudo make sudo make install sudo cp php.ini-development /usr/php/etc/php.ini sudo useradd --no-create-home --shell=/sbin/nologin www cd /usr/php/etc sudo cp php-fpm.conf.default php-fpm.conf sudo vim php-fpm.conf (修改user=www group=www) 1.相關問題 apache啓動 1. AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message http://www.javainmind.com/article-001/ 有部份內容從jqhoudun的[博客][2]內截取,包括apr,apr-util,apache的編譯安裝,php的配置的部分編譯配置。