【php安全】eavl函数禁用适用于 php7.* php5系列

php5.4 安装扩展demo

php安装suhosin扩展 php版本与suhosin版本:

suhosin-0.9.38 支持到php 5.4

php5.4 5.5 5.6 需安装 https://github.com/sektioneins/suhosin

官方的快速入门

#> cd suhosin
#> phpize
#> ./configure
#> make
#> make install

yum安装的php,安装suhosin扩展步骤:

目前yum安装的php版本为5.4.16,可直接下载suhosin-0.9.38

[root@php ~]# wget https://download.suhosin.org/suhosin-0.9.38.tar.gz
[root@php ~]# tar xf suhosin-0.9.38.tar.gz 
[root@php ~]# cd suhosin-0.9.38
[root@php suhosin-0.9.38]# phpize       
#此步骤需要安装php-devel扩展
#且phpize需要为需要安装扩展的php下的phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
[root@php suhosin-0.9.38]# which php-config
#php-config为需要安装扩展的php下的php-config
/usr/bin/php-config
[root@php suhosin-0.9.38]# ./configure --with-php-config=/usr/bin/php-config
[root@php suhosin-0.9.38]# make && make install

在/etc/php.ini末尾添加extension=suhosin.so,重启php-fpm即可

可使用php -m | grep suhosin查看有没有加载成功:

[root@php suhosin-0.9.38]# php -m | grep suhosin
suhosin

yum安装的php5.6 安装5.6版本的php

[root@lxk ~]# yum install epel-release
[root@lxk ~]# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
[root@lxk ~]# yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm php-common php-devel php-mysql php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof
[root@lxk ~]# php-fpm -v
PHP 5.6.40 (fpm-fcgi) (built: Jan  9 2019 12:34:41)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.5.5, Copyright (c) 2002-2017, by Derick Rethans

php7.1 安装扩展

php 7.*  测试版本7.1 7.3版本还不能使用
首先通过git在github克隆下来一份到服务器 (suhosin7)
 
然后cd到目录(suhosin7)
 #>cd suhosin7

生成配置(少数扩展可能还需要指定其它依赖库的目录,请根据官方说明修改编译参数)

#>/www/server/php/71/bin/phpize

不知道PATH怎么写可以 which php-config 找到path地址

#>./configure --with-php-config=/www/server/php/71/bin/php-config

编译并安装

#>make && make install

echo "extension = suhosin.so" >> /www/server/php/71/etc/php.ini  #说明 如果是7版本的扩展,请把suhosin.so改成suhosin7.so

注意事项 php7.* 安装完后,写入php.ini扩展的文件不是叫suhosin.so,而是  suhosin7.so (亲自踩坑)
这样扩展就安装完成了。。。。
如果上面的操作有问题欢迎留言指出。

猜你喜欢

转载自www.cnblogs.com/kxcoder/p/11452731.html