PHP Warning: curl_exec() has been disabled for security reasons

ERROR :

PHP Warning: curl_exec() has been disabled for security reasons

[11-April-2015 10:19:48 EDT] PHP Warning: ini_set() has been disabled for security reasons in /home/user/public_html/header.php on line 200
 


 
FIX :

Log into your Linux server as root user.

How to Enable curl_exec() Serverwide for all domains

Type the below command to find the location of main PHP configuration file on the server. On my linux server main php.ini file was in location /etc/php.ini, it might be in a different location on your server.

Command : php -i | grep php.ini

PHP warning curl_exec disabled for security reasons

Edit the php.ini file using vi editor and remove “curl_exec” from disable_functions line

disable_functions = curl_exec (Remove curl_exec from here)

curl_exec() Disabled for security reasons2

Save the php.ini file and quit.

Now curl_exec() is enabled server wide for all domains.

To DISABLE curl_exec() server-wide you must add “curl_exec” to disable_functions in php.ini file.
 


 
How to Enable curl_exec() only for your domain instead of enabling server-wide

It is possible enable curl_exec() only for your domain instead of enabling it server-wide. It is bad idea to enable PHP disabled functions serverwide.

Create a custom php.ini file in the document root of the domain like shown below. Document root of my domain is /home/user/public_html
 

cp -a /etc/php.ini /home/user/public_html/

vi /home/user/public_html/php.ini

disable_functions = curl_exec,cdl,exec,fsockopen,parse_ini_file,passthru,popen,proc_open

Remove “curl_exec” from the disable_functions in php.ini. Save the php.ini file and exit.

chown user:user php.ini

 

Add the below in .htaccess file of your website.
 

vi .htaccess

suPHP_ConfigPath /home/cpaneluser/public_html/