• Resolved onty

    (@onty)


    Hello WordFence Support Engineers,

    I have been trying to make WordFence work with my site on SiteGround. I actually have 2 sites there: and with my secondary site it works, but not with my main site.

    I get errors like this:

    Warning: array_merge(): Argument #2 is not an array in /home/username/public_html_domains/art-of-software-testing.com/wp-includes/load.php on line 63
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/username/public_html_domains/art-of-software-testing.com/wp-includes/load.php:63) in /home/usernamepublic_html_domains/art-of-software-testing.com/wp-content/plugins/sg-cachepress/class-sg-cachepress.php on line 348
    
    Warning: Cannot modify header information - headers already sent by (output started at /home/username/public_html_domains/art-of-software-testing.com/wp-includes/load.php:63) in /home/username/public_html_domains/art-of-software-testing.com/wp-content/plugins/sg-cachepress/class-sg-cachepress.php on line 360

    Although these errors are about other plugins, everything works just fine until I install and enable WordFence.

    I have set it up by editing php.ini and pasting the exact text shown provided by WordFence. I did not change any WordFence settings from default ones (although it may be possible that some old settings were still in my DB from a previous install of WordFence).

    I strongly prefer your solution to other security packages for WordPress. If you can help me figure out how to make it work for my site, I will purchase 2 years of WordFence for my site!

    Many thanks,

    onTy

