Seth Knorr
Seth Knorr

Reputation: 1

php function imap_open failing when run through command line on windows with script

I am running Windows Server 2012, and is also running apache and PHP on an intranet.

When I pull the script through http://localhost/script.php it runs without issue and no problems.

When I run the same script through the command line with the prompt: C:\wamp\bin\php\php5.3.3\php.exe C:\wamp\www\script.php

it dies at the line when it gets to imap_open.

Here is the full code:

$hostname = '{email-host:995/pop3/ssl/novalidate-cert}INBOX';
$username = 'user';
$password = 'password';

$inbox = imap_open($hostname,$username,$password) or die('Cannot connect: ' . imap_last_error());

Any ideas on why it will not work through command prompt.

in php.ini, I have included:

extension=php_imap.dll

extension=php_openssl.dll

Upvotes: 0

Views: 405

Answers (1)

ArtisticPhoenix
ArtisticPhoenix

Reputation: 21681

Enable the extension in the cli.ini or php-cli.ini file. Which is a separate config then the one Apache uses.

That's my guess at least... Without knowing what error you get when it dies.

Upvotes: 0

Related Questions