Hi @scmsteve
Could you post a PHP error log for this request?
I am not correlating any errors to it. I see those in the webserver logs, but I don’t know the exact action that is causing them to duplicate it.
I did try a get request on that and I get a 500 response code, this is in the webserver log:
“GET /wp-content/plugins/ti-woocommerce-wishlist-premium/includes/api/ajax.php HTTP/1.1” 500 0 “-”
But there is nothing logged to the PHP error log. If I can produce some output I will come back and post it.
@scmsteve You can message us via our support chat or email and we can do a quick debug for you.
I put a temporary php file in the same directory in your plugin, and I can call that and it executes, so it is not a permissions/restriction problem. I duplicated portions of your code into that file to verify that your logic is properly finding the wp-config.php and wp-load.php files.
If I try to execute “@require( $config_file )”, as you do in your code, I get the 500 error also. So it is that line that is causing the problem, which may also be why I am seeing no debug log output because it hasn’t initialized yet?
If I fire up a WP-CLI session and issue that @require with the file path, I get a return value of 1 which should indicate success, so by itself that is not the issue.
I also find it interesting that I see this on two test sites running in separate droplets at Digital Ocean as well as our main site running on an entirely different hosting provider, so it seems it is maybe not a specific host configuration issue.
Oh, I removed the @ from the require statement and received the error…
We have our wp-config.php one directory above the public_html directory, as supported by WordPress. So when it tries to load the wp-config.php it is looking for wp-settings.php in that same directory which is not found.
If I moved our wp-config.php to inside the public_html directory, then it works, but for security (however small it is) we do not want it placed there, and so far it has never caused us problems with other plugins.
Ok, My last post because I think this may resolve it. I did not set this up, it was set up quite a long time ago by someone else, but in just revisiting the topic of putting the wp-config.php in a parent folder, they all suggest that setting the ABSPATH (at the bottom, and if it was not already set) in that file should reference the actual document root, and in our case it was returning the location of the wp-config.php file itself. Maybe the way that WordPress normally loads things it defines it properly before loading our wp-config.php file, but when called directly by your ajax.php file it was not. Setting this path properly seems to resolve the issue.