phpconf
Ⅰ php-fpm.conf.default 5.3.27 在哪
首頁 > 運維 > linux 下編譯安裝 php-5.3.27
linux 下編譯安裝 php-5.3.27
1.環境說明
ubuntu 12.04
源碼存儲路徑 /home/wzw/workstation/src
安裝路徑 /home/wzw/workstation/env
切換到工作目錄 cd /home/wzw/workstation/src/
2.安裝
wget http://cn2.php.net/distributions/php-5.3.27.tar.gz
sudo mkdir -p /home/wzw/workstation/env/php5
sudo tar -zxvf php-5.3.27.tar.gz
cd php-5.3.27
sudo ./configure --prefix=/home/wzw/workstation/env/php5 --with-config-file-path=/home/wzw/workstation/env/php5/etc/php.ini --with-mysql=/home/wzw/workstation/env/mysql5 --with-pdo-mysql=/home/wzw/workstation/env/mysql5 --enable-magic-quotes --enable-static --enable-mbstring --enable-sockets --enable-zip --with-curl --with-libxml-dir --enable-fpm
#【出錯:configure: error: xml2-config not found. Please check your libxml2 installation.
# 解決:sudo apt-get install libxml2-dev】
#【出錯:You've configured multiple SAPIs to be build. You can build only |
# | one SAPI mole and CLI binary at the same time.
# 解決:編譯不帶這個參數--with-apxs2=/home/wzw/workstation/env/apache2/bin/apxs 】
#【出錯:configure: error: Please reinstall the libcurl distribution -
# easy.h should be in <curl-dir>/include/curl/
# 解決:sudo apt-get install libcurl4-openssl-dev】
sudo cp php.ini-proction ../../env/php5/etc/php.ini
sudo cp /home/wzw/workstation/env/php5/etc/php-fpm.conf.default /home/wzw/workstation/env/php5/etc/php-fpm.conf
sudo vim /home/wzw/workstation/env/php5/etc/php-fpm.conf
# 找到 ;pid = run/php-fpm.pid 【大概25行,去掉前面的分號】
sudo vim /home/wzw/workstation/env/nginx/conf/nginx.conf
# 在 location 中的 index 加上index.php,(大概是在45行)如:
# index index.php index.html index.htm;
# 去掉 loction ~ \.php$ { ... } 這個模塊的注釋 #
# 並把其中的 scripts 改成 $document_root
3.運行
cd /home/wzw/workstation/env/php5
sudo ./sbin/php-fpm -y ./etc/php-fpm.conf
# 【報錯:[25-Sep-2013 11:55:21] ERROR: [pool www] cannot get gid for group 'nobody'
# [25-Sep-2013 11:55:21] ERROR: FPM initialization failed
# 解決:打開etc/php-fpm.conf(大概140行),把nobody改成www-data
# 】
4.測試
./bin/php -r "echo 2+4;"
輸出 6 說明安裝成功!
Ⅱ can't load c:/php/php5ts.dll
在window下構建apache+php的設置
1.在httpd.conf文件中加入以下設置:
#包含自定義路徑下的php.conf文件
Include g:\MyWeb\etc\php.conf
2.在自定義路徑下創建php.conf文件,用於apache下的php設置。
#
# php.conf
#
PHPIniDir g:\MyWeb\etc
#php5
LoadFile g:\MyWeb\php5\libmysql.dll
LoadFile g:\MyWeb\php5\libmcrypt.dll
LoadFile g:\MyWeb\php5\libmhash.dll
LoadFile g:\MyWeb\php5\libeay32.dll
#LoadFile g:\MyWeb\php5\ssleay32.dll
LoadFile g:\MyWeb\php5\php5ts.dll
#LoadMole php5_mole g:\MyWeb\php5\php5apache2.dll
LoadMole php5_mole g:\MyWeb\php5\php5apache2_2.dll
#php4
#LoadFile g:\MyWeb\php4\dlls\libmysql.dll
#LoadFile g:\MyWeb\php4\dlls\libmhash.dll
#LoadFile g:\MyWeb\php4\dlls\libeay32.dll
#LoadFile g:\MyWeb\php4\dlls\ssleay32.dll
#LoadFile g:\MyWeb\php4\php4ts.dll
#LoadMole php4_mole g:\MyWeb\php4\sapi\php4apache2.dll
AddType application/x-httpd-php .php
DirectoryIndex index.html index.php