简体   繁体   中英

To get no warning in running PHP in Ubuntu's terminal

I run

php test_code.php

I get

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/gd.so' - /usr/lib/php5/20060613+lfs/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20060613+lfs/mcrypt.so' - /usr/lib/php5/20060613+lfs/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0
-- I get the right output after these strange Warnings --

The files do not exist in the warnings.

How can you get no warnings in running PHP in Ubuntu's terminal?

Ubuntu Packages上进行的快速搜索显示它们位于php5-gd和php5-mcrypt中。


sudo apt-get install php5-gd php5-mcrypt

Either:

A) Install missing libraries
OR
B) Remove gd and mcrypt modules from your php.ini
OR
C) Remove error reporting, which is really bad idea.

A reply this to this bug post on Launchpad https://bugs.launchpad.net/ubuntu/+source/php5/+bug/281979 solved the problem for me.

In short remove the .ini files. In my case the following commands worked:

/etc/php5/conf.d# rm mcrypt.ini
/etc/php5/conf.d# rm suhosin.ini

Set the error_reporting ini value to 0, which means no error notices:

php -d error_reporting=0 test_code.php 

Although, you should probably try and fix those errors.

PHP-GD and PHP-MCrypt are installed correctly?

<?php
phpinfo();
?>

are there?

If not:

# apt-get install php5-gd php5-mcrypt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM