1. The anti-theft chain configuration Apache
Anti-theft chain, the popular talk is not allowing people to misappropriation of resources on your site, this resource refers to the pictures, videos, songs, documents, etc., before referer need to understand what the concept, if you pass a page A website http: //a.com/a.html link inside to visit the site of a B page http://b.com/b.html, then B referer this web page is http://a.com/a.html . That is, one is a referer URL.
Open the virtual host configuration files, configure a virtual host in the following contents;
[Root @ ying01 ~] # vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf // edit virtual host configuration file
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/111.com"
ServerName 111.com
ServerAlias www.example.com 2111.com.cn
<Directory /data/wwwroot/111.com>
SetEnvIfNoCase Referer "http://111.com" local_ref // definition allows access link referer
SetEnvIfNoCase Referer "http://ask.apelearn.com" local_ref
SetEnvIfNoCase Referer "^ $" local_ref // empty referer to the white list, namely, direct access address
<FilesMatch "\.(txt|doc|mp3|zip|rar|jpg|gif|png)">
Order Allow, Deny // white list addresses allow, deny other
Allow from env = local_ref // whitelist corresponding address local_ref
</FilesMatch>
</Directory>
ErrorLog "logs/111.com-error_log"
SetEnvIf Request_URI ".*\.gif$" img
SetEnvIf Request_URI ".*\.jpg$" img
SetEnvIf Request_URI ".*\.png$" img
SetEnvIf Request_URI ".*\.bmp$" img
SetEnvIf Request_URI ".*\.swf$" img
SetEnvIf Request_URI ".*\.js$" img
SetEnvIf Request_URI ".*\.css$" img
CustomLog "|/usr/local/apache2.4/bin/rotatelogs -l logs/111.com-access_%Y%m%d.log 86400" combined env=!img
</VirtualHost>
End configuration change, or need to detect syntax, and restart httpd
[Root @ ying01 ~] # /usr/local/apache2.4/bin/apachectl -t // After changing the configuration, you need to check the configuration syntax
Syntax OK
[root@ying01 ~]# /usr/local/apache2.4/bin/apachectl graceful //重启httpd
Now with 111.com/1.jpg test this configuration content;
[root@ying01 ~]# ls /data/wwwroot/111.com/
123.php 1.jpg index.php
[Root @ ying01 111.com] # curl -x192.168.112.136: 80 -I 111.com/1.jpg // direct access to state 200, the equivalent of empty refer
HTTP/1.1 200 OK
Date: Sat, 30 Jun 2018 10:18:47 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Last-Modified: Tue, 26 Jun 2018 08:19:48 GMTETag: "8967-56f8729511100"Accept-Ranges: bytesContent-Length: 35175Content-Type: image/jpeg
[root@ying01 111.com]# curl -e "http://www.qq.com/1.jpg" -x192.168.112.136:80 -I 111.com/1.jpg
HTTP / 1.1 403 Forbidden // definitions refer to qq, prohibiting refer to this
Date: Sat, 30 Jun 2018 10:19:22 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Content-Type: text/html; charset=iso-8859-1
[root@ying01 111.com]# curl -e "http://111.com/1.jpg" -x192.168.112.136:80 -I 111.com/1.jpg
HTTP / 1.1 200 OK // defined refer to 111.com, you can access
Date: Sat, 30 Jun 2018 10:19:59 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Last-Modified: Tue, 26 Jun 2018 08:19:48 GMTETag: "8967-56f8729511100"Accept-Ranges: bytesContent-Length: 35175Content-Type: image/jpeg
[root@ying01 111.com]# curl -e "http://ask.apelearn.com/lkkh.gif" -x192.168.112.136:80 -I 111.com/1.jpg
HTTP / 1.1 200 OK // defined refer to ask.apelearn.com, you can access
Date: Sun, 01 Jul 2018 01:04:12 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Last-Modified: Tue, 26 Jun 2018 08:19:48 GMTETag: "8967-56f8729511100"Accept-Ranges: bytesContent-Length: 35175Content-Type: image/jpeg
to sum up:
When you need to access 111.com/1.jpg this image:
Direct access to access images;
As it has been defined as null refer: ** SetEnvIfNoCase Referer "^ $" local_ref **
Accessed through the development of refer;
111.com has been defined by reference: SetEnvIfNoCase Referer "http://111.com" local_ref
Ask.apelearn.com has been defined by reference: SetEnvIfNoCase Referer "http://ask.apelearn.com" local_ref
But this is only for the content of the following formats:
FilesMatch "\.(txt|doc|mp3|zip|rar|jpg|gif|png)">
For example: Let's visit 111.com/index.php, you can arbitrarily be referenced;
[root@ying01 111.com]# curl -e "http://www.baidu.com" -x192.168.112.136:80 -I 111.com/index.php
HTTP / 1.1 200 OK // with Baidu, you can also access the index.php
Date: Sun, 01 Jul 2018 01:14:23 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6X-Powered-By: PHP/7.1.6Content-Type: text/html; charset=UTF-8
[root@ying01 111.com]# curl -e "http://www.126.com" -x192.168.112.136:80 -I 111.com/index.php
HTTP / 1.1 200 OK // with 126, or visit index.php, so this refer, you can specify any
Date: Sun, 01 Jul 2018 01:16:12 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6X-Powered-By: PHP/7.1.6Content-Type: text/html; charset=UTF-8
2. Apache access control
For some of the more important website content, in addition to use than user authentication to restrict access, you can also do it through some other method restrictions, such as restrictions on IP, you can also limit user_agent. IP refers to the restrictions is to limit access to the URL source IP, and restrictions user_agent, usually used to limit malicious or unusual requests.
1. Access Control Directory
In the virtual host configuration file which, according to the following content configuration;
[root@ying01 111.com]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
These are configuration elements:
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/111.com"
ServerName 111.com
ServerAlias www.example.com 2111.com.cn
<Directory /data/wwwroot/111.com/admin> // admin directory increase
Order deny, allow // by first refused, then allowed to perform
Deny from all // reject all
Allow from 127.0.0.1 // ip permit
</Directory>
ErrorLog "logs/111.com-error_log"
SetEnvIf Request_URI ".*\.gif$" img
SetEnvIf Request_URI ".*\.jpg$" img
SetEnvIf Request_URI ".*\.png$" img
SetEnvIf Request_URI ".*\.bmp$" img
SetEnvIf Request_URI ".*\.swf$" img
SetEnvIf Request_URI ".*\.js$" img
SetEnvIf Request_URI ".*\.css$" img
CustomLog "|/usr/local/apache2.4/bin/rotatelogs -l logs/111.com-access_%Y%m%d.log 86400" combined env=!img
</VirtualHost>
Preparation before test
[root@ying01 111.com]# ls123.php 1.jpg 1.txt ceshi.png index.php
[Root @ ying01 111.com] # mkdir admin // create admin directory at 111.com
[Root @ ying01 111.com] # touch admin / index.php // create the index.php file in the admin
[root@ying01 111.com]# echo "qeqe2222" >> admin/index.php
[root@ying01 111.com]# cat !$
cat admin/index.php
qeqe2222
[root@ying01 111.com]# /usr/local/apache2.4/bin/apachectl -t
Syntax OK
[root@ying01 111.com]# /usr/local/apache2.4/bin/apachectl graceful //httpd重启
Allowing IP 127.0.0.1, the admin directory access
[Root @ ying01 111.com] # curl -x127.0.0.1: 80 111.com/admin/index.php -I // normal visit
HTTP/1.1 200 OK
Date: Sun, 01 Jul 2018 01:56:52 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6X-Powered-By: PHP/7.1.6Content-Type: text/html; charset=UTF-8
[Root @ ying01 111.com] # curl -x127.0.0.1: 80 111.com/admin/index.php // can output
qeqe2222
[root@ying01 111.com]# curl -x127.0.0.1:80 http://111.com/admin/asdsf -I
HTTP / 1.1 404 Not Found // 404 representatives allow access, this page does not
Date: Sun, 01 Jul 2018 02:05:08 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Content-Type: text/html; charset=iso-8859-1
With ifconfig, the machine has three view the IP;
[root@ying01 111.com]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.112.136 netmask 255.255.255.0 broadcast 192.168.112.255
inet6 fe80::16dc:89c:b761:e115 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:87:3f:91 txqueuelen 1000 (Ethernet)
RX packets 8986 bytes 758369 (740.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4496 bytes 555923 (542.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ens33:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.112.158 netmask 255.255.255.0 broadcast 192.168.112.255
ether 00:0c:29:87:3f:91 txqueuelen 1000 (Ethernet)
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0 // has been defined allow
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 516 bytes 44492 (43.4 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 516 bytes 44492 (43.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
So in addition to using the IP 127.0.0.1, other IP test cases;
[root@ying01 111.com]# curl -x192.168.112.158:80 111.com/admin/index -I
HTTP / 1.1 403 Forbidden // prohibit access to this IP
Date: Sun, 01 Jul 2018 03:10:05 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Content-Type: text/html; charset=iso-8859-1
[root@ying01 111.com]# curl -x192.168.112.136:80 111.com/admin/index -I
HTTP / 1.1 403 Forbidden // prohibit access to this IP
Date: Sun, 01 Jul 2018 03:10:19 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Content-Type: text/html; charset=iso-8859-1
16.2 Access Control FilesMatch
Edit virtual host configuration files, FilesMatch configuration; it is necessary to match the file, but also limit the IP;
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/111.com"
ServerName 111.com
ServerAlias www.example.com 2111.com.cn
<Directory /data/wwwroot/111.com> // at 111.com directory
<Filesmatch admin.php (. *)> // admin.php with any files that match the characters behind
Order deny,allow
Deny from all
Allow from 127.0.0.1 // only allow access to 127.0.0.1
</Filesmatch>
</Directory>
ErrorLog "logs/111.com-error_log"
SetEnvIf Request_URI ".*\.gif$" img
SetEnvIf Request_URI ".*\.jpg$" img
SetEnvIf Request_URI ".*\.png$" img
SetEnvIf Request_URI ".*\.bmp$" img
SetEnvIf Request_URI ".*\.swf$" img
SetEnvIf Request_URI ".*\.js$" img
SetEnvIf Request_URI ".*\.css$" img
CustomLog "|/usr/local/apache2.4/bin/rotatelogs -l logs/111.com-access_%Y%m%d.log 86400" combined env=!img
</VirtualHost>
In meet admin.php, different IP, access to testing;
[Root @ ying01 111.com] # curl -x192.168.112.136: 80 http://111.com/admin.phpsaaaaaaaaaaaa -I // meet admin.php
HTTP / 1.1 403 Forbidden // because only allow IP: 127.0.0.1 access
Date: Sun, 01 Jul 2018 14:55:48 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Content-Type: text/html; charset=iso-8859-1
[Root @ ying01 111.com] # curl -x192.168.112.136: 80 'http://111.com/admin.php#aaaaaaaaaaaa' -I // satisfies admin.php
HTTP / 1.1 403 Forbidden // because only allow IP: 127.0.0.1 access
Date: Sun, 01 Jul 2018 15:00:45 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Content-Type: text/html; charset=iso-8859-1
[Root @ ying01 111.com] # curl -x127.0.0.1: 80 'http://111.com/admin.php#aaaaaaaaaaaa' -I // apostrophe, because there is a special symbol #
HTTP / 1.1 404 Not Found // able to connect, but no such page
Date: Sun, 01 Jul 2018 15:01:10 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Content-Type: text/html; charset=iso-8859-1
[root@ying01 111.com]# curl -x127.0.0.1:80 http://111.com/admin.phpsaaaaaaaaaaaa -I
HTTP / 1.1 404 Not Found // able to connect, but no such page
Date: Sun, 01 Jul 2018 15:02:51 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Content-Type: text/html; charset=iso-8859-1
Test results: 127.0.0.1 only be able to access admin.php page (*). The remaining IP, no such authority;
3. define a directory ban resolve php
There is such a situation, some sites and forums are allowed to upload pictures to the server, they upload some php or js to the server, and then we perform the load, resulting in a threat to the data. In order to avoid this from happening, we need to limit the upload type.
Edit virtual host configuration file, as follows;
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/111.com"
ServerName 111.com
ServerAlias www.example.com2111.com.cn
<Directory /data/wwwroot/111.com/upload> // define the upload directory in 111.com
php_admin_flag engine off // ban php parsing, all access reported 403 errors
<FilesMatch (. *) \. Php (. *)> // matches any character before and after .php
Order deny, allow // press ban, allow execution
Deny from all // prohibit all
</Filesmatch>
</Directory>
ErrorLog "logs/111.com-error_log"
SetEnvIf Request_URI ".*\.gif$" img
SetEnvIf Request_URI ".*\.jpg$" img
SetEnvIf Request_URI ".*\.png$" img
SetEnvIf Request_URI ".*\.bmp$" img
SetEnvIf Request_URI ".*\.swf$" img
SetEnvIf Request_URI ".*\.js$" img
SetEnvIf Request_URI ".*\.css$" img
CustomLog "|/usr/local/apache2.4/bin/rotatelogs -l logs/111.com-access_%Y%m%d.log 86400" combined env=!img
</VirtualHost>
Create a directory and copy 123.php to upload, configure and restart; do test preparation;
[root@ying01 111.com]# mkdir upload
[root@ying01 111.com]# ls123.php 1.jpg 1.txt admin ceshi.png index.php upload
[root@ying01 111.com]# cp 123.php upload/
[root@ying01 111.com]# /usr/local/apache2.4/bin/apachectl -t
Syntax OK
[root@ying01 111.com]# /usr/local/apache2.4/bin/apachectl graceful
Be tested prohibited parsing php, source code can not be output;
[root@ying01 111.com]# curl -x127.0.0.1:80 http://111.com/upload/123.php -I
HTTP/1.1 403 Forbidden
Date: Sun, 01 Jul 2018 15:45:24 GMT
Server: Apache/2.4.33 (Unix) PHP/7.1.6
Content-Type: text/html; charset=iso-8859-1
[Root @ ying01 111.com] # curl -x127.0.0.1: 80 http://111.com/upload/123.php // disable access to, the source code can not be output
<!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/123.php
on this server.<br /></p></body></html>
And then configure the FilesMatch part does not perform, with the # sign
[root@ying01 111.com]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/111.com"
ServerName 111.com
ServerAlias www.example.com 2111.com.cn
<Directory /data/wwwroot/111.com/upload> // define the upload directory in 111.com
php_admin_flag engine off // ban php parsing, all access reported 403 errors
# <FilesMatch (. *) \. Php (. *)> // .php before and after matches any character
# Order deny, allow // press ban, allow execution
# Deny from all // prohibit all
#</Filesmatch>
</Directory>
ErrorLog "logs/111.com-error_log"
SetEnvIf Request_URI ".*\.gif$" img
SetEnvIf Request_URI ".*\.jpg$" img
SetEnvIf Request_URI ".*\.png$" img
SetEnvIf Request_URI ".*\.bmp$" img
SetEnvIf Request_URI ".*\.swf$" img
SetEnvIf Request_URI ".*\.js$" img
SetEnvIf Request_URI ".*\.css$" img
CustomLog "|/usr/local/apache2.4/bin/rotatelogs -l logs/111.com-access_%Y%m%d.log 86400" combined env=!img
</VirtualHost>
At this time, after the restart configuration, a test; the results can not be resolved php, only the output of the source code;
[root@ying01 111.com]# /usr/local/apache2.4/bin/apachectl -t
Syntax OK
[root@ying01 111.com]# /usr/local/apache2.4/bin/apachectl graceful
[Root @ ying01 111.com] # curl -x127.0.0.1: 80 http://111.com/upload/123.php // not able to resolve the PHP, but the output source code
<?php
echo "123.php";
Summary: So to be safe, we have to let it simply can not access php (match .php), do not give it the opportunity to resolve;
4. limit user_agent
User Agent Chinese called user agent, referred to as UA, it is a special string head, so that the server can identify the operating system and the version used by the customer, CPU type, browser and version, browser rendering engine, browser language, browser plug-ins.
When using crul access, user_agent value "curl / 7.29.0"; so we can use it, do the experiment;
The first step: The following content is defined as the virtual host configuration file
[root@ying01 111.com]# vim /usr/local/apache2.4/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/data/wwwroot/111.com"
ServerName 111.com
ServerAlias www.example.com 2111.com.cn
<IfModule mod_rewrite.c>
RewriteEngine on //
RewriteCond% {HTTP_USER_AGENT}. * Curl. * [NC, OR] // match curl, case insensitive, or
RewriteCond %{HTTP_USER_AGENT} .*baidu.com.* [NC]
RewriteRule .* - [F]
</IfModule>
ErrorLog "logs/111.com-error_log"
SetEnvIf Request_URI ".*\.gif$" img
SetEnvIf Request_URI ".*\.jpg$" img
SetEnvIf Request_URI ".*\.png$" img
SetEnvIf Request_URI ".*\.bmp$" img
SetEnvIf Request_URI ".*\.swf$" img
SetEnvIf Request_URI ".*\.js$" img
SetEnvIf Request_URI ".*\.css$" img
CustomLog "|/usr/local/apache2.4/bin/rotatelogs -l logs/111.com-access_%Y%m%d.log 86400" combined env=!img
</VirtualHost>
Step two: direct access to curl with 123.php at 111.com directory
[root@ying01 111.com]# curl -x127.0.0.1:80 http://111.com/123.php -I
HTTP / 1.1 403 Forbidden // disable access
Date: Sun, 01 Jul 2018 16:42:05 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6Content-Type: text/html; charset=iso-8859-1
The third step: the value specified by the curl -A user_agent
[root@ying01 111.com]# curl -A "123456" -x127.0.0.1:80 http://111.com/123.php -I //指定user_agent为123456
HTTP / 1.1 200 OK // can access
Date: Sun, 01 Jul 2018 16:44:13 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6X-Powered-By: PHP/7.1.6Content-Type: text/html; charset=UTF-8
[root@ying01 111.com]# curl -A "ying ying" -x127.0.0.1:80 http://111.com/123.php -I //指定user_agent为ying ying
HTTP / 1.1 200 OK // can access
Date: Sun, 01 Jul 2018 16:45:19 GMTServer: Apache/2.4.33 (Unix) PHP/7.1.6X-Powered-By: PHP/7.1.6Content-Type: text/html; charset=UTF-8
Step four: access call logs; user_agent can be seen as a "curl / 7.29.0", there are "123456" and "ying ying"
[root@ying01 111.com]# tail -3 /usr/local/apache2.4/logs/111.com-access_20180702.log
127.0.0.1 - - [02/Jul/2018:00:42:05 +0800] "HEAD http://111.com/123.php HTTP/1.1" 403 - "-" "curl/7.29.0"
127.0.0.1 - - [02/Jul/2018:00:44:13 +0800] "HEAD http://111.com/123.php HTTP/1.1" 200 - "-" "123456"
127.0.0.1 - - [02/Jul/2018:00:45:19 +0800] "HEAD http://111.com/123.php HTTP/1.1" 200 - "-" "ying ying"
Summary: user_agent as "curl / 7.29.0" matching profile, thus prohibiting access; user_agent value specified by the curl -A, the status code 200;
3.PHP Expansion Module Installation
1. Download module package install
Download Source Package
[root@ying01 ~]# cd /usr/local/src/
[root@ying01 src]# wget https://codeload.github.com/phpredis/phpredis/zip/develop
Rename, unzip the package
[Root @ ying01 src] # mv develop phpredis-develop.zip // change the name [root @ ying01 src] # unzip phpredis-develop.zip // unpack
It generated configure file
[root@ying01 src]# cd phpredis-develop/
[root@ying01 phpredis-develop]#
[root@ying01 phpredis-develop]# /usr/local/php7/bin/phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
Suggested that the lack autoconf package
[root@ying01 phpredis-develop]# yum install -y autoconf
We will continue to generate the configure file
[root@ying01 phpredis-develop]# /usr/local/php7/bin/phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
[root@ying01 phpredis-develop]# ls configure
configure
Configure, compile, install
[root@ying01 phpredis-develop]# ./configure --with-php-config=/usr/local/php7/bin/php-config
[root@ying01 phpredis-develop]# make
[root@ying01 phpredis-develop]# make install
Check expansion module storage directory
[root@ying01 phpredis-develop]# /usr/local/php7/bin/php -i |grep extension_dir
extension_dir => /usr/local/php7/lib/php/extensions/no-debug-zts-20160303 => /usr/local/ph
sqlite3.extension_dir => no value => no value
Directory is empty, then load the extension in php.ini a statement
[root@ying01 phpredis-develop]# vim /usr/local/php7/etc/php.ini
At this view storage directory expansion modules, we found redis.so just configured module
[root@ying01 phpredis-develop]# /usr/local/php7/bin/php -m |grep redis
repeat
[root@ying01 zip]# ls /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
opcache.so redis.so
2. Compile source packages that comes with PHP
php7 source package, there are many built-in source package. We do not need to download again, can be directly translated!
There are many directory under php-7.1.6 / etc directory;
root@ying01 phpredis-develop]# cd /usr/local/src/php-7.1.6/
[root@ying01 php-7.1.6]# cd ext/
[root@ying01 ext]# ls
bcmath ext_skel interbase opcache pdo_sqlite skeleton tokenizer
bz2 ext_skel_win32.php intl openssl pgsql snmp wddx
calendar fileinfo json pcntl phar soap xml
com_dotnet filter ldap pcre posix sockets xmlreader
ctype ftp libxml pdo pspell spl xmlrpc
curl gd mbstring pdo_dblib readline sqlite3 xmlwriter
date gettext mcrypt pdo_firebird recode standard xsl
dba gmp mysqli pdo_mysql reflection sysvmsg zip
dom hash mysqlnd pdo_oci session sysvsem zlib
enchant iconv oci8 pdo_odbc shmop sysvshm
exif imap odbc pdo_pgsql simp
Now compile a module zip
[root@ying01 phpredis-develop]# cd /usr/local/src/php-7.1.6/
[Root @ ying01 php-7.1.6] # cd ext / // There are zip module
[root@ying01 ext]# ls
bcmath ext_skel interbase opcache pdo_sqlite skeleton tokenizer
bz2 ext_skel_win32.php intl openssl pgsql snmp wddx
calendar fileinfo json pcntl phar soap xml
com_dotnet filter ldap pcre posix sockets xmlreader
ctype ftp libxml pdo pspell spl xmlrpc
curl gd mbstring pdo_dblib readline sqlite3 xmlwriter
date gettext mcrypt pdo_firebird recode standard xsl
dba gmp mysqli pdo_mysql reflection sysvmsg zip
dom hash mysqlnd pdo_oci session sysvsem zlib
enchant iconv oci8 pdo_odbc shmop sysvshm
exif imap odbc pdo_pgsql simplexml tidy
[Root @ ying01 ext] # / usr / local / php7 / bin / php -m | grep zip // load the php module, find zip
[root@ying01 ext]# cd zip/
[root@ying01 zip]# ls
config.m4 CREDITS lib php_zip.c tests zip_stream.c
config.w32 examples LICENSE_libzip php_zip.h TODO
[root@ying01 zip]# /usr/local/php7/bin/phpize
Configuring for:
PHP Api Version: 20160303
Zend Module Api No: 20160303
Zend Extension Api No: 320160303
Configure, compile, install
[root@ying01 zip]# ./configure --with-php-config=/usr/local/php7/bin/php-config
[root@ying01 zip]# make [root@ying01 zip]# make install
View the catalog, this time found zip.so module
Installing shared extensions: /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
[root@ying01 zip]# ls /usr/local/php7/lib/php/extensions/no-debug-zts-20160303/
opcache.so redis.so zip.so