Auto-prepending php file in cyberpanel the correct way

I am using Ninjafirewall plugin on my WordPress and it’s asking me put the rule into to php.ini file but I am not sure which file to edit.

Log in to your Openlitespeed admin dashboard, click on “Virtual Host”, select your domain, add the following instructions to the “php.ini Override” section in the “General” tab, and restart Openlitespeed:

php_value auto_prepend_file "/home/"

Please help

Ramdhan Mubarak @webmasteroffers

Using OLS you use List Websites → → Manage → vHost

Add the phpIniOverride or use it if its there

phpIniOverride  {
php_value auto_prepend_file "/home/"

Sometimes you have to reboot the server or restart php for you to see changes have been effected

Thank you for your support. However, it didn’t work

Oops! Full WAF mode is not enabled yet.
Make sure you followed the instructions and restarted Openlitespeed.

I put that code into vHost, save and reboot the server. I also tried with .htaccess file from this topic Cannot activate Full Waf ! |

But still not working.

Please help

Try add the directive to .htaccess using Rewrite Rules

Go to List websites → → ReWrite Rules

Yes, I did but didn’t work as well

# BEGIN NinjaFirewall
<IfModule Litespeed>
php_value auto_prepend_file "/home/"
# END NinjaFirewall

Did you do this

Sure, I did

1 Like

Try fix file permissions under that path

I checked and all files and folders have the same owner - user:group (wwwop9555:wwwop9555), 644 for files

So I am not sure what file permissions you mention.

Go to List Websites → → File Manager → Fix Permissions

Thank you for your reply. Clicked “Fix Permissions” but no luck

I am trying to use per-user php.ini and reading this post PHP Per User php.ini in LiteSpeed Web Server | LiteSpeed Documentation (

and add PHPRC from this how to use your php.ini for each domain? - Support and Discussion / Web Server - CyberPanel Community

But I don’t know how to add PHPRC !?

Could you please give me a hint?


Go to WebAdmin Console → Virtual Host → External App

Add it as instructed here:

I got it working, I did steps below:

  1. Set the OLS password and access to OpenLiteSpeed webadmin via port 7080 (need to open this port in firewall)
  2. Login to webadmin and add to **Admin Console > Configuration > Server > External App
    Then: Under Environment section
  3. Save it and restart OLS.

Thank you again for your support.

p/s: Of course, you need to add to vHost file the code look like below too.

phpIniOverride  {
php_value auto_prepend_file "/home/"

Replace with your domain.


This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.