I'm loading wp-load.php in order to access WP functions inside of a PHP file that I'm using to process form submissions.
Everything works perfectly fine on localhost and every server I've tested (except one). It does not, however, work on one particular server (which is running on rackspace).
I'm loading it like this:
$oldURL = dirname(__FILE__); $newURL = str_replace(DIRECTORY_SEPARATOR . 'wp-content' . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . 'cgc-post-image-gallery' . DIRECTORY_SEPARATOR . 'includes', '', $oldURL); include($newURL . DIRECTORY_SEPARATOR . 'wp-load.php');
This is in a file called process-submission.php that is called when the form is submitted. The error is thrown after the form is submitted.
Unfortunately, the server is configured such that it does not display what the actual error is, only that an error has occurred.
The really weird thing is that I have another plugin running (that I wrote) on the exact same server and site that is loading wp-load.php in the exact same manner, except it works perfectly fine!
Through some testing I have been able to determine that the error is thrown the moment the include() function is reached.
I thought perhaps this file loading wp-load.php and the other plugin (the one that is working) loading the file might be causing a conflict, but the other one still works perfectly fine. Also, neither of the files are ever actually loaded in WP (only accessed from the form on the front end), so there is no redeclaring of anything.
Any ideas why including wp-load.php would throw an error in this instance, but not the other?
The problem also occurs if I try to load wp-blog-header.php