开发者

MAMP php includes

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='fun开发者_开发技巧ction.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?


I ran across this same issue after upgrading to Mountain Lion. Considering how old your post is I assume you have solved this, but figure an answer may be useful for others searching.

When installing pear extensions for MAMP make sure to run your commands using the pear package in MAMP. If pear is already installed outside of MAMP and you execute

pear install -a Mail

This will fire off the wrong pear function. Executing this will tell you which pear function you are using.

which pear

For me it was in /opt/local/bin/pear

To use the MAMP pear function I navigated into this directory '/Applications/MAMP/bin/php/php5.4.4/bin' and used this command

./pear install -a Mail

This fired the pear command in MAMP and installed the package for me.


Use an absolute path to the file you're including

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