Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Ok, I've fixed it. Turns out that there was a php class name that was getting redeclared. Declared once in the theme, and once in the plugin.

share|improve this answer
    
Please dont forget to accept your answer –  Brady Jul 14 '11 at 16:37
    
I haven't, just waiting for the 24 hour period to pass. –  Pippin Jul 14 '11 at 17:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.