ubuntu10.04使用源安装php-fpm
对于运维人员来说,如果没有特别的需求,用源安装无疑是大家最愿意的选择。
常见的vps都是ubuntu10.04,其源中没有php5-fpm,安装的时候会提示:
Reading state information... Done
E: Couldn't find package php5-fpm
解决办法
1. 添加非官方的源到 /etc/apt/sources.list
1 2 |
echo "deb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main" >> /etc/apt/sources.list echo "deb-src http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main" >> /etc/apt/sources.list |
2. 安装php5-fpm
1 |
sudo apt-get update && sudo apt-get install php5-fpm |
3. 安装php扩展组件
1 2 |
sudo apt-get install php-apc php5-curl php5-gd php5-imagick php5-mysql php5-memcache php5-memcached php5-mcrypt |
4. 启动php-fpm
1 |
sudo /etc/init.d/php5-fpm start |
php.in位于/etc/php5/fpm/php.ini
php-fpm.ini位于/etc/php5/fpm/php5-fpm.conf
------------------------------------------
php-fpm启动时报错
1 2 |
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/gd.so' - /usr/lib/php5/20060613+lfs/gd.so: undefined symbol: gdImageCreateFromJpeg in Unknown on line 0 |
locate libgd 查看gd的动态库位置,如果/usr/local/lib/目录里有则
1 |
rm /usr/local/lib/libgd* |
重启php-fpm即可
去掉php-fpm启动时警告提示信息
1 2 |
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/fpm/conf.d/imagick.ini on line 1 in Unknown on line 0 |
把#变成;即可去掉该提示