naming, navigating files...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

naming, navigating files...

Post by jmilane »

Hello,

I get this message:

Code: Select all

Fatal error: require() [function.require]: Failed opening required './includes/phpmailer/class.phpmailer.php' (include_path='.;C:\WAMP\xampp\htdocs\drupal\modules\civicrm;C:\WAMP\xampp\htdocs\drupal\modules\civicrm\packages;.;C:\WAMP\xampp\php\pear\') in C:\WAMP\xampp\htdocs\drupal\modules\civicrm\CRM\Profile\Form\Edit.php on line 55
And I know that means that this script cannot find the class.phpmailer.php file. Okay.

It looks for the file based on the include path, right?

So I need to change the include path?

Or can I reference the absolute path of phpmailer.php?

Thing is, I cant even tell you what the absolute path is. The properties of the file only say that it is in /includes... so I cant really get the absolute path.

This script that is looking for phpmailer.php is at 127.0.0.1/drupal/file.php

Argh!

Thank you...

Is there an easier way to do this? I dont know what

Code: Select all

"../"
or

Code: Select all

."/
means before filenames... it seems like sometimes the period is inside quotes and sometimes it is outside quotes...
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

.. = parent directory
. = this directory
What "." is initially can be found by getcwd(). $_SERVER['DOCUMENT_ROOT'] may be illuminating.

..and yes, an absolute path is the first line of acceptance. Relative paths run through the include path.
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

A relative path is would be something like "/includes/file.inc.php". It is relative to the current working directory.

An absolute path would be something like "C:\httpdocs\site_name\includes\file.inc.php".

"." refers to the current working directory and you probably don't need to use it.
".." refers to the parent directory of the current working directory.

Try

Code: Select all

require('includes/phpmailer/class.phpmailer.php');
EDIT: You beat me feyd. :P
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

Post by jmilane »

Daedalus- wrote:A relative path is would be something like "/includes/file.inc.php". It is relative to the current working directory.

An absolute path would be something like "C:\httpdocs\site_name\includes\file.inc.php".

"." refers to the current working directory and you probably don't need to use it.
".." refers to the parent directory of the current working directory.

Try

Code: Select all

require('includes/phpmailer/class.phpmailer.php');
EDIT: You beat me feyd. :P
Thanks Feyd... I appreciate the info.

I get this now:

Code: Select all

Fatal error: require() [function.require]: Failed opening required 'includes/phpmailer/class.phpmailer.php' (include_path='.;C:\WAMP\xampp\htdocs\drupal\modules\civicrm;C:\WAMP\xampp\htdocs\drupal\modules\civicrm\packages;.;C:\WAMP\xampp\php\pear\') in C:\WAMP\xampp\htdocs\drupal\modules\civicrm\CRM\Profile\Form\Edit.php on line 55
I just cant find phpmailer.php

I know I have it though... it works elsewhere.
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

Post by jmilane »

So I just copied phpmailer.php and pasted it into the path.

Bad idea?

8O
User avatar
daedalus__
DevNet Resident
Posts: 1925
Joined: Thu Feb 09, 2006 4:52 pm

Post by daedalus__ »

What do you mean pasted it into the path?
jmilane
Forum Commoner
Posts: 89
Joined: Mon Aug 07, 2006 6:05 pm

Post by jmilane »

Daedalus- wrote:What do you mean pasted it into the path?
I mean I went and found the file and put it into the path where it could be found.

I cant really figure out how to change the path so that it finds the file.

Is this a bad idea?

I know this sounds stupid... but Im psyched that it works.
Post Reply