解决安装新php后网站不能打开

主要有2个原因:

  1. Memcache不能绑定到新的php
  2. 编译PHP时没有安装mysql-pdo

解决办法:

先重新编译memcache

先将Memcached暂停 /etc/init.d/memcached stop ,然后进入memcache源代码目录,运行以下

1
2
3
4
5
6
tar zxvf memcache-2.2.5.tgz
cd memcache-2.2.5/
/usr/local/webserver/php/bin/phpize
./configure --with-php-config=/usr/local/webserver/php/bin/php-config
make
make install

修改php.ini文件 查找 /usr/local/webserver/php/etc/php.ini 中的 extension_dir = "./" 修改为

extension_dir = "/usr/local/webserver/php/lib/php/extensions/no-debug-non-zts-20090626/"
extension = "memcache.so"

重启memcache

/etc/init.d/memcached start

重新编译php

先暂停php-fpm,再进入php源码目录运行

1
2
3
4
./configure --prefix=/usr/local/webserver/php --with-config-file-path=/usr/local/webserver/php/etc --with-mysql=/usr/local/webserver/mysql --with-mysqli=/usr/local/webserver/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pdo-mysql
make ZEND_EXTRA_LIBS='-liconv'
make install