Page 1 of 1

[SOLVED] Running PHP CLI - Cannot find module

Posted: Sun Jan 08, 2006 5:52 am
by anjanesh
One line code :

Code: Select all

<?php
echo "Hello";
?>
Tried running this on my WinXP PC - Apache 2.0.52 + PHP 5.1.1

Code: Select all

C:\php>php C:\xxx\xxx\cli.php
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (SNMPv2-SMI): At line 0 in (none)
Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TM): At line 0 in (none)
Hello 
C:\php>
Working but giving this long list of Cannot find module but the same doesnt occur on my hosting linux server when I ran it through Putty.

Any idea how to get rid of these warnings ? Or not load these modules by default.

Thanks

Posted: Sun Jan 08, 2006 8:28 am
by Weirdan
comment out this line in php.ini:

Code: Select all

.......
extension=php_snmp.dll
.......

Posted: Sun Jan 08, 2006 10:00 am
by anjanesh
Hmmm...thats strange - no startup errors show up when Apache is started.

In my php.ini :
display_startup_errors = On

Posted: Sun Jan 08, 2006 12:29 pm
by timvw
Probably the php-cli is using a different php.ini file...

Posted: Mon Jan 09, 2006 10:23 am
by Maugrim_The_Reaper
Delete all extra php.ini files (check Windows, Windows\system32, etc - or run a search like a sane person ;)) - place one copy in the same directory as the cli executable (should look for it there first by default). If php.exe is in a separate directory, put an exact duplicate there - seems to work for me at least.

Check extensions dir is set in the ini correctly. And enable each extension one at a time until you hot any other errors, or reach the extensions loaded you require. I noticed before loading oci extensions for oracle is a pain - never seems to find them on XP for some reason - even if the path to \extensions\ is perfect. Might be the same for one of the above or more.

Maybe try the windows PHP installer? I never have myself, but surely it was tested for all this...

Posted: Mon Jan 09, 2006 10:44 am
by anjanesh
Theres no other php.ini file.

Code: Select all

C:\>dir php.ini /s
 Volume in drive C has no label.
 Volume Serial Number is xxxx-xxxx

 Directory of C:\WINDOWS

01/06/2006  10:40 PM            42,300 php.ini
               1 File(s)         42,300 bytes

     Total Files Listed:
               1 File(s)         42,300 bytes
               0 Dir(s)  13,060,427,776 bytes free

C:\>

Posted: Mon Jan 09, 2006 11:15 am
by Maugrim_The_Reaper
Not a clue in that case - I have 5.1 on an XP at home so I'll try its cli executable and see the results later. Can't imagine what else can be causing the errors...

Posted: Mon Jan 09, 2006 11:28 am
by anjanesh
Weirdan wrote:comment out this line in php.ini:

Code: Select all

.......
extension=php_snmp.dll
.......
Ok - now no errors !
Still Strange though - no startup errors - checked apache logs.

Thanks