Chinaunix首页 | 论坛 | 博客
  • 博客访问: 622784
  • 博文数量: 142
  • 博客积分: 116
  • 博客等级: 入伍新兵
  • 技术积分: 1445
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-28 08:37
文章分类

全部博文(142)

文章存档

2017年(7)

2016年(57)

2015年(48)

2014年(30)

我的朋友

分类: PHP

2015-11-16 16:14:21

安装php

  1. MYSQL_HOME=/home/mysql/mysql
  2. ./configure --prefix=/home/php --enable-fpm --with-zlib \
  3. --enable-bcmath --enable-mbstring --enable-sockets --with-gettext=/usr \
  4. --with-png-dir=/usr --with-freetype-dir=/usr \
  5. --with-gd=/usr/local --with-t1lib=/usr \
  6. --with-xpm-dir=/usr --with-mysqli --with-mysql=${MYSQL_HOME}
  7. make
  8. make test
  9. make install

需要安装的依赖
  1. 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. sbin/php-fpm -c php.ini

编译过程中遇到的问题和解决方法:

1 gcc问题
  1. # ./configure
  2. checking for grep that handles long lines and -e... /usr/bin/grep
  3. checking for egrep... /usr/bin/grep -E
  4. checking for a sed that does not truncate output... /usr/bin/sed
  5. checking build system type... x86_64-unknown-linux-gnu
  6. checking host system type... x86_64-unknown-linux-gnu
  7. checking target system type... x86_64-unknown-linux-gnu
  8. checking for cc... cc
  9. checking whether the C compiler works... no
  10. configure: error: in `/home/soft/php-5.6.28':
  11. configure: error: C compiler cannot create executables
  12. See `config.log' for more details
使用gcc helloworld.c测试,发现失败。通过重装glibc-devel解决问题.
  1. yum reinstall glibc-devel

2 需要gd2

  1. checking for gdSetErrorMethod in -lgd... no
  2. configure: error: Unable to find libgd.(a|so) >= 2.1.0 anywhere under /usr
系统中安装了gd,这里需要gd2,而yum源中是没有gd2的。需要手工安装。
下载libgd-2.1.1.tar.gz

  1. tar xzf libgd-2.1.1.tar.gz
  2. cd libgd-2.1.1
  3. ./configure
  4. make
  5. make install
默认的prefix是/usr/local。所以configure中指定  --with-gd=/usr/local


3 找不到mysqlclient

  1. checking for MySQL support... yes
  2. checking for specified location of the MySQL UNIX socket... no
  3. configure: error: Cannot find libmysqlclient under /home/mysql/mysql.
  4. 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

  1. yum install pcre pcre-devel openssl-devel geoip geoip-devel
  2. ./configure --prefix=/home/nginx --with-http_ssl_module --with-http_geoip_module --with-stream_geoip_module
  3. make
  4. make install

  1. location / {
  2.     root html;
  3.     index index.html index.htm index.php;
  4. }
  5. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  6. #
  7. location ~ \.php$ {
  8.     root html;
  9.     fastcgi_pass 127.0.0.1:9000;
  10.     fastcgi_index index.php;
  11.     #fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  12.     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  13.     include fastcgi_params;
  14. }

  1. sbin/nginx

cat > html/phpinfo.php <
EOF


阅读(1159) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~