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 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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

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)

share|improve this answer
    
plugin_dir_path is just a wrapper around dirname. It's body: return trailingslashit(dirname($file)); –  chrisguitarguy May 31 '12 at 3:25

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';
share|improve this answer

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.