LAMP架构
预习笔记
11.25 配置防盗链
11.26 访问控制Directory
11.27 访问控制FilesMatch
11.28 限定某个目录禁止解析php
11.29 限制user_agent
11.30/11.31 php相关配置
11.32 php扩展模块安装
扩展
几种限制ip的方法 http://ask.apelearn.com/question/6519
apache 配置https 支持ssl http://ask.apelearn.com/question/1029
apache rewrite教程 http://coffeelet.blog.163.com/blog/static/13515745320115842755199/ http://www.cnblogs.com/top5/archive/2009/08/12/1544098.html
apache rewrite 出现死循环 http://ask.apelearn.com/question/1043
php错误日志级别参考 http://ask.apelearn.com/question/6973
1.配置防盗链
防盗链,通俗讲就是不让别人盗用你网站上的资源,这个资源指的是图片、视频、歌曲、文档等,在这之前需要理解一下referer的概念,如果你通过A网站的一个页面http://a.com/a.html里面的链接去访问B网站的一个页面http://b.com/b.html,那么这个B网站页面的referer就是http://a.com/a.html。也就是说,一个referer就是一个网址。
1.1 修改配置文件
SetEnvIfNoCase Referer “http://111.com” local_ref // 定义允许访问链接的referer
SetEnvIfNoCase Referer “http://ask.apelearn.com” local_ref
SetEnvIfNoCase Referer “^$” local_ref //把空referer设为白名单,即直接访问的地址
<FilesMatch “.(txt|doc|mp3|zip|rar|jpg|gif|png)”> Order Allow,Deny
//白名单地址allow,其他deny Allow from env=local_ref // 白名单为local_ref对应的地址
</FilesMatch>
[root@linux-001 src]# vim /usr/local/httpd2.4/conf/extra/httpd-vhosts.conf
#配置防盗链
<Directory /data/wwwroot/xihaji.com>
SetEnvIfNoCase Referer "http://xihaji.com" local_ref
SetEnvIfNoCase Referer "http://www.baidu.com" local_ref
SetEnvIfNoCase Referer "^$" local_ref
<FilesMatch "\.(txt|doc|mp3|zip|rar|jpg|gif|png)">
Order Allow,Deny
Allow from env=local_ref
</FilesMatch>
</Directory>
1.2 配置文件重新加载
[root@linux-001 src]# /usr/local/httpd2.4/bin/apachectl -t
Syntax OK
[root@linux-001 src]# /usr/local/httpd2.4/bin/apachectl graceful
1.3 测试结果
[root@linux-001 src]# curl -x127.0.0.1:80 -I xihaji.com/ppp.jpg
HTTP/1.1 200 OK
Date: Fri, 10 May 2019 02:47:17 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
Last-Modified: Wed, 13 Mar 2019 08:58:45 GMT
ETag: "6f8446-583f6035a5b40"
Accept-Ranges: bytes
Content-Length: 7308358
Cache-Control: max-age=86400
Expires: Sat, 11 May 2019 02:47:17 GMT
Content-Type: image/jpeg
## curl -e选项可以指定referer ##
[root@linux-001 src]# curl -e "http://www.csdn.net/" -x192.168.141.128:80 -I xihaji.com/ppp.jpg
HTTP/1.1 403 Forbidden
Date: Fri, 10 May 2019 03:04:53 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
Content-Type: text/html; charset=iso-8859-1
[root@linux-001 src]# curl -e "http://www.baidu.com/" -x192.168.141.128:80 -I xihaji.com/ppp.jpg
HTTP/1.1 200 OK
Date: Fri, 10 May 2019 03:05:02 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
Last-Modified: Wed, 13 Mar 2019 08:58:45 GMT
ETag: "6f8446-583f6035a5b40"
Accept-Ranges: bytes
Content-Length: 7308358
Cache-Control: max-age=86400
Expires: Sat, 11 May 2019 03:05:02 GMT
Content-Type: image/jpeg
[root@linux-001 src]#
在csdn的网站上加入服务器的地址,在打开的时候发现无法打开,是由于设置了referer,导致无法访问。
2.配置访问控制directory
对于一些比较重要的网站内容,除了可以使用用户认证限制访问之外,还可以通过其他一些方法做到限制,比如限制IP,也可以限制user_agent。限制IP指的是限制访问网址的来源IP,而限制user_agent,通常用来限制恶意或者不正常的请求。
2.1 修改配置文件
[root@linux-001 src]# vim /usr/local/httpd2.4/conf/extra/httpd-vhosts.conf
# 配置访问控制
<Directory /data/wwwroot/xihaji.com/admin/>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Directory>
[root@linux-001 src]# mkdir /data/wwwroot/xihaji.com/admin/
[root@linux-001 src]# vim /data/wwwroot/xihaji.com/admin/index.php
[root@linux-001 src]# /usr/local/httpd2.4/bin/apachectl -t
Syntax OK
[root@linux-001 src]# /usr/local/httpd2.4/bin/apachectl graceful
[root@linux-001 src]#
2.2 测试结果
[root@linux-001 src]# curl -x127.0.0.1:80 www.xihaji.com/admin/index.php -I
HTTP/1.1 200 OK
Date: Fri, 10 May 2019 06:37:03 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
X-Powered-By: PHP/5.6.39
Cache-Control: max-age=0
Expires: Fri, 10 May 2019 06:37:03 GMT
Content-Type: text/html; charset=UTF-8
3.访问控制FilesMatch
3.1 修改配置文件
编辑虚拟主机配置文件,进行FilesMatch配置:既要匹配文件,又要限制IP。
[root@linux-001 src]# vim /usr/local/httpd2.4/conf/extra/httpd-vhosts.conf
# 配置访问控制以及文件控制
<Directory /data/wwwroot/xihaji.com/admin/>
<FilesMatch "admin.php(.*)">
Order deny,allow
Deny from all
Allow from 127.0.0.1
</FilesMatch>
</Directory>
[root@linux-001 src]# /usr/local/httpd2.4/bin/apachectl -t
Syntax OK
[root@linux-001 src]# /usr/local/httpd2.4/bin/apachectl graceful
[root@linux-001 src]#
3.2 测试结果
[root@linux-001 src]# curl -x127.0.0.1:80 xihaji.com/admin/111.php? -I
HTTP/1.1 404 Not Found
Date: Fri, 10 May 2019 09:00:46 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
Content-Type: text/html; charset=iso-8859-1
[root@linux-001 src]# touch /data/wwwroot/xihaji.com/admin/111.php
[root@linux-001 src]# curl -x127.0.0.1:80 xihaji.com/admin/111.php? -I
HTTP/1.1 200 OK
Date: Fri, 10 May 2019 09:01:21 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
X-Powered-By: PHP/5.6.39
Cache-Control: max-age=0
Expires: Fri, 10 May 2019 09:01:21 GMT
Content-Type: text/html; charset=UTF-8
[root@linux-001 src]# curl -x192.168.141.128:80 xihaji.com/admin/111.php? -I
HTTP/1.1 403 Forbidden
Date: Fri, 10 May 2019 09:01:53 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
Content-Type: text/html; charset=iso-8859-1
[root@linux-001 src]#
4.限定某个目录禁止解析php
有这样一种情况,有些站点和论坛是允许上传图片到服务器,他们上传一些php或者js到服务器,然后被我们执行加载,从而对数据造成威胁。 为了避免这种事情的发生,我们需要限制上传类型。
4.1 修改配置文件
[root@linux-001 src]# vim /usr/local/httpd2.4/conf/extra/httpd-vhosts.conf
# 限定某个目录禁止解析php
</Directory>
<Directory /data/wwwroot/xihaji.com/upload>
php_admin_flag engine off
</Directory>
[root@linux-001 src]# /usr/local/httpd2.4/bin/apachectl -t
Syntax OK
[root@linux-001 src]# /usr/local/httpd2.4/bin/apachectl graceful
[root@linux-001 src]#
[root@linux-001 src]# mkdir /data/wwwroot/xihaji.com/upload
[root@linux-001 src]# ls /data/wwwroot/xihaji.com/
1.php 2.txt admin index.php ppp.jpg upload
[root@linux-001 src]# cp /data/wwwroot/xihaji.com/index.php /data/wwwroot/xihaji.com/upload/
[root@linux-001 src]# vim /data/wwwroot/xihaji.com/upload/index.php
4.2 测试结果
[root@linux-001 src]# curl -x127.0.0.1:80 xihaji.com/upload/index.php
<?php
echo '12345678'
[root@linux-001 src]#
4.3 在限制php解析的时候也可添加php文件禁止访问
[root@linux-001 src]# vim /usr/local/httpd2.4/conf/extra/httpd-vhosts.conf
# 限定某个目录禁止解析php,php文件禁止访问
</Directory>
<Directory /data/wwwroot/xihaji.com/upload>
php_admin_flag engine off
<FilesMatch (.*)\.php(.*)>
Order deny,allow
Deny from all
</FilesMatch>
</Directory>
[root@linux-001 src]# /usr/local/httpd2.4/bin/apachectl -t
Syntax OK
[root@linux-001 src]# /usr/local/httpd2.4/bin/apachectl graceful
[root@linux-001 src]#
4.4 测试结果
通过4.3的配置,这样的结果就是php无法访问,状态码403。
[root@linux-001 src]# curl -x127.0.0.1:80 xihaji.com/upload/1.php
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /upload/1.php
on this server.<br />
</p>
</body></html>
[root@linux-001 src]# curl -x127.0.0.1:80 xihaji.com/upload/1.php -I
HTTP/1.1 403 Forbidden
Date: Fri, 10 May 2019 09:55:54 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
Content-Type: text/html; charset=iso-8859-1
[root@linux-001 src]#
5.限制user_agent
User Agent中文名为用户代理,简称 UA,它是一个特殊字符串头,使得服务器能够识别客户使用的操作系统及版本、CPU 类型、浏览器及版本、浏览器渲染引擎、浏览器语言、浏览器插件等。
5.1 修改配置文件
[root@linux-001 src]# vim /usr/local/httpd2.4/conf/extra/httpd-vhosts.conf
# 限定user_agent
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} .*curl.* [NC,OR]
RewriteCond %{HTTP_USER_AGENT} .*baidu.com.* [NC]
RewriteRule .* - [F]
</IfModule>
5.2 查看结果
-A 选项可以设置 user_agent
[root@linux-001 src]# ls /data/wwwroot/xihaji.com/
1.php 2.txt admin index.php ppp.jpg upload
[root@linux-001 src]# curl -x127.0.0.1:80 xihaji.com/ppp.jpg -I
HTTP/1.1 403 Forbidden
Date: Fri, 10 May 2019 10:20:02 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
Content-Type: text/html; charset=iso-8859-1
[root@linux-001 src]# curl -A "xihaji xihaji" -x127.0.0.1:80 xihaji.com/ppp.jpg -I
HTTP/1.1 200 OK
Date: Fri, 10 May 2019 10:18:41 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
Last-Modified: Wed, 13 Mar 2019 08:58:45 GMT
ETag: "6f8446-583f6035a5b40"
Accept-Ranges: bytes
Content-Length: 7308358
Cache-Control: max-age=86400
Expires: Sat, 11 May 2019 10:18:41 GMT
Content-Type: image/jpeg
[root@linux-001 src]# tail /usr/local/httpd2.4/logs/xihaji-access_log_20190510_log
127.0.0.1 - - [10/May/2019:17:55:50 +0800] "GET HTTP://xihaji.com/upload/1.php HTTP/1.1" 403 221 "-" "curl/7.29.0"
127.0.0.1 - - [10/May/2019:17:55:54 +0800] "HEAD HTTP://xihaji.com/upload/1.php HTTP/1.1" 403 - "-" "curl/7.29.0"
127.0.0.1 - - [10/May/2019:18:17:07 +0800] "GET HTTP://xihaji.com/upload/1.php HTTP/1.1" 403 221 "-" "curl/7.29.0"
127.0.0.1 - - [10/May/2019:18:17:11 +0800] "GET HTTP://xihaji.com/upload/1.php HTTP/1.1" 403 221 "-" "curl/7.29.0"
127.0.0.1 - - [10/May/2019:18:17:43 +0800] "GET HTTP://xihaji.com/upload/1.php HTTP/1.1" 403 221 "-" "xihaji"
127.0.0.1 - - [10/May/2019:18:17:47 +0800] "GET HTTP://xihaji.com/upload/1.php HTTP/1.1" 403 221 "-" "xihaji"
127.0.0.1 - - [10/May/2019:18:18:03 +0800] "GET HTTP://xihaji.com/upload/1.php HTTP/1.1" 403 221 "-" "xihaji xihaji"
127.0.0.1 - - [10/May/2019:18:18:41 +0800] "HEAD HTTP://xihaji.com/ppp.jpg HTTP/1.1" 200 - "-" "xihaji xihaji"
127.0.0.1 - - [10/May/2019:18:20:02 +0800] "HEAD HTTP://xihaji.com/ppp.jpg HTTP/1.1" 403 - "-" "curl/7.29.0"
127.0.0.1 - - [10/May/2019:18:21:35 +0800] "HEAD HTTP://xihaji.com/ppp.jpg HTTP/1.1" 200 - "-" "xihaji"
[root@linux-001 src]#
6.php相关配置
6.1 php的配置文件查看
方法一:可以使用/usr/local/php/bin/php -i|grep -i “loaded configuration file” ,但是这个方法有些时候并不准确。
[root@linux-001 src]# /usr/local/php/bin/php -i|grep -i "loaded configuration file"
PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
Loaded Configuration File => /usr/local/php/etc/php.ini
[root@linux-001 src]#
方法二:使用phpinfo函数查看,这方法准确,需要利用浏览器打开,我们可以虚拟主机的目录中创建一个php文件,文件内容写入phpinfo(),打印出信息,里面显示很多详细的信息。
6.2 php配置文件关闭一些危险函数
如上图的phpinfo显示出虚拟主机的很多信息,这个信息若被黑客利用,那对我们的系统不是很安全。这就涉及到了一个php配置文件中的函数 disable_functions
6.2.1 修改php配置中的disable_functions
[root@linux-001 xihaji.com]# vim /usr/local/php/etc/php.ini
disable_functions = eval,assert,popen,passthru,escapeshellarg,escapeshellcmd,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server,popen,proc_open,proc_close,phpinfo
[root@linux-001 xihaji.com]# /usr/local/httpd2.4/bin/apachectl graceful
6.2.2 查看网站结果
这时候打开网站发现phpinfo的信息已经没有显示。
由于我在前面apache的虚拟主机配置文件中把user_agent给限制了,所以加-A 设置另外一个user_agent。
[root@linux-001 xihaji.com]# curl -A "xihaji" -x127.0.0.1:80 www.xihaji.com -I
HTTP/1.1 200 OK
Date: Fri, 10 May 2019 11:19:42 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
X-Powered-By: PHP/5.6.39
Cache-Control: max-age=0
Expires: Fri, 10 May 2019 11:19:42 GMT
Content-Type: text/html; charset=UTF-8
6.2.3 修改php配置中的display_errors
如上图虽然没有显示phpinfo的信息,但是,屏幕上显示的警告信息还是会泄露主机的信息。这时候我们需要去修改php配置文件中的 display_errors = On ,需要修改为display_errors = Off
6.2.4 查看网站信息
这时候我们再去访问域名,发现域名是白的,没有任何信息。
[root@linux-001 xihaji.com]# curl -A "xihaji" -x127.0.0.1:80 www.xihaji.com -I
HTTP/1.1 200 OK
Date: Fri, 10 May 2019 11:24:12 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
X-Powered-By: PHP/5.6.39
Cache-Control: max-age=0
Expires: Fri, 10 May 2019 11:24:12 GMT
Content-Type: text/html; charset=UTF-8
[root@linux-001 xihaji.com]#
6.3 php的错误日志定义
虽然免除了危险,但是对于我们管理员来说,这个页面,不友好,无法判断此页面;此时需要设置错误日志
6.3.1 开启php错误日志log_errors = On
6.3.2 php中错误日志的级别
如下图是错误日志的级别显示,生产环境当中,最常用的错误级别是 error_reporting = E_ALL & ~E_NOTICE
6.3.3 php错误日志的存储位置error_log =/tmp/php_errors.log
6.3.4 查看php错误日志报错信息
前面我们已经配置了错误日志的信息,现在我们刷新浏览器访问域名,来查看错误日志信息,错误日志信息提示警告,phpinfo函数已经被禁用了。查看看这个错误日志的权限,发现为daemon;说明跟httpd配置文件相关。
[root@linux-001 xihaji.com]# ls /tmp/
mysql.sock pear php_errors.log vmware-root_6265-1715279340 vmware-root_6444-1002551495
[root@linux-001 xihaji.com]# cat /tmp/php_errors.log
[10-May-2019 11:31:45 UTC] PHP Warning: phpinfo() has been disabled for security reasons in /data/wwwroot/xihaji.com/index.php on line 2
[10-May-2019 11:31:45 UTC] PHP Warning: phpinfo() has been disabled for security reasons in /data/wwwroot/xihaji.com/index.php on line 2
[root@linux-001 xihaji.com]# ll /tmp/php_errors.log
-rw-r--r-- 1 daemon daemon 276 5月 10 19:31 /tmp/php_errors.log
[root@linux-001 xihaji.com]# ps aux|grep http
root 76064 0.0 0.6 258024 12872 ? Ss 5月09 0:08 /usr/local/httpd2.4/bin/httpd -k start
root 82142 0.0 0.0 21716 940 ? S 19:31 0:00 /usr/local/httpd2.4/bin/rotatelogs -l logs/xihaji-access_log_%Y%m%d_log 86400
daemon 82143 0.0 0.7 675924 13224 ? Sl 19:31 0:00 /usr/local/httpd2.4/bin/httpd -k start
daemon 82144 0.0 0.5 544852 9480 ? Sl 19:31 0:00 /usr/local/httpd2.4/bin/httpd -k start
daemon 82203 0.0 0.5 610388 9480 ? Sl 19:31 0:00 /usr/local/httpd2.4/bin/httpd -k start
root 82278 0.0 0.0 112724 988 pts/0 R+ 19:39 0:00 grep --color=auto http
[root@linux-001 xihaji.com]#
6.3.5 出现500状态码
如果我们的php文件当中无法被php解析,也会显示空白,查看状态码发现是500.
[root@linux-001 xihaji.com]# curl -A "xihaji" -x127.0.0.1:80 www.xihaji.com/1.php
[root@linux-001 xihaji.com]# curl -A "xihaji" -x127.0.0.1:80 www.xihaji.com/1.php -I
HTTP/1.0 500 Internal Server Error
Date: Fri, 10 May 2019 11:42:22 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
X-Powered-By: PHP/5.6.39
Connection: close
Content-Type: text/html; charset=UTF-8
[root@linux-001 xihaji.com]# cat /tmp/php_errors.log
[10-May-2019 11:31:45 UTC] PHP Warning: phpinfo() has been disabled for security reasons in /data/wwwroot/xihaji.com/index.php on line 2
[10-May-2019 11:31:45 UTC] PHP Warning: phpinfo() has been disabled for security reasons in /data/wwwroot/xihaji.com/index.php on line 2
[10-May-2019 11:39:56 UTC] PHP Warning: phpinfo() has been disabled for security reasons in /data/wwwroot/xihaji.com/index.php on line 2
[10-May-2019 11:42:18 UTC] PHP Parse error: syntax error, unexpected end of file in /data/wwwroot/xihaji.com/1.php on line 4
[10-May-2019 11:42:22 UTC] PHP Parse error: syntax error, unexpected end of file in /data/wwwroot/xihaji.com/1.php on line 4
[root@linux-001 xihaji.com]#
6.3 限定一个虚拟主机所能访问的目录open_basedir
6.3.1 给虚拟主机添加配置open_basedir
6.3.2 测试结果
修改虚拟主机中配置段,open_basedir 为虚拟主机目录外的一个目录位置,我们来测试下,发现500代码,再去查看日志,发现提示error。同理,如果我们去修改php配置文件中的open_basedir ,其实是没有什么效果,除非虚拟主机中只有一个主机,多个主机是无法再php配置文件中做open_basedir设置的。
[root@linux-001 xihaji.com]# curl -A 'xihaji' -x127.0.0.1:80 www.xihaji.com/1.php -I
HTTP/1.0 500 Internal Server Error
Date: Fri, 10 May 2019 12:06:00 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
X-Powered-By: PHP/5.6.39
Connection: close
Content-Type: text/html; charset=UTF-8
[root@linux-001 xihaji.com]# tail /tmp/php_errors.log
[10-May-2019 11:31:45 UTC] PHP Warning: phpinfo() has been disabled for security reasons in /data/wwwroot/xihaji.com/index.php on line 2
[10-May-2019 11:31:45 UTC] PHP Warning: phpinfo() has been disabled for security reasons in /data/wwwroot/xihaji.com/index.php on line 2
[10-May-2019 11:39:56 UTC] PHP Warning: phpinfo() has been disabled for security reasons in /data/wwwroot/xihaji.com/index.php on line 2
[10-May-2019 11:42:18 UTC] PHP Parse error: syntax error, unexpected end of file in /data/wwwroot/xihaji.com/1.php on line 4
[10-May-2019 11:42:22 UTC] PHP Parse error: syntax error, unexpected end of file in /data/wwwroot/xihaji.com/1.php on line 4
[10-May-2019 12:03:44 UTC] PHP Parse error: syntax error, unexpected end of file in /data/wwwroot/xihaji.com/1.php on line 4
[10-May-2019 12:06:00 UTC] PHP Warning: Unknown: open_basedir restriction in effect. File(/data/wwwroot/xihaji.com/1.php) is not within the allowed path(s): (/data/wwwroot/1xihaji.com:/tmp/) in Unknown on line 0
[10-May-2019 12:06:00 UTC] PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
[10-May-2019 12:06:00 UTC] PHP Fatal error: Unknown: Failed opening required '/data/wwwroot/xihaji.com/1.php' (include_path='.:/usr/local/php/lib/php') in Unknown on line 0
[root@linux-001 xihaji.com]#
6.3.3 修改回虚拟机中配置文的open_basedir
6.3.4 测试结果
[root@linux-001 xihaji.com]# cat 1.php
<?php
echo "text wenjian !";
[root@linux-001 xihaji.com]# curl -A 'xihaji' -x127.0.0.1:80 www.xihaji.com/1.php
text wenjian !
[root@linux-001 xihaji.com]# curl -A 'xihaji' -x127.0.0.1:80 www.xihaji.com/1.php -I
HTTP/1.1 200 OK
Date: Fri, 10 May 2019 12:04:14 GMT
Server: Apache/2.4.39 (Unix) PHP/5.6.39
X-Powered-By: PHP/5.6.39
Cache-Control: max-age=0
Expires: Fri, 10 May 2019 12:04:14 GMT
Content-Type: text/html; charset=UTF-8
6.4 php扩展模块添加
6.4.1 下载redis的扩展模块
[root@linux-001 php-5.6.39]# cd /usr/local/src/
[root@linux-001 src]# wget https://codeload.github.com/phpredis/phpredis/zip/develop
--2019-05-10 20:33:39-- https://codeload.github.com/phpredis/phpredis/zip/develop
正在解析主机 codeload.github.com (codeload.github.com)... 13.229.189.0
正在连接 codeload.github.com (codeload.github.com)|13.229.189.0|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:未指定 [application/zip]
正在保存至: “develop”
[ <=> ] 257,733 455KB/s 用时 0.6s
2019-05-10 20:33:41 (455 KB/s) - “develop” 已保存 [257733]
[root@linux-001 src]# mv develop phpredis-develop.zip
[root@linux-001 src]# uzip phpredis-develop.zip
-bash: uzip: 未找到命令
[root@linux-001 src]# unzip phpredis-develop.zip
Archive: phpredis-develop.zip
d7450b2f59700e4662624317438c456a0dd36165
creating: phpredis-develop/
inflating: phpredis-develop/.gitignore
inflating: phpredis-develop/.gitmodules
inflating: phpredis-develop/.travis.yml
inflating: phpredis-develop/COPYING
inflating: phpredis-develop/CREDITS
inflating: phpredis-develop/INSTALL.markdown
inflating: phpredis-develop/ISSUE_TEMPLATE.md
inflating: phpredis-develop/README.markdown
inflating: phpredis-develop/arrays.markdown
inflating: phpredis-develop/cluster.markdown
inflating: phpredis-develop/cluster_library.c
inflating: phpredis-develop/cluster_library.h
inflating: phpredis-develop/common.h
inflating: phpredis-develop/config.m4
inflating: phpredis-develop/config.w32
inflating: phpredis-develop/crc16.h
inflating: phpredis-develop/debian.control
creating: phpredis-develop/debian/
inflating: phpredis-develop/debian/changelog
extracting: phpredis-develop/debian/compat
inflating: phpredis-develop/debian/control
inflating: phpredis-develop/debian/copyright
inflating: phpredis-develop/debian/postinst
inflating: phpredis-develop/debian/postrm
inflating: phpredis-develop/debian/rules
creating: phpredis-develop/liblzf/
inflating: phpredis-develop/library.c
inflating: phpredis-develop/library.h
inflating: phpredis-develop/mkdeb-apache2.sh
inflating: phpredis-develop/mkdeb.sh
inflating: phpredis-develop/package.xml
inflating: phpredis-develop/php_redis.h
inflating: phpredis-develop/redis.c
inflating: phpredis-develop/redis_array.c
inflating: phpredis-develop/redis_array.h
inflating: phpredis-develop/redis_array_impl.c
inflating: phpredis-develop/redis_array_impl.h
inflating: phpredis-develop/redis_cluster.c
inflating: phpredis-develop/redis_cluster.h
inflating: phpredis-develop/redis_commands.c
inflating: phpredis-develop/redis_commands.h
inflating: phpredis-develop/redis_session.c
inflating: phpredis-develop/redis_session.h
creating: phpredis-develop/rpm/
inflating: phpredis-develop/rpm/php-redis.spec
extracting: phpredis-develop/rpm/redis.ini
inflating: phpredis-develop/serialize.list
creating: phpredis-develop/tests/
inflating: phpredis-develop/tests/RedisArrayTest.php
inflating: phpredis-develop/tests/RedisClusterTest.php
inflating: phpredis-develop/tests/RedisTest.php
inflating: phpredis-develop/tests/TestRedis.php
inflating: phpredis-develop/tests/TestSuite.php
inflating: phpredis-develop/tests/getSessionData.php
inflating: phpredis-develop/tests/make-cluster.sh
inflating: phpredis-develop/tests/mkring.sh
inflating: phpredis-develop/tests/regenerateSessionId.php
inflating: phpredis-develop/tests/startSession.php
[root@linux-001 src]# cd phpredis-develop/
[root@linux-001 phpredis-develop]# ls
arrays.markdown config.m4 debian library.c php_redis.h redis_array_impl.h redis_commands.h tests
cluster_library.c config.w32 debian.control library.h README.markdown redis.c redis_session.c
cluster_library.h COPYING INSTALL.markdown mkdeb-apache2.sh redis_array.c redis_cluster.c redis_session.h
cluster.markdown crc16.h ISSUE_TEMPLATE.md mkdeb.sh redis_array.h redis_cluster.h rpm
common.h CREDITS liblzf package.xml redis_array_impl.c redis_commands.c serialize.list
6.4.2 生成一个configure的文件,缺少autoconf
[root@linux-001 phpredis-develop]# /usr/local/php7/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
6.4.3 使用yum安装autoconf
[root@linux-001 phpredis-develop]# yum install -y autoconf
已加载插件:fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Loading mirror speeds from cached hostfile
epel/x86_64/metalink | 4.6 kB 00:00:00
* base: mirrors.163.com
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.163.com
* updates: mirrors.163.com
base | 3.6 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/3): epel/x86_64/updateinfo | 998 kB 00:00:01
(2/3): updates/7/x86_64/primary_db | 4.2 MB 00:00:01
(3/3): epel/x86_64/primary_db | 6.7 MB 00:00:02
正在解决依赖关系
--> 正在检查事务
---> 软件包 autoconf.noarch.0.2.69-11.el7 将被 安装
--> 正在处理依赖关系 m4 >= 1.4.14,它被软件包 autoconf-2.69-11.el7.noarch 需要
--> 正在检查事务
---> 软件包 m4.x86_64.0.1.4.16-10.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
=====================================================================================================================================
Package 架构 版本 源 大小
=====================================================================================================================================
正在安装:
autoconf noarch 2.69-11.el7 base 701 k
为依赖而安装:
m4 x86_64 1.4.16-10.el7 base 256 k
事务概要
=====================================================================================================================================
安装 1 软件包 (+1 依赖软件包)
总下载量:957 k
安装大小:2.7 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): m4-1.4.16-10.el7.x86_64.rpm | 256 kB 00:00:00
(2/2): autoconf-2.69-11.el7.noarch.rpm | 701 kB 00:00:06
-------------------------------------------------------------------------------------------------------------------------------------
总计 137 kB/s | 957 kB 00:00:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : m4-1.4.16-10.el7.x86_64 1/2
正在安装 : autoconf-2.69-11.el7.noarch 2/2
验证中 : m4-1.4.16-10.el7.x86_64 1/2
验证中 : autoconf-2.69-11.el7.noarch 2/2
已安装:
autoconf.noarch 0:2.69-11.el7
作为依赖被安装:
m4.x86_64 0:1.4.16-10.el7
完毕!
6.4.4 使用phpize重新生成configure文件
[root@linux-001 phpredis-develop]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
[root@linux-001 phpredis-develop]# ls
acinclude.m4 common.h COPYING liblzf mkinstalldirs redis.c run-tests.php
aclocal.m4 config.guess crc16.h library.c package.xml redis_cluster.c serialize.list
arrays.markdown config.h.in CREDITS library.h php_redis.h redis_cluster.h tests
autom4te.cache config.m4 debian ltmain.sh README.markdown redis_commands.c
build config.sub debian.control Makefile.global redis_array.c redis_commands.h
cluster_library.c configure INSTALL.markdown missing redis_array.h redis_session.c
cluster_library.h configure.in install-sh mkdeb-apache2.sh redis_array_impl.c redis_session.h
cluster.markdown config.w32 ISSUE_TEMPLATE.md mkdeb.sh redis_array_impl.h rpm
6.4.5 安装redis扩展包
[root@linux-001 phpredis-develop]# ./configure --with-php-config=/usr/local/php7/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php7
checking for PHP includes... -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php7/lib/php/extensions/no-debug-zts-20180731
checking for PHP installed headers prefix... /usr/local/php7/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable redis support... yes, shared
checking whether to disable sessions... yes
checking whether to enable igbinary serializer support... no
checking whether to enable msgpack serializer support... no
checking whether to enable lzf compression... no
checking use system liblzf... no
checking for redis igbinary support... disabled
checking for git... no
checking for redis msgpack support... disabled
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
[root@linux-001 phpredis-develop]# ehco $?
-bash: ehco: 未找到命令
[root@linux-001 phpredis-develop]# ehco $?
[root@linux-001 phpredis-develop]# ./configure --with-php-config=/usr/local/php7/bin/php-config
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php7
checking for PHP includes... -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php7/lib/php/extensions/no-debug-zts-20180731
checking for PHP installed headers prefix... /usr/local/php7/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable redis support... yes, shared
checking whether to disable sessions... yes
checking whether to enable igbinary serializer support... no
checking whether to enable msgpack serializer support... no
checking whether to enable lzf compression... no
checking use system liblzf... no
checking for redis igbinary support... disabled
checking for git... no
checking for redis msgpack support... disabled
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
[root@linux-001 phpredis-develop]# echo $?
0
[root@linux-001 phpredis-develop]# make
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=compile cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis.c -o redis.lo
mkdir .libs
cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis.c -fPIC -DPIC -o .libs/redis.o
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=compile cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis_commands.c -o redis_commands.lo
cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis_commands.c -fPIC -DPIC -o .libs/redis_commands.o
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=compile cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/library.c -o library.lo
cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/library.c -fPIC -DPIC -o .libs/library.o
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=compile cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis_session.c -o redis_session.lo
cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis_session.c -fPIC -DPIC -o .libs/redis_session.o
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=compile cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis_array.c -o redis_array.lo
cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis_array.c -fPIC -DPIC -o .libs/redis_array.o
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=compile cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis_array_impl.c -o redis_array_impl.lo
cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis_array_impl.c -fPIC -DPIC -o .libs/redis_array_impl.o
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=compile cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis_cluster.c -o redis_cluster.lo
cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/redis_cluster.c -fPIC -DPIC -o .libs/redis_cluster.o
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=compile cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/cluster_library.c -o cluster_library.lo
cc -I. -I/usr/local/src/phpredis-develop -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/phpredis-develop/cluster_library.c -fPIC -DPIC -o .libs/cluster_library.o
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=link cc -DPHP_ATOM_INC -I/usr/local/src/phpredis-develop/include -I/usr/local/src/phpredis-develop/main -I/usr/local/src/phpredis-develop -I/usr/local/php7/include/php -I/usr/local/php7/include/php/main -I/usr/local/php7/include/php/TSRM -I/usr/local/php7/include/php/Zend -I/usr/local/php7/include/php/ext -I/usr/local/php7/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -o redis.la -export-dynamic -avoid-version -prefer-pic -module -rpath /usr/local/src/phpredis-develop/modules redis.lo redis_commands.lo library.lo redis_session.lo redis_array.lo redis_array_impl.lo redis_cluster.lo cluster_library.lo
cc -shared .libs/redis.o .libs/redis_commands.o .libs/library.o .libs/redis_session.o .libs/redis_array.o .libs/redis_array_impl.o .libs/redis_cluster.o .libs/cluster_library.o -Wl,-soname -Wl,redis.so -o .libs/redis.so
creating redis.la
(cd .libs && rm -f redis.la && ln -s ../redis.la redis.la)
/bin/sh /usr/local/src/phpredis-develop/libtool --mode=install cp ./redis.la /usr/local/src/phpredis-develop/modules
cp ./.libs/redis.so /usr/local/src/phpredis-develop/modules/redis.so
cp ./.libs/redis.lai /usr/local/src/phpredis-develop/modules/redis.la
PATH="$PATH:/sbin" ldconfig -n /usr/local/src/phpredis-develop/modules
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/src/phpredis-develop/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
[root@linux-001 phpredis-develop]# echo $?
0
[root@linux-001 phpredis-develop]# make install
Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-zts-20180731/
[root@linux-001 phpredis-develop]# ls /usr/local/php7/lib/php/extensions/no-debug-zts-20180731/
opcache.so redis.so
[root@linux-001 phpredis-develop]#
6.4.6 生成的redis.so文件添加到php的模块中
[root@linux-001 phpredis-develop]# /usr/local/php7/bin/php -m
[PHP Modules]
bz2
Core
ctype
date
dom
exif
fileinfo
filter
gd
hash
iconv
json
libxml
mbstring
mysqli
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib
[Zend Modules]
[root@linux-001 phpredis-develop]# cd ..
[root@linux-001 src]# ls
apr-1.7.0 apr-util-1.6.1.tar.gz mariadb-10.2.23-linux-glibc_214-x86_64.tar.gz php-5.6.39 php-7.3.0.tar.bz2
apr-1.7.0.tar.gz httpd-2.4.39 mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz php-5.6.39.tar.bz2 phpredis-develop
apr-util-1.6.1 httpd-2.4.39.tar.gz mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz php-7.3.0 phpredis-develop.zip
[root@linux-001 src]# cd php
php-5.6.39/ php-7.3.0/ phpredis-develop/
[root@linux-001 src]# cd php-7.3.0/
[root@linux-001 php-7.3.0]# ls
acinclude.m4 ext Makefile README.EXT_SKEL sapi
aclocal.m4 EXTENSIONS Makefile.frag README.GIT-RULES scripts
appveyor footer Makefile.fragments README.input_filter server-tests-config.php
build generated_lists Makefile.gcov README.MAILINGLIST_RULES server-tests.php
buildconf genfiles Makefile.global README.md snapshot
buildconf.bat header Makefile.objects README.NEW-OUTPUT-API stamp-h.in
CODING_STANDARDS include missing README.PARAMETER_PARSING_API tests
config.guess INSTALL mkinstalldirs README.REDIST.BINS travis
config.log install-sh modules README.RELEASE_PROCESS TSRM
config.nice libphp7.la NEWS README.SELF-CONTAINED-EXTENSIONS UPGRADING
config.status libs pear README.STREAMS UPGRADING.INTERNALS
config.sub libtool php7.spec README.SUBMITTING_PATCH vcsclean
configure LICENSE php7.spec.in README.TESTING win32
configure.ac ltmain.sh php.gif README.UNIX-BUILD-SYSTEM Zend
CONTRIBUTING.md main php.ini-development README.WIN32-BUILD-SYSTEM
CREDITS makedist php.ini-production run-tests.php
[root@linux-001 php-7.3.0]# cp php.ini-development /usr/local/php7/etc/php.ini
[root@linux-001 php-7.3.0]# vim /usr/local/php7/etc/php.ini
## 文中随便一个地方添加 ##
extension=redis.so
[root@linux-001 php-7.3.0]# /usr/local/php7/bin/php -m | grep redis
redis
课后总结
pecl 安装指定版本php扩展
PECL 的全称是 The PHP Extension Community Library ,是一个开放的并通过 PEAR(PHP Extension and Application Repository,PHP 扩展和应用仓库)打包格式来打包安装的 PHP扩展库仓库。通过 PEAR 的 Package Manager 的安装管理方式,可以对 PECL 模块进行下载和安装。
[root@linux-001 lib64]# /usr/local/php/bin/pecl install memcache
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading memcache-2.2.7.tgz ...
Starting to download memcache-2.2.7.tgz (36,459 bytes)
..........done: 36,459 bytes
11 source files, building
running: phpize
Configuring for:
PHP Api Version: 20131106
Zend Module Api No: 20131226
Zend Extension Api No: 220131226
Enable memcache session handler support? [yes] : yes
building in /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7
running: /tmp/pear/temp/memcache/configure --with-php-config=/usr/local/php/bin/php-config --enable-memcache-session=yes
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for a sed that does not truncate output... /usr/bin/sed
checking for cc... cc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /usr/local/php
checking for PHP includes... -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib
checking for PHP extension directory... /usr/local/php/lib/php/extensions/no-debug-zts-20131226
checking for PHP installed headers prefix... /usr/local/php/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking whether to enable memcache support... yes, shared
checking whether to enable memcache session handler support... yes
checking for the location of ZLIB... no
checking for the location of zlib... /usr
checking for session includes... /usr/local/php/include/php
checking for memcache session support... enabled
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for /usr/bin/ld option to reload object files... -r
checking for BSD-compatible nm... /usr/bin/nm -B
checking whether ln -s works... yes
checking how to recognize dependent libraries... pass_all
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking dlfcn.h usability... yes
checking dlfcn.h presence... yes
checking for dlfcn.h... yes
checking the maximum length of command line arguments... 1572864
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for objdir... .libs
checking for ar... ar
checking for ranlib... ranlib
checking for strip... strip
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC
checking if cc PIC flag -fPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
creating libtool
appending configuration tag "CXX" to libtool
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/libtool --mode=compile cc -I/usr/local/php/include/php -I. -I/tmp/pear/temp/memcache -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/memcache/memcache.c -o memcache.lo
mkdir .libs
cc -I/usr/local/php/include/php -I. -I/tmp/pear/temp/memcache -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/memcache/memcache.c -fPIC -DPIC -o .libs/memcache.o
/tmp/pear/temp/memcache/memcache.c: 在函数‘mmc_str_left’中:
/tmp/pear/temp/memcache/memcache.c:1160:8: 警告:assignment discards ‘const’ qualifier from pointer target type [默认启用]
found = php_memnstr(haystack, needle, needle_len, haystack + haystack_len);
^
/tmp/pear/temp/memcache/memcache.c: 在函数‘mmc_stats_parse_stat’中:
/tmp/pear/temp/memcache/memcache.c:1574:13: 警告:assignment discards ‘const’ qualifier from pointer target type [默认启用]
if ((space = php_memnstr(start, " ", 1, end)) == NULL) {
^
/tmp/pear/temp/memcache/memcache.c:1579:13: 警告:assignment discards ‘const’ qualifier from pointer target type [默认启用]
if ((colon = php_memnstr(start, ":", 1, space - 1)) != NULL) {
^
/tmp/pear/temp/memcache/memcache.c: 在函数‘mmc_stats_parse_item’中:
/tmp/pear/temp/memcache/memcache.c:1617:13: 警告:assignment discards ‘const’ qualifier from pointer target type [默认启用]
if ((space = php_memnstr(start, " ", 1, end)) == NULL) {
^
/tmp/pear/temp/memcache/memcache.c:1625:13: 警告:assignment discards ‘const’ qualifier from pointer target type [默认启用]
for (value = php_memnstr(space, "[", 1, end); value != NULL && value <= end; value = php_memnstr(value + 1, ";", 1, end)) {
^
/tmp/pear/temp/memcache/memcache.c:1625:85: 警告:assignment discards ‘const’ qualifier from pointer target type [默认启用]
for (value = php_memnstr(space, "[", 1, end); value != NULL && value <= end; value = php_memnstr(value + 1, ";", 1, end)) {
^
/tmp/pear/temp/memcache/memcache.c:1630:34: 警告:assignment discards ‘const’ qualifier from pointer target type [默认启用]
if (value <= end && (value_end = php_memnstr(value, " ", 1, end)) != NULL && value_end <= end) {
^
/tmp/pear/temp/memcache/memcache.c: 在函数‘mmc_stats_parse_generic’中:
/tmp/pear/temp/memcache/memcache.c:1654:14: 警告:assignment discards ‘const’ qualifier from pointer target type [默认启用]
if ((space = php_memnstr(start, " ", 1, end)) != NULL) {
^
/bin/sh /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/libtool --mode=compile cc -I/usr/local/php/include/php -I. -I/tmp/pear/temp/memcache -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/memcache/memcache_queue.c -o memcache_queue.lo
cc -I/usr/local/php/include/php -I. -I/tmp/pear/temp/memcache -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/memcache/memcache_queue.c -fPIC -DPIC -o .libs/memcache_queue.o
/bin/sh /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/libtool --mode=compile cc -I/usr/local/php/include/php -I. -I/tmp/pear/temp/memcache -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/memcache/memcache_standard_hash.c -o memcache_standard_hash.lo
cc -I/usr/local/php/include/php -I. -I/tmp/pear/temp/memcache -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/memcache/memcache_standard_hash.c -fPIC -DPIC -o .libs/memcache_standard_hash.o
/bin/sh /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/libtool --mode=compile cc -I/usr/local/php/include/php -I. -I/tmp/pear/temp/memcache -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/memcache/memcache_consistent_hash.c -o memcache_consistent_hash.lo
cc -I/usr/local/php/include/php -I. -I/tmp/pear/temp/memcache -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/memcache/memcache_consistent_hash.c -fPIC -DPIC -o .libs/memcache_consistent_hash.o
/bin/sh /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/libtool --mode=compile cc -I/usr/local/php/include/php -I. -I/tmp/pear/temp/memcache -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/memcache/memcache_session.c -o memcache_session.lo
cc -I/usr/local/php/include/php -I. -I/tmp/pear/temp/memcache -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /tmp/pear/temp/memcache/memcache_session.c -fPIC -DPIC -o .libs/memcache_session.o
/bin/sh /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/libtool --mode=link cc -DPHP_ATOM_INC -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/include -I/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/main -I/tmp/pear/temp/memcache -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -o memcache.la -export-dynamic -avoid-version -prefer-pic -module -rpath /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/modules memcache.lo memcache_queue.lo memcache_standard_hash.lo memcache_consistent_hash.lo memcache_session.lo
cc -shared .libs/memcache.o .libs/memcache_queue.o .libs/memcache_standard_hash.o .libs/memcache_consistent_hash.o .libs/memcache_session.o -Wl,-soname -Wl,memcache.so -o .libs/memcache.so
creating memcache.la
(cd .libs && rm -f memcache.la && ln -s ../memcache.la memcache.la)
/bin/sh /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/libtool --mode=install cp ./memcache.la /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/modules
cp ./.libs/memcache.so /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/modules/memcache.so
cp ./.libs/memcache.lai /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/modules/memcache.la
PATH="$PATH:/sbin" ldconfig -n /tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/modules
----------------------------------------------------------------------
Libraries have been installed in:
/tmp/pear/temp/pear-build-rootSVTdsl/memcache-2.2.7/modules
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
Don't forget to run 'make test'.
running: make INSTALL_ROOT="/tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7" install
Installing shared extensions: /tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7/usr/local/php/lib/php/extensions/no-debug-zts-20131226/
running: find "/tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7" | xargs ls -dils
25992966 0 drwxr-xr-x 3 root root 17 5月 12 22:00 /tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7
10813744 0 drwxr-xr-x 3 root root 19 5月 12 22:00 /tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7/usr
21216419 0 drwxr-xr-x 3 root root 17 5月 12 22:00 /tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7/usr/local
25992967 0 drwxr-xr-x 3 root root 17 5月 12 22:00 /tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7/usr/local/php
1091383 0 drwxr-xr-x 3 root root 17 5月 12 22:00 /tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7/usr/local/php/lib
10813745 0 drwxr-xr-x 3 root root 24 5月 12 22:00 /tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7/usr/local/php/lib/php
21216420 0 drwxr-xr-x 3 root root 35 5月 12 22:00 /tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7/usr/local/php/lib/php/extensions
25992969 0 drwxr-xr-x 2 root root 25 5月 12 22:00 /tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7/usr/local/php/lib/php/extensions/no-debug-zts-20131226
25992971 284 -rwxr-xr-x 1 root root 290048 5月 12 22:00 /tmp/pear/temp/pear-build-rootSVTdsl/install-memcache-2.2.7/usr/local/php/lib/php/extensions/no-debug-zts-20131226/memcache.so
Build process completed successfully
Installing '/usr/local/php/lib/php/extensions/no-debug-zts-20131226/memcache.so'
install ok: channel://pecl.php.net/memcache-2.2.7
configuration option "php_ini" is not set to php.ini location
You should add "extension=memcache.so" to php.ini
[root@linux-001 lib64]# /usr/local/php/bin/php -m | grep memcache
[root@linux-001 lib64]# vim /usr/local/php/etc/php.ini
## 添加以下内容 ##
extension=memcache.so
[root@linux-001 lib64]# /usr/local/php/bin/php -m | grep memcache
memcache
[root@linux-001 lib64]#