Home » Php » Help with path issue? – PHP

Help with path issue? – PHP

Posted by: admin February 23, 2020 Leave a comment

Q(Question):

I have a file named Snoopy.class.php on my hosted web server in a
directory called d:\home\ABC.COM\blog\wp-content\plugins\

A file named dahnielson_mimetex.php references it. However, when
dahnielson_mimetex.php tries to reference the Snoopy file, I get these

types of errors:

Warning: main() [function.include]: Failed opening
‘./Snoopy.class.php’ for inclusion
(include_path=’.;C:\php5\pear’) in
d:\home\ABC.COM\blog\wp-content\plugins\dahnielson_mimetex.php
on line 34

The person that wrote the Snoopy file tried to help me but it isn’t
going so well. You can see his suggestions here
http://www.anlak.com/?page_id=66.

Does any one have ideas on how I can fix this?

Thanks,
Brett

A(Answer):

Hi,

You might try using:

require_one(dirname(__FILE__) . ‘\\Snoopy.class.php’);

>From dahnielson_mimetex.php. Issue may be related to the current

working directory using the PHP ISAPI module? Not sure.

brett wrote:

I have a file named Snoopy.class.php on my hosted web server in a
directory called d:\home\ABC.COM\blog\wp-content\plugins\

A file named dahnielson_mimetex.php references it. However, when
dahnielson_mimetex.php tries to reference the Snoopy file, I get these

types of errors:

Warning: main() [function.include]: Failed opening
‘./Snoopy.class.php’ for inclusion
(include_path=’.;C:\php5\pear’) in
d:\home\ABC.COM\blog\wp-content\plugins\dahnielson_mimetex.php
on line 34

The person that wrote the Snoopy file tried to help me but it isn’t
going so well. You can see his suggestions here
http://www.anlak.com/?page_id=66.

Does any one have ideas on how I can fix this?

Thanks,
Brett

A(Answer):

Maybe it’s not an IIS issue…. Don’t know! What’s your environment?

pe*******@gmail.com wrote:

Hi,

You might try using:

require_one(dirname(__FILE__) . ‘\\Snoopy.class.php’);

From dahnielson_mimetex.php. Issue may be related to the current

working directory using the PHP ISAPI module? Not sure.

brett wrote:

I have a file named Snoopy.class.php on my hosted web server in a
directory called d:\home\ABC.COM\blog\wp-content\plugins\

A file named dahnielson_mimetex.php references it. However, when
dahnielson_mimetex.php tries to reference the Snoopy file, I get these

types of errors:

Warning: main() [function.include]: Failed opening
‘./Snoopy.class.php’ for inclusion
(include_path=’.;C:\php5\pear’) in
d:\home\ABC.COM\blog\wp-content\plugins\dahnielson_mimetex.php
on line 34

The person that wrote the Snoopy file tried to help me but it isn’t
going so well. You can see his suggestions here
http://www.anlak.com/?page_id=66.

Does any one have ideas on how I can fix this?

Thanks,
Brett

A(Answer):

Do you have open_basedir or safe_mode on the host? Maybe that’s messing
w/something.

brett wrote:

I have a file named Snoopy.class.php on my hosted web server in a
directory called d:\home\ABC.COM\blog\wp-content\plugins\

A file named dahnielson_mimetex.php references it. However, when
dahnielson_mimetex.php tries to reference the Snoopy file, I get these

types of errors:

Warning: main() [function.include]: Failed opening
‘./Snoopy.class.php’ for inclusion
(include_path=’.;C:\php5\pear’) in
d:\home\ABC.COM\blog\wp-content\plugins\dahnielson_mimetex.php
on line 34

The person that wrote the Snoopy file tried to help me but it isn’t
going so well. You can see his suggestions here
http://www.anlak.com/?page_id=66.

Does any one have ideas on how I can fix this?

Thanks,
Brett

A(Answer):

Maybe it’s not an IIS issue…. Don’t know! What’s your environment?

I’m new to PHP. What in particular do you mean by environment? I’m on
a hosted machine so I’ll probabably have to call and get those answers.
Unless there is another way to do it.

You might try using:

require_one(dirname(__FILE__) . ‘\\Snoopy.class.php’);

>From dahnielson_mimetex.php. Issue may be related to the current

working directory using the PHP ISAPI module? Not sure.

What code do I substitute for the above?

Thanks,
Brett

A(Answer):

brett wrote:

>>Maybe it’s not an IIS issue…. Don’t know! What’s your environment?

I’m new to PHP. What in particular do you mean by environment? I’m on
a hosted machine so I’ll probabably have to call and get those answers.
Unless there is another way to do it.

>>>You might try using:

require_one(dirname(__FILE__) . ‘\\Snoopy.class.php’);

From dahnielson_mimetex.php. Issue may be related to the current
working directory using the PHP ISAPI module? Not sure.

What code do I substitute for the above?

Thanks,
Brett

Brett,

This is entirely system dependent. You need to point to the file where
you loaded it.

require_once(…) (not require_one as you have it above) uses a relative
or absolute pathname.

I usually use a path relative to my server root directory. That way I
can move it and not need to change any code, i.e.

require_once($_SERVER[‘DOCUMENT_ROOT’] . ‘/relative/path/to/file.ext’);

==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

A(Answer):

@Brett:
It looks like the files are in the same directory – if that’s the case,
then just use the following code:

require_once("./Snoopy.class.php");

A(Answer):

You might try using:

>
require_one(dirname(__FILE__) . ‘\\Snoopy.class.php’);

If I replace the include line with the above, I get this:

Fatal error: Call to undefined function require_one() in
d:\home\ABC.COM\blog\wp-content\plugins\dahnielson_mimetex.php on line
37

A(Answer):

require_once($_SERVER[‘DOCUMENT_ROOT’] . ‘/relative/path/to/file.ext’);

I used this and it worked perfect. Thanks.

A(Answer):

@Brett:

Have you tried deactivating and removing the plugin and starting over?
Did you create the wp-content/cache directory?

I just installed this plugin on my local copy of wordpress 2.0.3 and it
worked perfectly after i created the cache directory.

I used the modified version of the plugin @
http://www.anlak.com/?page_id=66

On Oct 21, 10:37 pm, "brett" <acco…@cygen.comwrote:

You might try using:

require_one(dirname(__FILE__) . ‘\\Snoopy.class.php’);If I replace the include line with the above, I get this:

Fatal error: Call to undefined function require_one() in
d:\home\ABC.COM\blog\wp-content\plugins\dahnielson_mimetex.php on line
37

A(Answer):

"brett" <ac*****@cygen.comwrote:

>You might try using:

require_one(dirname(__FILE__) . ‘\\Snoopy.class.php’);

If I replace the include line with the above, I get this:

Fatal error: Call to undefined function require_one() in
d:\home\ABC.COM\blog\wp-content\plugins\dahnielson_mimetex.php on line
37

Of course it does. That’s because it is misspelled. It should be
require_once, not require_one.

Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.