Enable ini_set using custom php.ini

If you’re on shared hosting using cPanel as the control panel, you’d probably has the same problem as mine. The ini_set function is disabled by the hosting company for security purposes. Yeah, I know it’s for security purposes, but if I have to use it, I have to use it.

So I’ve learned from others on how to enable it.

  1. Go to your public_html directory.
  2. Create an empty php.ini and place the following line into it, without the ini_set.
    (Note: Best practice is to copy the line from your host server’s /usr/local/lib/php.ini and remove the function you want to enable)


    disable_functions = allow_url_fopen, escapeshellarg, escapeshellcmd, ini_alter, popen, show_source

  3. Open or create your .htaccess at public_html level and enter the following line.

    suPHP_ConfigPath /home/%user%/public_html/

    (Replace %user% with your account name)


That’s it.


Warning: Enabling any of the disabled functions may pose security risks to your website. Do it at your own risks. You’ve been warned. 

  • 62 Users Found This Useful
Was this answer helpful?