tags:

views:

33

answers:

1

I'm not a php developer but I'm fiddling with MAMP. I've installed MAMP and my php include() calls aren't working.

[13-Jul-2010 19:23:30] PHP Fatal error:  require_once() [<a href='function.require'>function.require</a>]: Failed opening required '1' (include_path='.:/Applications/MAMP/bin/php5.3/lib/php:/Applications/MAMP/htdocs/mt_sandbox/php/') in /Applications/MAMP/htdocs/mt_sandbox/php/email/owner_emails.php on line 5

As you can see there, I was trying to edit my php.ini file to use a second include path to the 'php' directory of my project 'mt_sandbox'.

Here are the exact includes

require_once("Mail.php") or die ('php load error for Mail.php');

require_once('/Applications/MAMP/htdocs/mt_sandbox/php/email/email_manager.php') or die ('php load error for email/email_manager.php');

The die messages aren't firing because I'm getting the PHP Fatal error.

Can anyone tell me what I'm doing wrong? How can I get setup to use includes in my scripts?

A: 

Use an absolute path to the file you're including

Swish
I do want to deploy this to production when I'm done. Won't I have to manually tweak all the include paths if I use an absolute path?
John Leonard
Well, the a relative path would be better ;-) Are you absolutely sure the files exist where you expect them to?
Swish
I'm trying to include 2 files. The first is the Pear Mail.php file. The second is one of my own. Neither is getting included and I definitely have the right url to my file because it is sitting in the same directory as the one I'm pulling up in the browser.
John Leonard