PHP randomly using different php.ini file but just for PHPMailer
I started setting up a new server recently and went through my own server setup documentation. Part of it requires me to ensure OpenSSL is installed via WHM --> EasyApache 4. However it's not even listed for PHP 8.3, 8.4 or 8.5 on the new server! Both a tech and I independently confirmed that it's apparently running via the terminal:
/opt/cpanel/ea-php83/root/usr/bin/php -m|grep openssl
The terminal simply output "openssl" in red.
However every time I use PHPMailer to send an email the following is dumped in to a PHP error log:
==========
[01-Jun-2026 08:51:03 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /opt/cpanel/ea-php83/root/usr/lib64/php/modules/mysqli (/opt/cpanel/ea-php83/root/usr/lib64/php/modules/mysqli: cannot open shared object file: No such file or directory), /opt/cpanel/ea-php83/root/usr/lib64/php/modules/mysqli.so (/opt/cpanel/ea-php83/root/usr/lib64/php/modules/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0
[01-Jun-2026 08:51:03 UTC] PHP Warning: PHP Startup: Unable to load dynamic library 'openssl' (tried: /opt/cpanel/ea-php83/root/usr/lib64/php/modules/openssl (/opt/cpanel/ea-php83/root/usr/lib64/php/modules/openssl: cannot open shared object file: No such file or directory), /opt/cpanel/ea-php83/root/usr/lib64/php/modules/openssl.so (/opt/cpanel/ea-php83/root/usr/lib64/php/modules/openssl.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[01-Jun-2026 08:51:03 UTC] PHP Warning: Module "curl" is already loaded in Unknown on line 0
[01-Jun-2026 08:51:03 UTC] PHP Warning: Module "exif" is already loaded in Unknown on line 0
[01-Jun-2026 08:51:03 UTC] PHP Warning: Module "fileinfo" is already loaded in Unknown on line 0
[01-Jun-2026 08:51:03 UTC] PHP Warning: Module "gd" is already loaded in Unknown on line 0
[01-Jun-2026 08:51:03 UTC] PHP Warning: Module "imap" is already loaded in Unknown on line 0
[01-Jun-2026 08:51:03 UTC] PHP Warning: Module "mbstring" is already loaded in Unknown on line 0
==========
Going BACK to WHM and then the MultiPHP INI Editor. In "Editor Mode" for PHP 8.3 mysqli isn't listed. I had to ask an LLM that mysqli has been superseded by mysqlnd ("native driver"), okay fine, I can update my documentation later. But the thing is: that isn't what is in my php.ini file for PHP 8.3! So the LLM suggested running the following command:
grep -r "extension=mysqli" /opt/cpanel/ea-php83/root/etc/php.d/ /opt/cpanel/ea-php83/root/etc/php.inigrep -r "extension=openssl" /opt/cpanel/ea-php83/root/etc/php.d/ /opt/cpanel/ea-php83/root/etc/php.ini
It returns the following results:
/opt/cpanel/ea-php83/root/etc/php.d/30-mysqli.ini:extension=mysqli.so
/opt/cpanel/ea-php83/root/etc/php.ini:extension=mysqli
/opt/cpanel/ea-php83/root/etc/php.ini:extension=openssl
So WHM is not updating PHP 8.3's php.ini file then? I've done several graceful server reboots, I don't know how the effective (or selective?) php.ini that only gets used in some scenarios is being loaded. I opened it up via the vi terminal command and there is the cPanel warning not to edit the files. There is no mention of changing PHP ini settings in PHPMailer so I have no idea how it's somehow getting PHP to suddenly hook in to using a different php.ini file. I can say that using WinMerge to update the php.ini in EasyApache4 that there is a lot of older language and tweaking that has been done with my local WAMP server compared to what I'm seeing on the new live server that I'm having trouble with. Latest versions of WHM/cPanel/etc. This is mission critical to get working for me, I'd be very grateful for some much needed help please.
==========
Edit 1:
So I humored the idea that maybe I'm missing something and following the LLM's directions on commenting out the two extensions:
;extension=openssl
;extension=mysqli
I saved, did a full graceful server reboot and MariaDB is clearly running and I managed to confirm my emails are working. So how is disabling these extensions resulting in MairaDB and OpenSSL working?
Additionally my email problem apparently is because this server requires a full email address for the user name and I only had one of the two bits resolved ($username versus $from). That was the major issue. I have moderate issues to address but that is much better than the start of today.
So why are MariaDB and OpenSSL working even though PHP 8.3's php.ini file has those extensions commented out? How can I get out of backwards nonsense world please?
-
Hey there! You mention that you "went through my own server setup documentation" - openssl and mysqli are defaults that are included with all versions of PHP on the system, as we can see both of these are compiled in by default:
https://www.php.net/manual/en/openssl.installation.php
https://www.php.net/manual/en/mysqli.installation.php
If your steps included trying to manually set up these packages in any way it could cause them to need to be commented out if they are loading from an unexpected area.
0
Please sign in to leave a comment.
Comments
1 comment