Viewing 15 replies - 16 through 30 (of 30 total)
  • @borislavzlatanov: Thank you for the suggestion

    @onty:

    It would be interesting to compare what configuration Wordfence sees for both environments.

    For both the problematic Wordfence instance and the one that is working fine, could you please check the Wordfence System Info page:

    • Go to the Wordfence Tools page
    • Click the Diagnostics tab
    • In the Other Tests section (near the bottom of the page), click the link that reads “Click to view your system’s configuration in a new window“. This will open the Wordfence System Info page.

    And then compare both environments, in particular the following parameters:

    • Server API
    • Loaded Configuration File
    • PHP Version
    • cURL support
    • cURL Information

    On the Wordfence –> Tools –> Diagnostics page, you might also want to compare the WordPress section for both sites.

    On that same page, can you see any files listed under “Log Files (Error messages from WordPress core, plugins, and themes)”. If so, please download them to check their content.

    @onty
    Make a condition in /wp-includes/load.php on line 63

    if ( is_array( $default_server_values) ) {
    $_SERVER = array_merge( $default_server_values, $_SERVER );
    }

    ??

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    Cybernetics: Please do not ask people to modify WordPress core files!

    Hi @onty,

    As you’ve managed to get both your site and Wordfence up and running, I will mark this topic as resolved for now.

    The issue and its “unexplained” resolution could have been related to a plugin (not necessarily Wordfence) update or a configuration change on your host.

    Should the problem happen again, I suggest you enable WP_DEBUG in order to gather more information and create a new thread so we can further investigate.

    I ran into this problem today and I am also using Siteground. I didn’t have a problem until I tried to update the WAF settings using the recommendations found at:

    https://docs.wordfence.com/en/Web_Application_Firewall_Setup#SiteGround_and_other_hosts_without_.user.ini_support

    At first I opened a support chat and the way we resolved the issue was to downgrade PHP from 7 to 5.6. But, I want to use PHP7 so later I opened a more detailed trouble ticket with Siteground and the answer was that this is actually a known problem. Specifically, here is what the tech responded:

    The issue was a known problem related to a default settings on our shared hosting platform, whose current default values are:
    Code:
    opcache.interned_strings_buffer = 8
    opcache.memory_consumption = 128

    The aforementioned values does not seem to suffice for some heavier WordPress themes and plugins and so when we increase them the issue at hand is resolved.

    In my case, he upgraded those settings and the problem did indeed go away. So, if you are having this issue on Siteground, open a trouble ticket and see if they will get you sorted out. Not sure about other hosting companies or circumstances.

    On SiteGround servers you can easily modify PHP variables(using a local php.ini file or directly via the control panel -> PHP Variables tool) and there is no need to explicitly contact the host for it. If one is using PHP 7.* for a website and a plugin or theme requires higher opcache settings values as described above, those can be adjusted by the website owner.

    I had these error messages on siteground on a fresh default WordPress 4.8 installation. The first error message was on the home page and in Admin.

    Warning: array_merge(): Argument #2 is not an array in /home/username/public_html/wordpress/wp-includes/load.php on line 63

    Warning: Cannot modify header information – headers already sent by (output started at /home/username/public_html/wordpress/wp-includes/wp-includes/load.php:63) in /home/username/public_html/wordpress/wp-includes/option.php on line 837

    Warning: Cannot modify header information – headers already sent by (output started at /home/username/public_html/wordpress/wp-includes/wp-includes/load.php:63) in /home/username/public_html/wordpress/wp-includes/wp-includes/option.php on line 838

    Also, the Add Theme (theme-install.php) page would not work with an error message with no specific reason why.

    After a few rounds with support, tech finally did this to solve it:

    I think that I was able to resolve the original issues that you have described.

    What I did was to add the following lines to the public_html/wordpress/php.ini file:

    Code:
    output_buffering = On
    opcache.interned_strings_buffer = 16
    opcache.memory_consumption = 400

    The first line will correct the headers already sent warning message which is due to code that is not sending HTTP headers in the beginning of the script that is being executed. Unfortunately, I cannot tell which script may be causing this warning.

    The other two lines increase settings of the Zend OpCache module which is active by default with all PHP 7.x versions.

    Please have in mind that I also had to rename the .opcache folder that is located in the /home directory of the hosting account.

    Let us know if there are still issues that we should address.

    korg007

    (@gillesgagnon)

    Thanks so much for posting the last solution macksix. Especially the special note regarding deleting (renaming) the .opcache folder.
    This did the trick to solve the issue at my end as well.
    Cheers!

    @martinvelikov hear hear! Thanks, that was lifesaving!

    @macksix THANK YOU! Agreed, life saver.

    I’m surprised this isn’t in the Wordfence documentation, seems to be common.

    photoMaldives

    (@photomaldives)

    I also had this issue, on only one of my sites under the same Siteground account.
    Thanks for the tips on this page (and for google for bringing me here).
    Adding these extra lines to PHP.INI did not help, so I simply deleted the file (renamed it) as described here, which did fix the problem.

    Neither solution worked for me – I have multiple installs that are not finishing the scans. My sites on different hosts (hostgator, etc.) are working perfectly fine.

    If you don’t delete the .opcache folder it may not work putting the settings in the php.ini file, but settinga from other host in your php.ini may not work right, so you can remove all the settings in it and just put the entries I posted above to see if they work. You also need the .htaccess entry to point to your local php.ini file for the entries to work.

    This should be at top of .htaccess

    SetEnv PHPRC /home/your_username/public_html/your_wordpress/php.ini

    I have since moved to Incendia Web Works.

    • This reply was modified 6 years, 11 months ago by macksix.
    • This reply was modified 6 years, 11 months ago by macksix.

    Thanks so much @macksix

    I too had this problem on Siteground when enabling the Firewall in Wordfence on a fresh WordPress 4.9.2 install as per the info on this page: https://docs.wordfence.com/en/Web_Application_Firewall_Setup to create a php.ini

    I immediately got the PHP error: “Warning: array_merge(): Argument #2 is not an array in ../load.php on line 63”

    Error only occurred with PHP 7.2.1 not with 7.1.13

    Added your code to the php.ini, renamed the .opcache folder, error sorted under all PHP versions

    @wfyann maybe the Web_Application_Firewall_Setup page could be updated with this info or a least a link to this thread.

    @sterndata agreed about modifying core files but maybe the WordPress dev team could look at better error handling/defensive code in load.php or am I missing the point?

    Thanks everybody for your help sorting these niggly issues what would we do without you.

    Basil ??

    Thanks so much @macksix

    I too had this problem on Siteground when enabling the Firewall in Wordfence on a fresh WordPress 4.9.2 install as per the info on this page: https://docs.wordfence.com/en/Web_Application_Firewall_Setup to create a php.ini

    I immediately got the PHP error: “Warning: array_merge(): Argument #2 is not an array in ../load.php on line 63”

    Error only occurred with PHP 7.2.1 not with 7.1.13

    Added your code to the php.ini, renamed the .opcache folder, error sorted under all PHP versions

    @wfyann maybe the Web_Application_Firewall_Setup page could be updated with this info or a least a link to this thread.

    @sterndata agreed about modifying core files but maybe the WordPress dev team could look at better error handling/defensive code in load.php or am I missing the point?

    Thanks everybody for your help sorting these niggly issues, what would we do without you.

    Basil ??

Viewing 15 replies - 16 through 30 (of 30 total)
  • The topic ‘Problems getting WordFence to work with my site on SiteGround’ is closed to new replies.