安装php
-
MYSQL_HOME=/home/mysql/mysql
-
-
./configure --prefix=/home/php --enable-fpm --with-zlib \
-
--enable-bcmath --enable-mbstring --enable-sockets --with-gettext=/usr \
-
--with-png-dir=/usr --with-freetype-dir=/usr \
-
--with-gd=/usr/local --with-t1lib=/usr \
-
--with-xpm-dir=/usr --with-mysqli --with-mysql=${MYSQL_HOME}
-
-
make
-
make test
-
make install
需要安装的依赖
-
yum install gd gd-devel libxml2 libxml2-devel t1lib t1lib-devel
配置php.ini和php-fpm.conf
php.ini可以参考源代码目录下的php.ini-production,
php-fpm.conf可以参考安装目录下的php-fpm.conf.default
启动php-fpm:
编译过程中遇到的问题和解决方法:
1 gcc问题
-
# ./configure
-
checking for grep that handles long lines and -e... /usr/bin/grep
-
checking for egrep... /usr/bin/grep -E
-
checking for a sed that does not truncate output... /usr/bin/sed
-
checking build system type... x86_64-unknown-linux-gnu
-
checking host system type... x86_64-unknown-linux-gnu
-
checking target system type... x86_64-unknown-linux-gnu
-
checking for cc... cc
-
checking whether the C compiler works... no
-
configure: error: in `/home/soft/php-5.6.28':
-
configure: error: C compiler cannot create executables
-
See `config.log' for more details
使用gcc helloworld.c测试,发现失败。通过重装glibc-devel解决问题.
-
yum reinstall glibc-devel
2 需要gd2
-
checking for gdSetErrorMethod in -lgd... no
-
configure: error: Unable to find libgd.(a|so) >= 2.1.0 anywhere under /usr
系统中安装了gd,这里需要gd2,而yum源中是没有gd2的。需要手工安装。
下载libgd-2.1.1.tar.gz
-
tar xzf libgd-2.1.1.tar.gz
-
cd libgd-2.1.1
-
./configure
-
make
-
make install
默认的prefix是/usr/local。所以configure中指定
--with-gd=/usr/local
3 找不到mysqlclient
-
checking for MySQL support... yes
-
checking for specified location of the MySQL UNIX socket... no
-
configure: error: Cannot find libmysqlclient under /home/mysql/mysql.
-
Note that the MySQL client library is not bundled anymore!
由于系统中安装的是PerconaServer,不是社区版的mysql,
而Percona为避免覆盖已有的libmysqlclient,把名字改为了libperconaserverclient,结果导致编译时找不到libmysqlclient。
通过建立链接解决:
cd /home/mysql/mysql/lib
ln -s libperconaserverclient.so.20.2.0 libmysqlclient.so
安装nginx,设置php-fpm
-
yum install pcre pcre-devel openssl-devel geoip geoip-devel
-
./configure --prefix=/home/nginx --with-http_ssl_module --with-http_geoip_module --with-stream_geoip_module
-
make
-
make install
-
location / {
-
root html;
-
index index.html index.htm index.php;
-
}
-
-
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
-
#
-
location ~ \.php$ {
-
root html;
-
fastcgi_pass 127.0.0.1:9000;
-
fastcgi_index index.php;
-
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
-
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
-
include fastcgi_params;
-
}
-
-
sbin/nginx
cat > html/phpinfo.php <
EOF
阅读(1199) | 评论(0) | 转发(0) |