lnmp 现装mysql 后装 php nginx最后装
php安装
-
wget http://mirrors.sohu.com/php/php-5.4.37.tar.bz2 下载php
-
tar -jxf http://mirrors.sohu.com/php/php-5.4.37.tar.bz2 解压
-
cd php-5.4.37 进入解压过的php
-
./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --disable-ipv6 --with-curl --with-openssl --with-pear 初始化 如果安装过lamp之后php的路径如果放在一起会覆盖掉之前的,所以需要指定新的路径 “--prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc” 这两个指定路径的改一下。
指定了php_fpm , 别忘了创建这个用户不然初始化找不到 useradd -s php-fpm /sbin/nologin初始化过程中可能遇见的错误:
错误:error: Please reinstall the libcurl distribution - easy.h should be in /include/curl/
解决方法: yum -y install curl curl-devel错误: freetype-config not found.
解决方法:yum -y install freetype-devel
-
make && make install
-
ls /usr/local/php-fpm安装之后可以查看一下
- /bin/ls /usr/local/php /usr/local/php-fpm 如果装过一个lamp的php了可以比较一下新装的
-
cp php.ini-development /usr/local/php-fpm/etc/php.ini 拷贝配置文件
(1)、 php.ini-production 生产环境下使用
(2)、php.ini-development 测试或开发环境下使用
-
cp /usr/local/src/php-5.4.37/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 拷贝、定义启动脚本
-
chmod 755 /etc/init.d/php-fpm 更改权限 让它可执行
-
mv -v /usr/local/php-fpm/etc/{php-fpm.conf.default,php-fpm.conf} 拷贝、更改配置文件
- vim /usr/local/php-fpm/etc/php-fpm.conf 如果需求是将lamp架构换成lnmp ,修改成apache指定的用户和group ,
使用 ps aux | grep httpd 查看apache的启动服务的用户
-
chkconfig --add php-fpm 加入到服务列表
-
chkconfig on 开机启动
- service php-fpm restart 重启服务