Question

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?
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top