LNMP架构介绍,php安装

LNMP架构介绍

访问静态文件多的网页,nginx比apache快很多,支持高并发。

mysql安装

php安装

useradd php-fpm

先安装yum install libcurl-devel -y

  • 解压后,进入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-dpo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --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-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif

  • make && make install
  • cp php.ini-production  /usr/local/php-fpm/etc/php.ini
  • vi /usr/local/php-fpm/etc/php-fpm.conf
[global]
pid = /usr/local/php-fpm/var/run/php-fpm.pid
error_log = /usr/local/php-fpm/var/log/php-fpm.log
[www]
listen = /tmp/php-fcgi.sock
listen.mode = 666
user = php-fpm
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
  • cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm 复制启动脚本
  • chmod 755 /etc/init.d/php-fpm
  •  chkconfig --add php-fpm  添加开机启动
     chkconfig php-fpm on
     service php-fpm start 启动php-fpm

成功开启!

猜你喜欢

转载自my.oschina.net/u/3771583/blog/1800629