天天看點

centos7 安裝apache+php+memcache

安裝apache yum install pcre-devel apr apr-devel apr-util apr-util-devel gcc-c++ libxml2-devel libxml2 perl perl-devel   ./configure \ --prefix=/usr/local/apache/ \ --enable-so \ --enable-deflate=shared \ --enable-expires=shared \ --enable-rewrite=shared \ --enable-static-support   安裝php yum -y install php-mcrypt libmcrypt libmcrypt-devel autoconf freetype gd jpegsrc libmcrypt libpng libpng-devel libjpeg libxml2 libxml2-devel zlib curl curl-devel   ./configure \ --prefix=/usr/local/php7/ \ --with-apxs2=/usr/local/apache/bin/apxs \ --enable-mbstring \ --with-curl \ --with-gd \ --enable-fpm \ --enable-mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-config-file-path=/usr/local/php/etc/ \ --with-mysqli=mysqlnd   cp php.ini-development /usr/local/php/etc/php.ini     報錯: Sorry, I cannot run apxs. Possible reasons follow: 1. Perl is not installed 2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs 3. Apache was not built using --enable-so (the apxs usage page is displayed)   解決步驟: 1、根據不能run apxs 。cd 到apache的bin目錄下運作./apxs 運作結果 ---------------------------------------------------- bash: ./apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory --------------------------------------------------------- 2、vim apxs檔案 找“/replace/with/path/to/perl/interpreter”關鍵字 在第一個行 :#!/replace/with/path/to/perl/interpreter -w 根據perl的安裝目錄 /usr/bin/perl 修改為:#! /usr/bin/perl -w 3、運作第一步。或者直接 ./configure ^^^^^     安裝memecach 第一步:安裝libevent # tar zvxf libevent-2.1.8-stable.tar.gz # cd libevent-2.1.8-stable # ./configure --prefix=/usr/local/libevent # make # make install # cd /usr/lib64 # ln -s /usr/local/libevent/lib/libevent-2.1.so.6   第二步:安裝memecached # tar zxvf memcached-1.4.35.tar.gz # cd memcached-1.4.35 # ./configure --prefix=/usr/local/memcached # make # make install   第三步:啟動 # cd /usr/local/memcached/bin # ./memcached -d -u root   第四部:測試 1.檢視程序 # ps -ef|grep memcached |grep -v grep   2.檢視端口 # lsof -i:11211   3.telnet測試 # telnet 192.168.6.128 11211   輸入:stats 傳回:     至此memecached安裝成功。   配置PHP的memecached擴充 php的memcached擴充是基于libmemcached,是以要先安裝libmemcached 安裝libmemcached wget https://launchpad.net/libmemcached/1.0/1.0.18/+download/libmemcached-1.0.18.tar.gz ./configure --prefix=/usr/lib/libmemcached make && make install   安裝php-memcached-php7 ./configure --enable-memcached --with-php-config=/usr/local/php7/bin/php-config --with-libmemcached-dir=/usr/lib/libmemcached/ --disable-memcached-sasl make && make install   重新開機apache

轉載于:https://www.cnblogs.com/yl-2016/p/7149557.html