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
Backup hosting DirectAdmin
Viewed 4371 times since Tue, Aug 25, 2015
Hướng dẫn reset password cho hosting plesk
Viewed 3728 times since Sun, Jan 3, 2016
Tạo Hosting Window trên Plesk Control
Viewed 3611 times since Tue, Aug 25, 2015
Làm thế nào để xóa mail queue trong cPanel Hosting
Viewed 3791 times since Wed, Aug 26, 2015
Tạo database trong DirectAdmin
Viewed 5087 times since Mon, Aug 17, 2015