Enable system() and exec() functions on hosting?

匆匆过客 提交于 2019-12-01 05:40:36

If your host disabled these functions there will be no way to enable them. You can either consider contacting your host to see if they would enable them for a per account basis or if you are using Free hosting you may consider upgrading to a paid version of their hosting for those functions to be enabled. They are disabled by the host for security reasons. Your only course of action however if to contact your web host or try upgrading to paid hosting(if not already).

Some hosting providers enable the ability to override php.ini settings from within .htaccess (if Apache Httpd) or using a separate php.ini file from somewhere within the hosting account directory.

I am not familiar with your hosting provider and so cannot comment on whether this will be possible. However, I can say that if you are able to take advantage of such a facility, you are probably looking for the disable_functions directive.

As a further piece of advice, if you find yourself able to "re-enable" protected PHP functions and this is on a client's account, I cannot stress enough how important it is you remember to "re-disable" them again afterwards (disabling exec() and system() on hosting accounts is increasingly becoming a necessity as exploits and simple mistakes are extremely costly to server security).

Elijah, I too had the very same problem about the system() and exec() NOT inabled in php.

Just download the php.ini file that is in the root of your website via FTP and you'll find something like this:

register_globals = On
safe_mode = Off
enable_dl = On
disable_functions = "exec,passthru,shell_exec,proc_open,popen,system,curl_exec,curl_multi_exec,parse_ini_file,show_source"

Just remove exec,(the first word in the line between "") that is on the disable_functions line and also remove system,

Don't forget to remove the comas (,) with the two words.

It worked for me.

Mind you, I had created this php.ini file myself about a month ago but I don't know why, by changing the php version in cPanel, the exec and system came back.

Follow also the good advice given here by plasmid87 to putt it back on when finish with creating the clone of your site.

Mario Bruneau

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!