安装php支持memcached的扩展模块:
安装php7.0
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install php70w.x86_64 php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64 php70w-mysql.x86_64 php70w-pdo.x86_64 php70w-devel zlib-devel -y
yum -y install php70w-fpm
yum install -y make gcc zlib-devel libmemcached-devel git
下载PHP Memcache 扩展包
yum install libmemcached -y
yum install php70w-pecl-memcached -y
安装nginx略,配置nginx的yum源。测试访问php的页面。
[root@memcached ~]# vim /etc/nginx/conf.d/nginx.conf
server {
listen 80;
server_name localhost;
location ~ \.php$ {
root /usr/share/nginx/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
编辑php页面
cd /usr/share/nginx/html/
vi index.php
phpinfo();
?>
启动nginx与php
systemctl start php-fpm
systemctl restart nginx
保存退出,重启php-fpm即可。
浏览器访问
192.168.96.133/index.php
image.png