0

I have the following directory structure:

Root Install: /Users/philipdowner/Sites/montanaliving

Within the root installation I have the following plugin structure:

/wp-content/plugins/manifest-rets/

Then, within the plugin folder I have 2 php files manifest-rets.php phrets.php

In the main plugin file, I have the following code:

<?php
/*
Plugin Name: Manifest RETS
Plugin URI: http://manifestbozeman.com
Description: Uses the phRETS library to connect to a RETS server
Version: 1.0b
Author: Philip Downer
Author URI:http://philipdowner.com
License: GPL2
*/

define('MR_PLUGIN_PATH', plugin_dir_path(__FILE__));    

//echo MR_PLUGIN_PATH;
include_once(MR_PLUGIN_PATH.'phprets.php'); 

?>

However, when running the plugin I get the following error stating that the phrets.php file could not be found. It's driving me batty! Any suggestions? Am I overlooking something obvious?

Warning: include_once(/Users/philipdowner/Sites/montanaliving/wp-content/plugins/manifest-rets/phprets.php) [function.include-once]: failed to open stream: No such file or directory in /Users/philipdowner/Sites/montanaliving/wp-content/plugins/manifest-rets/manifest-rets.php on line 15

Warning: include_once() [function.include]: Failed opening '/Users/philipdowner/Sites/montanaliving/wp-content/plugins/manifest-rets/phprets.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.3.6/lib/php') in /Users/philipdowner/Sites/montanaliving/wp-content/plugins/manifest-rets/manifest-rets.php on line 15

I've tried passing in the ABSPATH constant, and using PHP's set_include_path() function to no avail.

2 Answers 2

1

I'm not sure why this isn't working for you.

I usually set the plugin path constant using dirname(FILE)

You could try:

define('MR_PLUGIN_PATH', dirname(__FILE__));    

//echo MR_PLUGIN_PATH;
include_once(MR_PLUGIN_PATH.'/phprets.php'); 

Also:

Are you sure phprets.php exists. You say you have phrets.php (missing the p)

1
  • plugin_dir_path is just a wrapper around dirname. It's body: return trailingslashit(dirname($file)); Commented May 31, 2012 at 3:25
0

Sounds like a problem with the way MAMP is setup. Do you have any problems with any of the theme functions like get_template_directory()?

Try it this way and see what happens.

include_once dirname( __FILE__ ) . '/phprets.php';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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