views:

44

answers:

1

I am testing an idea based on my last question, but I've run into a very interesting problem...

My home directory is on one path of the server (where all home directories reside) and for reasons I can only guess at, the PHP config for that directory does not have IMAP turned on.

However, my project directory, which exists on a test mirror of the live site does have IMAP enabled.

So what I'm testing is using a .forward file to trigger a php script when an email is sent. The only email I can easily use for this is my user email, which means I have to set up the .forward in my personal home directory.

The .forward works, but the email bounces back with part of an error. From what I can tell, the script is failing because of the "unexpected function open_imap()", which is what I got when I tried doing the whole thing in my personal folder.

So the problem seems to be that I can run the script directly from a browser, since the script is in a directory that has IMAP, but when I point an email at it from my home directory (which, again, doesn't have IMAP), it defaults to the PHP settings for the path of the file that triggered the script, not the configuration of the path of the script itself.

so:

  1. Am I totally wrong and just haven't debugged enough?
  2. If I am right, is there a way to get the script to adhere to its own path's php config?
  3. If not, is there any other way to make this work, aside from setting up all new email accounts or begging server admins to turn on IMAP?
+1  A: 

I am not sure if this is the reason but you can have different settings for php for the web server and for the command line interface. That means if you access the website, another configuration is used than if you run php from the command line.

On Debian, the settings for the Apache web server are located in /etc/php5/apache2/, and for the CLI in /etc/php5/cli/.

But I don't know if this is related to your IMAP problem.

Felix Kling
Thanks for the tip. It turns out that every function I attempt that does not need a browser (writing a file, sending an email, etc) gets an error. If I can confirm that this is CLI related, I'll mark this the answer.
Anthony
Maybe when you access via a website you extend the include path during some bootstrap process?
Felix Kling
As it turns out you were right but I was way off to begin with. I didn't have the CGI binary at the top AND imap isn't enabled. but i got it to work for other stuff, finally.
Anthony
I'm glad to hear that :)
Felix Kling