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
Tạo database trong DirectAdmin
Viewed 5130 times since Mon, Aug 17, 2015
Hướng dẫn sử dụng One-click Wordpress trên Plesk control (Linux)
Viewed 2065 times since Mon, Jan 13, 2020
Đổi domain chính cho hosting DirectAdmin
Viewed 3672 times since Mon, Aug 24, 2015
Tạo Addon Domain trong DirectAdmin
Viewed 3299 times since Mon, Aug 24, 2015
Hướng dẫn khởi tạo và quản lý email
Viewed 4759 times since Mon, Mar 14, 2016