PHP unable to find libraries using Cpanel - php

I have recently had to migrate to a brand new server after a sudden server crash. I am now getting an error where if I email a certain email address, (which I know i pipe to a PHP script), i get the following error message back via email:
This message was created automatically by mail delivery software.
A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:
pipe to |/home/username/public_html/support/api/pipe.php
generated by email
The following text was generated during the delivery attempt:
------ pipe to |/home/username/public_html/support/api/pipe.php
generated by email------
PHP Warning: PHP Startup: Unable to load dynamic library '/opt/cpanel/ea-php54/root/usr/lib64/php/modules/msql.so' - /opt/cpanel/ea-php54/root/usr/lib64/php/modules/msql.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 '/opt/cpanel/ea-php54/root/usr/lib64/php/modules/mysql.so' - /opt/cpanel/ea-php54/root/usr/lib64/php/modules/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
What is strange is I have the extensions installed via EasyApache. But if I do an ls on this, i only get the following:
[root#bob home]# ls /opt/cpanel/ea-php54/root/usr/lib64/php/modules/
ctype.so imap.so mysqlnd.so phar.so sqlite3.so xml.so
curl.so json.so pdo_mysqlnd.so posix.so tokenizer.so xmlwriter.so
dom.so mysqlnd_mysqli.so pdo.so simplexml.so wddx.so xsl.so
ftp.so mysqlnd_mysql.so pdo_sqlite.so sockets.so xmlreader.so

Related

Undefined function oci_connect [duplicate]

Please help me to connect the oracle database 11g through Laravel 5.7
I spend 4 days still don't make it out just drive me crazy
My config:
Win7-Sp1-64Bit,Xampp-v3.2.2,PHP-7.2.1,Laravel-5.7.1
I placed the file
OCI8-php_oci8-2.1.8-7.2-ts-vc15-x64 (oci8.dll,oci8_11r.dll, oci8_12g.dll)
in xampp/php/ext
I've created Environment Variables in User variables & System variables:
PATH: C:\instantclient_18_3 or C:\instantclient_12_2
TNS_ADMIN: C:\instantclient_18_3 or C:\instantclient_12_2
。Also tried to install:
32bit-instantclient-basic-nt-12.2.0.1.0.zip
32bit-instantclient-basic-nt-12.1.0.2.0.zip
64bit-instantclient-basic-windows.x64-18.3.0.0.0dbru.zip
64bit-instantclient-basic-windows.x64-12.2.0.1.0.zip
OCI8 still can't be loaded in http://localhost/index.php
and I run the command php -m still come out the same result:
Warning: PHP Startup: Unable to load dynamic library
'php_oci8_11g.dll' (tried: C:\xampp\php\ext\php_oci8_11g.dll (%1 is
not a valid Win32 application.),
C:\xampp\php\ext\php_php_oci8_11g.dll.dll (The specified module could
not be found.)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library
'php_oci8_12c.dll' (tried: C:\xampp\php\ext\php_oci8_12c.dll (%1 is
not a valid Win32 application.),
C:\xampp\php\ext\php_php_oci8_12c.dll.dll (The specified module could
not be found.)) in Unknown on line 0
Finally I found an article which is close to my config
https://blogs.oracle.com/opal/installing-xampp-for-php-and-oracle-database
Doing all the things on this article then
Add oci.dll, oraociei12.dll, and oraons.dll to apache/bin folder. Replace the existing one
Restart the Apache..
Things are being done!

PHP Startup: Unable to load dynamic library 'intl' (tried: /opt/homebrew/lib/php/pecl/20190902/intl

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.

Unable to load dynamic library 'php_oci8_11g.dll'

Please help me to connect the oracle database 11g through Laravel 5.7
I spend 4 days still don't make it out just drive me crazy
My config:
Win7-Sp1-64Bit,Xampp-v3.2.2,PHP-7.2.1,Laravel-5.7.1
I placed the file
OCI8-php_oci8-2.1.8-7.2-ts-vc15-x64 (oci8.dll,oci8_11r.dll, oci8_12g.dll)
in xampp/php/ext
I've created Environment Variables in User variables & System variables:
PATH: C:\instantclient_18_3 or C:\instantclient_12_2
TNS_ADMIN: C:\instantclient_18_3 or C:\instantclient_12_2
。Also tried to install:
32bit-instantclient-basic-nt-12.2.0.1.0.zip
32bit-instantclient-basic-nt-12.1.0.2.0.zip
64bit-instantclient-basic-windows.x64-18.3.0.0.0dbru.zip
64bit-instantclient-basic-windows.x64-12.2.0.1.0.zip
OCI8 still can't be loaded in http://localhost/index.php
and I run the command php -m still come out the same result:
Warning: PHP Startup: Unable to load dynamic library
'php_oci8_11g.dll' (tried: C:\xampp\php\ext\php_oci8_11g.dll (%1 is
not a valid Win32 application.),
C:\xampp\php\ext\php_php_oci8_11g.dll.dll (The specified module could
not be found.)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library
'php_oci8_12c.dll' (tried: C:\xampp\php\ext\php_oci8_12c.dll (%1 is
not a valid Win32 application.),
C:\xampp\php\ext\php_php_oci8_12c.dll.dll (The specified module could
not be found.)) in Unknown on line 0
Finally I found an article which is close to my config
https://blogs.oracle.com/opal/installing-xampp-for-php-and-oracle-database
Doing all the things on this article then
Add oci.dll, oraociei12.dll, and oraons.dll to apache/bin folder. Replace the existing one
Restart the Apache..
Things are being done!

Changed PHP Version from 7.0.7 to 7.2.2 and back to 7.0 7 Now PHP is no longer working

I was testing an application to see if it would work in 7.0.7 and 7.2.2. The app works in both; that's not where the problem lies.
After seeing the app works in 7.2.2 I changed the Windows Apache httpd.conf file to:
LoadModule php7_module "C:/php_7_0_7/php7apache2_4.dll"
PHPIniDir "C:/php_7_0_7/"
from:
LoadModule php7_module "C:/php_7_2_2/php7apache2_4.dll"
PHPIniDir "C:/php_7_2_2/"
After changing the paths I restarted Apache.
Going to the URL localhost the webpage comes up correctly.
Going to localhost/phpinfo.php does not come up. The error message is "The site cannot be reached." The file phpinfo.php is simply <?php phpinfo(); ?>
The Apache error file has the following:
[Thu Feb 01 16:03:48.820715 2018] [core:warn] [pid 7628:tid 780] AH00098: pid file C:/Apache24/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
PHP Warning: PHP Startup: curl: Unable to initialize module\nModule compiled with module API=20151012\nPHP compiled with module API=20170718\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_fileinfo.dll' (tried: C:\php_7_0_7\ext\php_fileinfo.dll (The specified procedure could not be found.\r\n), C:\php_7_0_7\ext\php_php_fileinfo.dll.dll (The specified module could not be found.\r\n)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_gd2.dll' (tried: C:\php_7_0_7\ext\php_gd2.dll (The specified procedure could not be found.\r\n), C:\php_7_0_7\ext\php_php_gd2.dll.dll (The specified module could not be found.\r\n)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_intl.dll' (tried: C:\php_7_0_7\ext\php_intl.dll (The specified module could not be found.\r\n), C:\php_7_0_7\ext\php_php_intl.dll.dll (The specified module could not be found.\r\n)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_imap.dll' (tried: C:\php_7_0_7\ext\php_imap.dll (The specified procedure could not be found.\r\n), C:\php_7_0_7\ext\php_php_imap.dll.dll (The specified module could not be found.\r\n)) in Unknown on line 0
PHP Warning: PHP Startup: ldap: Unable to initialize module\nModule compiled with module API=20151012\nPHP compiled with module API=20170718\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_mbstring.dll' (tried: C:\php_7_0_7\ext\php_mbstring.dll (The specified procedure could not be found.\r\n), C:\php_7_0_7\ext\php_php_mbstring.dll.dll (The specified module could not be found.\r\n)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_exif.dll' (tried: C:\php_7_0_7\ext\php_exif.dll (The specified procedure could not be found.\r\n), C:\php_7_0_7\ext\php_php_exif.dll.dll (The specified module could not be found.\r\n)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_mysqli.dll' (tried: C:\php_7_0_7\ext\php_mysqli.dll (The specified procedure could not be found.\r\n), C:\php_7_0_7\ext\php_php_mysqli.dll.dll (The specified module could not be found.\r\n)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_openssl.dll' (tried: C:\php_7_0_7\ext\php_openssl.dll (The specified procedure could not be found.\r\n), C:\php_7_0_7\ext\php_php_openssl.dll.dll (The specified module could not be found.\r\n)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'php_pdo_mysql.dll' (tried: C:\php_7_0_7\ext\php_pdo_mysql.dll (The specified procedure could not be found.\r\n), C:\php_7_0_7\ext\php_php_pdo_mysql.dll.dll (The specified module could not be found.\r\n)) in Unknown on line 0
PHP Warning: PHP Startup: pdo_sqlite: Unable to initialize module\nModule compiled with module API=20151012\nPHP compiled with module API=20170718\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: xsl: Unable to initialize module\nModule compiled with module API=20151012\nPHP compiled with module API=20170718\nThese options need to match\n in Unknown on line 0
PHP Deprecated: Directive 'track_errors' is deprecated in Unknown on line 0
When I use the command line and run php -i "print phpinfo();" -> delete.txt is run everything looks OK. The windows environmental variable path includes "C:\php_7_0_7"
This is the line that I thought would indicate trouble with the extensions:
extension_dir => C:\php_7_0_7\ext => C:\php_7_0_7\ext
That is the correct path to the extensions.
PHP Error Reporting is set to E_ALL (this is a development machine)
display_errors = On
display_startup_errors = On
When a file that is just phpinfo(); the site can not be reached. Running a file that uses the mysqli extension to connect to a database comes up with this error "Fatal error: Uncaught Error: Call to undefined function mysqli_connect() in C:\www\mysqli.php:8 Stack trace: #0 {main} thrown in C:\www\mysqli.php on line 8"
When phpinfo is run from the command line and saved to a file it includes the lines:
mysqli
MysqlI Support => enabled
Which makes me think that php from the command line is working and there is some configuration or communication between Apache and PHP that I'm missing.
The service for IIS is turned OFF.
Edit 1: using the built in server started on the command line with php -S localhost:8000 everything works! However I would like to use Apache as that is what the main shop runs. Plus the port :8000 at the end of local host breaks the site.
Edit 2: When httpd.exe is stopped as a service and started by double clicking on it, everything runs just like it should. Perhaps this means there is a permission conflict between the service and the directories.
Update: works. does not work.
Is there an error log that is created when PHP starts?
How do I go about troubleshooting this? I'm on my 2nd hour and I'm seeking advice.
Thanks for all suggestions.
I had a very similar issue after upgrading my php, apache, and mysql stack. Specifically, everything seemed to work but none of the modules were available and I was sure the extension path was correct. When checking the error log I noticed similar entries to yours with file names like php_php_{module_name}.dll.dll.
During this process I copied an old php.ini file which listed module names like so:
extension=php_gd2.dll
;extension=php_gettext.dll
but when comparing to the php.ini-development or php.ini-production files, all modules are listed like:
extension=gd2
;extension=gettext
Just in case there were other changes that I missed, I ended up just copying the proper example file php.ini-development|php.ini-production and editing it to fit my environment again but you can probably get away with just removing the php_ and .dll segments from each of the extension listings.
Hope this helps someone else.
hi5, encountered the same exact problem today. Seems like lower Apache versions (I had 2.4.18) does properly load curl and openssl extensions. There's also an issue with new php.ini extension format (notice no "php_" and ".dll"), white readme states legacy format is still supported).
What solved my issue with two non-breaking steps:
Updated WAMP 3.0.2 to 3.1.1 using this
Updated Apache to 2.4.29 using this
Don't forget to switch Apache version in WAMP menu after restart and use new extension format in php.ini

Check to see if php is installed php -V

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

Categories