Error with manual install: Failed opening required '__DIR__/lib/discourse.php'


(Mike) #1

I manually downloaded the latest master ZIP from the repo, dropped it into public_html/blog/wp-content/plugins/wp-discourse/, and clicked Activate. It produced the following error:

Warning: require_once(__DIR__/lib/discourse.php) [function.require-once]: failed to open stream: No such file or directory in [REDACTED]public_html/blog/wp-content/plugins/wp-discourse/wp-discourse.php on line 30

Fatal error: require_once() [function.require]: Failed opening required '__DIR__/lib/discourse.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in [REDACTED]public_html/blog/wp-content/plugins/wp-discourse/wp-discourse.php on line 30

Not sure if this was designed to install this way, but the installation notes are sparse in this regard. The only way I was able to fix it was to replace __DIR__ with WPDISCOURSE_PATH in wp-discourse/wp-discourse.php at master · discourse/wp-discourse · GitHub.

Not sure where __DIR__ is initialized, but it wasn’t clear how to best fix this. Thoughts on my fix? Is this a bug?


(Mike) #2

Additionally, after installing the plugin and attempting to trigger a post to discourse, I got:

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in [REDACTED]/public_html/blog/wp-content/plugins/wp-discourse/lib/discourse.php on line 470

Warning: file_get_contents(http://[HOSTNAME]/posts) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in [REDACTED]/public_html/blog/wp-content/plugins/wp-discourse/lib/discourse.php on line 470

Warning: First parameter must either be an object or the name of an existing class in [REDACTED]/public_html/blog/wp-content/plugins/wp-discourse/lib/discourse.php on line 475

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in [REDACTED]/public_html/blog/wp-content/plugins/wp-discourse/lib/discourse.php on line 470

Warning: file_get_contents(http://[HOSTNAME]/posts) [function.file-get-contents]: failed to open stream: no suitable wrapper could be found in [REDACTED]/public_html/blog/wp-content/plugins/wp-discourse/lib/discourse.php on line 470

Warning: First parameter must either be an object or the name of an existing class in [REDACTED]/public_html/blog/wp-content/plugins/wp-discourse/lib/discourse.php on line 475

Warning: Cannot modify header information - headers already sent by (output started at [REDACTED]/public_html/blog/wp-content/plugins/wp-discourse/lib/discourse.php:470) in [REDACTED]/public_html/blog/wp-admin/post.php on line 235

Warning: Cannot modify header information - headers already sent by (output started at [REDACTED]/public_html/blog/wp-content/plugins/wp-discourse/lib/discourse.php:470) in [REDACTED]/public_html/blog/wp-includes/pluggable.php on line 1196
  1. I setup the API key from discourse and configured the “system” username. Wordpress install is latest vanilla (4.2.2).
  • I loaded an existing post, clicked on “Post in discourse” in the publishing area and clicked “Update”
  • Above errors were displayed.

(Mike) #3

This appears to be related to the allow_url_fopen PHP config being set to OFF. Will investigate it being enabled…


(Ben Word) #4

Are you not running at least PHP 5.3?


(Mike) #5

No. It’s 5.2.17.

I’ve already determined that this server is not appropriate. I’m exploring how to run Wordpress in a docker container on the same host as discourse. I have concerns about risk of managing/exposing a PHP runtime on port 80 and having to manage multiple domains routing to the same socket. I have light devops skills, but can understand everything pretty well. Just sad that my initial effort of getting wordpress + discourse to go is turning out to be a tall order so far.

Thanks for the follow up.


(Mike) #6

For other interested parties, this appears to be the direction I will end up going in: