Connecting Tech Pros Worldwide Forums | Help | Site Map

PHP code executed though CLI causing warnings.

Member
 
Join Date: Dec 2006
Location: Pune
Posts: 50
#1: Jan 14 '08
Hellow,

I am facing a serous problem when i run the php file from command line.The problem is ..

Expand|Select|Wrap|Line Numbers
  1. <br />
  2. <b>Warning</b>:  Module 'bcmath' already loaded in <b>Unknown</b> on line <b>0</b><br />
  3. <br />
  4. <b>Warning</b>:  Module 'curl' already loaded in <b>Unknown</b> on line <b>0</b><br />
  5. <br />
  6. <b>Warning</b>:  Module 'exif' already loaded in <b>Unknown</b> on line <b>0</b><br />
  7. <br />
  8. <b>Warning</b>:  Module 'gd' already loaded in <b>Unknown</b> on line <b>0</b><br />
  9. <br />
  10. <b>Warning</b>:  Module 'mbstring' already loaded in <b>Unknown</b> on line <b>0</b><br />
  11. <br />
  12. <b>Warning</b>:  Module 'mcrypt' already loaded in <b>Unknown</b> on line <b>0</b><br />
  13. <br />
  14. <b>Warning</b>:  Module 'mhash' already loaded in <b>Unknown</b> on line <b>0</b><br />
  15. <br />
  16. <b>Warning</b>:  Module 'mysqli' already loaded in <b>Unknown</b> on line <b>0</b><br />
  17. <br />
  18. <b>Warning</b>:  Module 'mysql' already loaded in <b>Unknown</b> on line <b>0</b><br />
  19. <br />
  20. <b>Warning</b>:  Module 'oci8' already loaded in <b>Unknown</b> on line <b>0</b><br />
  21. <br />
  22. <b>Warning</b>:  Module 'oracle' already loaded in <b>Unknown</b> on line <b>0</b><br />
  23. <br />
  24. <b>Warning</b>:  Module 'soap' already loaded in <b>Unknown</b> on line <b>0</b><br />

When I commented these extension in php.ini file then gives the no warning but i can not comment these extension because they have load external library.

So what is the altenative Solution of these problem?

Regards,
Sandeep Agarwal
Web Devoloper

Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,748
#2: Jan 18 '08

re: PHP code executed though CLI causing warnings.


Hi Sandeep

Does this happen with all PHP files you execute through your CLI?
If not, can we see the code that generates these errors?

How are you executing the PHP file through your CLI?
Could you show us the command you use?

Also note that these are all Warnings, and as such should not stop the execution of the code.
Is it possible that the code is working as expected, despite these warnings?
Member
 
Join Date: Dec 2006
Location: Pune
Posts: 50
#3: Jan 22 '08

re: PHP code executed though CLI causing warnings.


Hi,
I am using the command
php -f filename.php
after those run gives the warning .Code is successfull execute but the problem i do not want to see the warning in command prompt..

so if any solution then tell me...
Bye,
Sandeep Agrawal

Quote:

Originally Posted by Atli

Hi Sandeep

Does this happen with all PHP files you execute through your CLI?
If not, can we see the code that generates these errors?

How are you executing the PHP file through your CLI?
Could you show us the command you use?

Also note that these are all Warnings, and as such should not stop the execution of the code.
Is it possible that the code is working as expected, despite these warnings?

Atli's Avatar
Moderator
 
Join Date: Nov 2006
Location: Iceland
Posts: 3,748
#4: Jan 22 '08

re: PHP code executed though CLI causing warnings.


Try adding this to the top of your PHP code:
Expand|Select|Wrap|Line Numbers
  1. ini_set('display_errors', false);
  2.  
It should suppress any errors and warnings.
Reply