• Resolved nrgini

    (@nrgini)


    I have an account on Siteground with multiple sites on my account. I found it easy to follow the step-by-step instructions on “Web Application Firewall Setup” for one site: “SiteGround and other hosts without .user.ini support.” But I’m not so clear on how to make it work for multiple sites from the instructions quoted below.

    To get to each site’s subdirectory to add the code given: “SetEnv PHPRC /home/user/public_html/sitename/php.ini“, do I go to File Manager, then “Document Root for example.com”? I see “.htaccess” in there. Right-clicking on that gives me a number of choices, including “Edit” and “Code Edit.” Do I choose one of those? Also, how do I adjust the path for the site and the site’s directory name, before adding the code to the .htaccess file?

    If you have multiple sites on a single hosting account and need to use php.ini like in the cases above, you may need to add a similar php.ini file for each additional site, in each site’s subdirectory. In this case, you may also need to add code like this in each additional site’s .htaccess file, to tell PHP which php.ini file to use:

    SetEnv PHPRC /home/user/public_html/sitename/php.ini
    You will need to adjust the path for your site and the site’s directory name, before adding this to the .htaccess file. If the subdirectory site’s .htaccess file already has a similar line, this change may not be needed.

    Note: Some hosts may require PHPRC to show the path without “php.ini” at the end.

Viewing 7 replies - 1 through 7 (of 7 total)
  • @nrgini – My name is Ivan Atanasov, I am part of the Senior Support team at SiteGround.

    You are totally correct, when adding a custom php.ini file in a subdirectory you are using for a website running WordFence – the path will change.

    Go to your SiteGround cPanel -> File Manager -> navigate to the Directory Root of the application you wish to set up -> right click on the .htaccess file -> Edit. This will allow you to add the required line (I recommend that you add it at the top of your .htaccess file for easy management afterwards).

    The path of the site is adjusted based on it’s location inside public_html – following this model, this needs to be the absolute path to the application.

    Of course, I am ready to assist with these steps should you decide to open a ticket in our system and share it’s ID in this discussion.

    Hi @nrgini I can see Ivan’s reply should help you to know the sitename needs to be added to “SetEnv PHPRC” line of code.

    Thanks Ivan for helping out in this thread.

    Thread Starter nrgini

    (@nrgini)

    One more question: there was a similar line of code already at the top of the .htaccess file. Should I replace it with this new one?

    Is this line of code pointing to a custom “php.ini” file in the same sub-directory? if so, then you can add the auto_prepend_file line of code directly in this “php.ini” file.

    Reference:

    If the subdirectory site’s .htaccess file already has a similar line, this change may not be needed.

    https://docs.wordfence.com/en/Web_Application_Firewall_Setup#Using_php.ini_with_multiple_sites_on_a_single_hosting_account

    Thanks.

    Thread Starter nrgini

    (@nrgini)

    It looks like Wordfence works even if I am unsuccessful in configuring by sites. Is this correct?

    What you are trying to do is the “Web Application Firewall Setup“, without this setup, the firewall protection level will be set to “Basic WordPress Protection” which can protect against many attacks, however, after setting up the firewall to “Extended Protection” this will allow the firewall to run before WordPress even starts, protecting against additional attacks. All other plugin’s features will be working fine in both cases.

    Thanks.

    Hello nrgini!

    I hope we were successful in helping you resolve your issue with Wordfence! Since we have not heard back from you in the past 2 weeks I will now be marking this support thread as resolved. However, if we still haven’t resolved your issue please reach out to us as we would be more than happy to further assist you!

    Thanks and have a great day!
    Chloe

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Specific instructions on how to add php.ini for multiple sites on one account’ is closed to new replies.