php:
一.官网下载php-7.4.6.tar.bz2
阿里云下载安装包oniguruma-6.8.2-1.el7.x86_64.rpm oniguruma-devel-6.8.2-1.el7.x86_64.rpm
yum install -y bzip2
tar jxf php-7.4.6.tar.bz2
cd php-7.4.6
yum install -y systemd-devel
yum install -y libxml2-devel
yum install -y sqlite-devel
yum install -y libcurl-devel
yum install -y libpng-devel
yum install -y oniguruma-6.8.2-1.el7.x86_64.rpm oniguruma-devel-6.8.2-1.el7.x86_64.rpm
./configure --prefix=/usr/local/lnmp/php --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --with-curl --with-iconv --with-mhash --with-zlib --with-openssl --enable-mysqlnd --with-mysqli --with-pdo-mysql --disable-debug --enable-sockets --enable-soap --enable-inline-optimization --enable-xml --enable-ftp --enable-gd --enable-exif --enable-mbstring --enable-bcmath --with-fpm-systemd
make
make install
二.将nginx和php结合
vim /usr/local/lnmp/nginx/conf/nginx.conf
在server字段下
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
include fastcgi.conf;
}
vim /usr/local/lnmp/nginx/html/index.php
<?php
phpinfo()
?>
测试:
cd /root/php-7.4.6/
cp php.ini-production /usr/local/lnmp/php/lib/php.ini
cd /root/php-7.4.6/sapi/fpm/
cp init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/etc/init.d/php-fpm
cd /usr/local/lnmp/php/etc/
cp php-fpm.conf.default php-fpm.conf
cd /usr/local/lnmp/php/etc/php-fpm.d
cp www.conf.default www.conf
/etc/init.d/php-fpm start
nginx -s reload
三.高速缓存系统
官网下载memcache 4.0.5.2 tgz
yum install -y autoconf
tar zxf memcache 4.0.5.2 tgz
cd memcache 4.0.5.2
/usr/local/lnmp/php/bin/phpize
./congigure
make
make install
vi /usr/local/lnmp/php/lib/php.ini
添加一行
extension=memcache.so
/etc/init.d/php-fpm reload 加载php
测试:
cd /memcache-4.0.5.2
/usr/local/lnmp/php/bin/php -m | grep memcache
过滤是否有memcache这个资源
四.做监控页面memecache.php
yum install -y memcached
systemctl start memcached
cd memcache-4.0.5.2
cp memcache.php example.php /usr/local/lnmp/nginx/html/
cd /usr/local/lnmp/nginx/html/
vim memache.php
$MEMCACHE_SERVERS[] = '127.0.0.1:11211'; // add more as an array
#$MEMCACHE_SERVERS[] = 'mymemcache-server2:11211'; // add more as an array