【php安全】eavl函數禁用適用於 php7.* php5系列

php5.4 安裝擴展demo

php安裝suhosin擴展 php版本與suhosin版本:php

suhosin-0.9.38 支持到php 5.4mysql

php5.4 5.5 5.6 需安裝 https://github.com/sektioneins/suhosingit

官方的快速入門github

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

yum安裝的php,安裝suhosin擴展步驟:web

目前yum安裝的php版本爲5.4.16,可直接下載suhosin-0.9.38sql

[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查看有沒有加載成功:php7

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

yum安裝的php5.6 安裝5.6版本的phpphp-fpm

[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 (親自踩坑)
這樣擴展就安裝完成了。。。。
若是上面的操做有問題歡迎留言指出。
相關文章
相關標籤/搜索