sudo apt-get install openssl-dev
on some systems, like Ubuntu Feisty, you might need to use this command:
sudo apt-get install libcurl3-openssl-dev
sudo ./configure --prefix=/usr/local/php --with-mysql --with-mysqli --with-pdo-mysql --enable-mysqlnd --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --with-curl --enable-fpm --with-mcrypt --with-openssl --with-mhash --enable-sockets --with-xmlrpc -enable-zip --enable-soap --enable-pcntl --enable-cli --with-gd
configure: error: Cannot find OpenSSL's sudo apt-get install libssl-dev find /usr/include -name evp.h
configure: error: png.h not found. sudo apt-get install libpng12-dev
refer: http://www.linuxdiyf.com/linux/15686.html configure: error: Cannot find ldap.h ls /usr/include/ldap.h sudo apt-get install ldap-utils、libldap2-dev sudo apt-get install slapd ldap-utils
configure: error: Cannot find ldap libraries in /usr/lib. sudo apt-get install php-ldap
php -i Configuration File (php.ini) Path => /usr/local/php/etc/ Loaded Configuration File(none) php --ini => 显示/usr/local/php, 这里复制php.ini,成功加载配制文件。
。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。 下面安装验证有效 。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
sudo ./configure --prefix=/usr/local/php/ --with-config-file-path=/usr/local/php/etc/ --enable-mbstring --enable-ftp --with-gd --with-jpeg-dir=/usr --with-png-dir=/usr --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl-dir=/usr --with-openssl --with-pdo-mysql=mysqlnd --with-pear --enable-sockets --with-freetype-dir=/usr --enable-gd-native-ttf --with-zlib --with-libxml-dir=/usr --with-xmlrpc --enable-fpm --enable-xml --with-iconv --enable-zip --with-freetype-dir=/usr/lib/ --enable-soap --enable-pcntl --enable-cli
sudo apt-get install libxml2-dev
libghc-zlib-dev libghc-bzlib-dev sudo apt-get install lib64z1-dev #sudo apt-get install openssl libssl-dev sudo apt-get install libcurl3-openssl-dev sudo apt-get instal libpng12-dev libjpeg-dev apt-get install libfreetype6-dev
sudo cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm sudo chmod+x /etc/init.d/php-fpm cd /usr/local//php/etc sudo cp php-fpm.conf.default php-fpm.conf sudo mv php-fpm.conf.default php-fpm.conf.default.bak sudo /etc/init.d/php-fpm start
准备PHP的配置文件: sudo cp -f php.ini-production /usr/local/php/etc/php.ini sudo chmod 644 /usr/local/php/etc/php.ini php –v
FastCGI sent in stderr: "Primary script unknown"的问题总的来说是无法找到对应的文件,除了路径外,还应该考虑下权限。下面是路径配制: location ~ .php$ { #root html; //这个要注释点 fastcgi_pass 127.0.0.1:9001; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; //访问的脚本绝对路径 include fastcgi_params; }
php-fpm相关命令: 启动 [root@localhost run]# /usr/local/php/sbin/php-fpm
关闭: [root@localhost run]# kill -INT cat/usr/local/php/var/run/php-fpm.pid
重启: [root@localhost run]# kill -USR2 cat/usr/local/php/var/run/php-fpm.pid
启动脚本: #!/bin/sh
# chkconfig: 2345 85 15
# Startup script for the php Web Server
# description: php is a World Wide Web server.
# It is used to serve HTML files and CGI.
# processname: php-fpm
# pidfile: /usr/local/php/var/run/php-fpm.pid # config: /usr/local/php/etc/php-fpm.conf
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="php-fpm deamon"
NAME=php-fpm
DAEMON=/usr/local/php/sbin/$NAME
SCRIPTNAME=/etc/init.d/$NAME
PIDFILE=/usr/local/php/var/run/$NAME.pid
test -x $DAEMON || exit 0
d_start(){
$DAEMON || echo -n "already running"
}
d_stop(){
kill -INT `cat $PIDFILE` || echo -n "not running"
}
d_reload(){
kill -USR2 `cat $PIDFILE` || echo -n "can not reload"
}
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
d_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
d_stop
echo "."
;;
reload)
echo -n "Reloading $DESC conf..."
d_reload
echo "reload ."
;;
restart)
echo -n "Restarting $DESC: $NAME"
d_stop
sleep 2
d_start
echo "."
;;
*)
echo "Usage: $ScRIPTNAME {start|stop|reload|restart}" >&2
exit 3
;;
esac
exit 0