I am trying to see if php is installed. I try to run php -v but I get this as an output. Any ideas on what is wrong?
(33)$ php -V
Failed loading /usr/lib64/php/modules/xdebug.so: /usr/lib64/php/modules/xdebug.so: cannot open shared object file: No such file or directory
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/apc.so' - /usr/lib64/php/modules/apc.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/lib64/php/modules/dom.so' - /usr/lib64/php/modules/dom.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/lib64/php/modules/gd.so' - /usr/lib64/php/modules/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/lib64/php/modules/ldap.so' - /usr/lib64/php/modules/ldap.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/lib64/php/modules/memcache.so' - /usr/lib64/php/modules/memcache.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/lib64/php/modules/mysql.so' - /usr/lib64/php/modules/mysql.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/lib64/php/modules/mysqli.so' - /usr/lib64/php/modules/mysqli.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/lib64/php/modules/pdo.so' - /usr/lib64/php/modules/pdo.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/lib64/php/modules/pdo_mysql.so' - /usr/lib64/php/modules/pdo_mysql.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/lib64/php/modules/pdo_sqlite.so' - /usr/lib64/php/modules/pdo_sqlite.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/lib64/php/modules/soap.so' - /usr/lib64/php/modules/soap.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/lib64/php/modules/sqlite3.so' - /usr/lib64/php/modules/sqlite3.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/lib64/php/modules/wddx.so' - /usr/lib64/php/modules/wddx.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/lib64/php/modules/xmlreader.so' - /usr/lib64/php/modules/xmlreader.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/lib64/php/modules/xmlrpc.so' - /usr/lib64/php/modules/xmlrpc.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/lib64/php/modules/xmlwriter.so' - /usr/lib64/php/modules/xmlwriter.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/lib64/php/modules/xsl.so' - /usr/lib64/php/modules/xsl.so: cannot open shared object file: No such file or directory in Unknown on line 0
Usage: php [options] [-f] <file> [--] [args...]
php [options] -r <code> [--] [args...]
php [options] [-B <begin_code>] -R <code> [-E <end_code>] [--] [args...]
php [options] [-B <begin_code>] -F <file> [-E <end_code>] [--] [args...]
php [options] -- [args...]
php [options] -a
-a Run as interactive shell
-c <path>|<file> Look for php.ini file in this directory
-n No php.ini file will be used
-d foo[=bar] Define INI entry foo with value 'bar'
-e Generate extended information for debugger/profiler
-f <file> Parse and execute <file>.
-h This help
-i PHP information
-l Syntax check only (lint)
-m Show compiled in modules
-r <code> Run PHP <code> without using script tags <?..?>
-B <begin_code> Run PHP <begin_code> before processing input lines
-R <code> Run PHP <code> for every input line
-F <file> Parse and execute <file> for every input line
-E <end_code> Run PHP <end_code> after processing all input lines
-H Hide any passed arguments from external tools.
-s Output HTML syntax highlighted source.
-v Version number
-w Output source with stripped comments and whitespace.
-z <file> Load Zend extension <file>.
args... Arguments passed to script. Use -- args when first argument
starts with - or script is read from stdin
--ini Show configuration file names
--rf <name> Show information about function <name>.
--rc <name> Show information about class <name>.
--re <name> Show information about extension <name>.
--ri <name> Show configuration for extension <name>.
I don't know your flavor of Linux but here's a quick rundown of how it works, at least under RedHat
If you compile your own PHP, you'll likely compile these extensions as well and then load them into php.ini. But in packages (like php-mysql), you can't do that. So many flavors will set up /etc/php.d and you'll find all the ini files (i.e. xdebug.ini) that contain the reference to the compiled (.so) files. These are loaded at runtime, just like Apache loads all the *.conf files at runtime.
There's a few possibilities here
Your PHP is misconfigured and is looking at the wrong directory.
You don't have permissions to access that directory from the command line (if PHP works under the web server this could be the case)
Something else (i.e. selinux) is causing issues
So see if you can access /usr/lib64/php/modules and make sure the .so files are there. If not, figure out where they live. The directive is called config-file-scan-dir
Related
I am setting the environment for the use of CodeIgniter4.
I want to use "extension=intl" or "extension=mbstring" in php.ini
php.ini
extension=intl
;extension=imap
;extension=ldap
extension=mbstring
After that, when the local server is executed, the following error is output.
PHP Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /opt/homebrew/lib/php/pecl/20190902/intl (dlopen(/opt/homebrew/lib/php/pecl/20190902/intl, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/intl' (no such file), '/usr/local/lib/intl' (no such file), '/usr/lib/intl' (no such file)), /opt/homebrew/lib/php/pecl/20190902/intl.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/intl.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/intl.so' (no such file), '/usr/local/lib/intl.so' (no such file), '/usr/lib/intl.so' (no such file))) in Unknown on line 0
[Wed Feb 2 16:50:09 2022] PHP Warning: PHP Startup: Unable to load dynamic library 'mbstring' (tried: /opt/homebrew/lib/php/pecl/20190902/mbstring (dlopen(/opt/homebrew/lib/php/pecl/20190902/mbstring, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/mbstring' (no such file), '/usr/local/lib/mbstring' (no such file), '/usr/lib/mbstring' (no such file)), /opt/homebrew/lib/php/pecl/20190902/mbstring.so (dlopen(/opt/homebrew/lib/php/pecl/20190902/mbstring.so, 0x0009): tried: '/opt/homebrew/lib/php/pecl/20190902/mbstring.so' (no such file), '/usr/local/lib/mbstring.so' (no such file), '/usr/lib/mbstring.so' (no such file))) in Unknown on line 0
My extesion_dir's value is "/opt/homebrew/lib/php/pecl/20190902"
Diretory Tree in 20190902
.
└── xdebug.so
If so, I think it is an error that occurred because extension does not exist, but it is loaded when checked through actual phpinfo().
enter image description here
enter image description here
And run php -m | grep "intl", it is exist
phpinfo and php -m are different. running php in CLI can load a different ini file from the ini file loaded by your webserver configuration. Try running your phpinfo script using the built-in webserver (php -S localhost:88 phpinfo.php). Then access localhost:88 in the webbrowser.
I was running into this issue myself with homebrew and php on my m1 macbook.
It was compiled into the PHP binary that is installed by homebrew, which means it's loaded without mentioning it in the ini file. This means you can't load it manually, and attempting to do so will cause a startup error that will show as a warning when running PHP from the command-line interface.
The best thing to do is just remove the line in the ini to load that module, since attempting to load it will fail.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mysqli.dll' - /usr/lib/php/2015101
2/php_mysqli.dll: 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/php/20151012/php_pdo_firebird.dll' - /usr/lib/php/2
0151012/php_pdo_firebird.dll: 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/php/20151012/php_pdo_mysql.dll' - /usr/lib/php/2015
1012/php_pdo_mysql.dll: 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/php/20151012/php_pdo_oci.dll' - /usr/lib/php/201510
12/php_pdo_oci.dll: 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/php/20151012/php_pdo_odbc.dll' - /usr/lib/php/20151
012/php_pdo_odbc.dll: 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/php/20151012/php_pdo_pgsql.dll' - /usr/lib/php/2015
1012/php_pdo_pgsql.dll: 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/php/20151012/php_pdo_sqlite.dll' - /usr/lib/php/201
51012/php_pdo_sqlite.dll: 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/php/20151012/php_pgsql.dll' - /usr/lib/php/20151012
/php_pgsql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: Module 'PDO' already loaded in Unknown on line 0
I am on Ubuntu 16.04 trying to get a cron job running correctly for an Oxwall site.
I had to comment out the dll files in the php.ini file in order for it to work. Probably need some of the php extensions for it to work.
I am currently hosting on 1und1.de. my codes work on localhost but upon uploading it on the shared hosting server i got the following errors:
Warning: Unknown: open(C:\xampp\tmp/sess_bnt91ftgq6s4obn2684fud47p5, O_RDWR) failed: No such file or directory (2) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\xampp\tmp) in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_bz2.dll' - C:\xampp\php\ext/php_bz2.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_curl.dll' - C:\xampp\php\ext/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_mbstring.dll' - C:\xampp\php\ext/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_exif.dll' - C:\xampp\php\ext/php_exif.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_gd2.dll' - C:\xampp\php\ext/php_gd2.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_gettext.dll' - C:\xampp\php\ext/php_gettext.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_mysql.dll' - C:\xampp\php\ext/php_mysql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_mysqli.dll' - C:\xampp\php\ext/php_mysqli.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_openssl.dll' - C:\xampp\php\ext/php_openssl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_pdo_mysql.dll' - C:\xampp\php\ext/php_pdo_mysql.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_pdo_sqlite.dll' - C:\xampp\php\ext/php_pdo_sqlite.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_soap.dll' - C:\xampp\php\ext/php_soap.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_sockets.dll' - C:\xampp\php\ext/php_sockets.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_sqlite3.dll' - C:\xampp\php\ext/php_sqlite3.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_xmlrpc.dll' - C:\xampp\php\ext/php_xmlrpc.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext/php_xsl.dll' - C:\xampp\php\ext/php_xsl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
Warning: Cannot open 'C:\xampp\php\extras\browscap.ini' for reading in Unknown on line 0
What does these errors mean. does these errors have something to do with my hosting provider?
I had this error locally with this message:
Warning: Cannot open "\xampp\php\extras\browscap.ini" for reading in
Unknown on line 0
By changing this line of php.ini file :
browscap="\xampp\php\extras\browscap.ini"
to this:
browscap="C:\xampp\php\extras\browscap.ini"
the error has gone.
It looks as though you've probably copied your php.ini configuration file directly from your system to your hosting server. Don't do that. The data in your configuration file is specific to your XAMPP installation; this is not appropriate for the web server, and is causing these errors because the files referenced in your configuration do not exist on the server.
Sometimes people here are not as they could be...
For whatever reason, your php.ini is mis-configured.
One thing to note that all those missing files are actually Windows files (*.dll) on Linux these would likely be *.so files. I'm assuming your hosting on a Linux server.
First find your php.ini file. If you have command line access via SSH, you can try running:
php --ini
if not you make a simple script, call it test.php like so:
<?php
phpinfo();
?>
Upload the file and run it, something like:
http://www.yoursite.com/test.php
Among the information provided will be the path to php.ini
Once you find it, one option is to edit it and comment out all those extensions, by putting a ";" in front of the line.
Another option is to check if the *.so files exist. Look for them under /usr/lib/php. If they exist, edit your php.ini file to have all those extension end in .so instead of .dll
Finally, if they don't exist, you could install them by using apt-get or yum. An example:
sudo apt-get install php-mbstring
I have a problem about php on centos. When I want to run php script I have problem like that below,
# php removespikes.php -R=/var/www/html/cacti-0.8.8a/rra/gyt_traffic_in.rrd
PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib64/php/modules/phpchartdir530.dll' -
/usr/lib64/php/modules/phpchartdir530.dll: cannot open shared object
file: No such file or directory in Unknown on line 0
How can I fix this problem?
I am running the following script on a cronjob...
cd /etc/parselog/
php run_all.php >/dev/null
and am getting the following errors:
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './mysql.so' - ./mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './mysql.so' - ./mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './mysqli.so' - ./mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './odbc.so' - ./odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo.so' - ./pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo_mysql.so' - ./pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo_odbc.so' - ./pdo_odbc.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Warning: PHP Startup: Unable to load dynamic library './pdo_sqlite.so' - ./pdo_sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
[05-May-2009 20:30:12] PHP Fatal error: Call to undefined function mysql_connect() in /etc/parselog/stats_downloads.php on line 5
However, when I run the same script from the command line, logged in- it works perfectly without error.
This is my $PATH string at the prompt:
$PATH = /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
Any ideas or suggestions? I am certain when running the cronjob, it does not have a lib path or something included. I even tried adding the exact path
Tip 1: Ensure you have exactly the same $PATH in the cron job:
cd /etc/parselog/
export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
php run_all.php >/dev/null
Tip 2: Make sure all other environment variables match as well. Dump the environment with the command env, and add the corresponding exports to your cron job.
Generally when something fails during cron but runs on the command line it's permissions, working directory, or environment variables.
It looks like the php executable itself isn't loading the libraries, the problem might not be in your script.
When you run a script in a cron job, it is run in a limited shell with very few environment variables set. From your errors, it looks like it may be the LD_LIBRARY_PATH that needs to be set as the errors pertain to a bunch of shared libraries, but that is just a guess. It looks like the proper library paths for PHP are not being set up correctly in the cron script.
You can capture the environment used when running the cron script by adding the env command to the script and capturing the output. Compare this to the env output at the prompt and look for variations. Most likely they will be from commands issued in either your local or system profile or bashrc (or maybe even .login) files that set up library paths. I'd specifically look for paths and variables related to PHP since that seems to be your issue.
I had to deal with this issue several times on my last project and the basic solution is to:
determine the minimum environment needed to execute the script
create a short script that sets up the desired environment
add a call to the script from item 2 in the script launching your applications so that the environment is set up properly.
Test thoroughly to make sure you didn't miss anything :-).
When a cron job is run from the users crontab it is executed as that user. It does not however source any files in the users home directory like their .profile, .cshrc, or .bashrc or any other file. If you need cron to source (read) any file that your script will need you should do it from the script cron is calling. Setting paths, sourcing files, setting environment variables, etc.