Home » Categories » Multiple Categories

Vô hiệu hóa chức năng hàm PHP sử dụng php.ini

Để vô hiệu hóa các hàm trong PHP, người dùng có thể tự vô hiệu hóa sử dụng php.ini. Trong bài viết này sẽ hướng dẫn cách vô hiệu hóa chức năng PHP sử dụng disable_functions.

Xác định file php.ini và vô hiệu hóa hàm chức năng

Để xác định đường dẫn tới file php.ini bạn có thể chạy lệnh sau:

#php -i | grep php.ini

hoặc

#whereis php.ini

Sau khi có đường dẫn cụ thể bạn dùng lệnh sau để sửa file:

#vi /etc/php/php.ini

Để vô hiệu hóa chức năng bạn tìm dòng sau:

disable_functions =

Và thêm các hàm cần vô hiệu hóa theo dạng:

disable_functions = “function1, function2, …, function(n)”

Một số hàm thường được vô hiệu hóa

disable_functions = “apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, eval, exec, fp, fput, ftp_connect, ftp_exec, ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist, highlight_file, ini_alter, ini_get_all, ini_restore, inject_code, mysql_pconnect, openlog, passthru, php_uname, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode”

Lưu ý: hàm mail() có thể phải vô hiệu hóa khi hiện tượng spam mail diễn ra.

Sau khi vô hiệu hóa bạn cần phải khởi động lại dịch vụ:

service httpd restart

hoặc

/etc/init.d/httpd restart

Article Rating (No Votes)
Rate this article
 
Attachments Attachments
There are no attachments for this article.
Related Articles
Sử dụng FileZilla để kết nối FTP đến hosting
Viewed 5875 times since Tue, Aug 25, 2015
[Reseller] Tạo host Linux trên gói Reseller
Viewed 5017 times since Tue, Dec 4, 2018
Hướng dẫn backup website trên Cpanel
Viewed 4970 times since Wed, Nov 25, 2015
Hướng dẫn restore cho reseller trong DirectAdmin
Viewed 3753 times since Sat, Sep 5, 2015
Hướng dẫn sử dụng One-click Wordpress trên Plesk control (Linux)
Viewed 2382 times since Mon, Jan 13, 2020