Jump to content

Interesting issue maybe with PHP8.2


Nacman

Recommended Posts

I have been chasing down a reason my emails stopped going out the door.  When I first set up the website, emails from News postings went out. We weren't flying yet.

Then after a few days, no emails going out. Checked Logs in storage/logs and I didn't find anything that looked like email failure, quite the opposite, it said it sent 11 emails.

But there was a PDO error

 

Here is the snips of the log when running it on PHP.8.2

[2023-12-13 00:10:11] production.ERROR: Class "PDO" not found {"exception":"[object] (Error(code: 0): Class \"PDO\" not found at /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Database/Connection.php:1718)
[stacktrace]
#0 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(265): Illuminate\\Database\\Connection::getResolver()
#1 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(76): Illuminate\\Database\\Connectors\\ConnectionFactory->createConnection()
#2 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(50): Illuminate\\Database\\Connectors\\ConnectionFactory->createSingleConnection()
#3 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(152): Illuminate\\Database\\Connectors\\ConnectionFactory->make()
#4 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(101): Illuminate\\Database\\DatabaseManager->makeConnection()
#5 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php(74): Illuminate\\Database\\DatabaseManager->connection()
#6 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\\Database\\DatabaseServiceProvider->Illuminate\\Database\\{closure}()
#7 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build()
#8 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(937): Illuminate\\Container\\Container->resolve()
#9 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve()
#10 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(922): Illuminate\\Container\\Container->make()
#11 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Container/Container.php(1454): Illuminate\\Foundation\\Application->make()
#12 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(239): Illuminate\\Container\\Container->offsetGet()
#13 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(207): Illuminate\\Support\\Facades\\Facade::resolveFacadeInstance()
#14 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(347): Illuminate\\Support\\Facades\\Facade::getFacadeRoot()
#15 /home/eastgyuv/phpvms/app/Providers/AppServiceProvider.php(19): Illuminate\\Support\\Facades\\Facade::__callStatic()
#16 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Providers\\AppServiceProvider->boot()
#17 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#18 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#19 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#20 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#21 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(1010): Illuminate\\Container\\Container->call()
#22 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(991): Illuminate\\Foundation\\Application->bootProvider()
#23 [internal function]: Illuminate\\Foundation\\Application->Illuminate\\Foundation\\{closure}()
#24 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(992): array_walk()
#25 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php(17): Illuminate\\Foundation\\Application->boot()
#26 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(261): Illuminate\\Foundation\\Bootstrap\\BootProviders->bootstrap()
#27 /home/eastgyuv/phpvms/bootstrap/application.php(51): Illuminate\\Foundation\\Application->bootstrapWith()
#28 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(447): application->bootstrapWith()
#29 /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(199): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#30 /home/eastgyuv/phpvms/bin/cron(25): Illuminate\\Foundation\\Console\\Kernel->handle()
#31 {main}
"} 
[2023-12-13 00:15:09] production.ERROR: Class "PDO" not found {"exception":"[object] (Error(code: 0): Class \"PDO\" not found at /home/eastgyuv/phpvms/vendor/laravel/framework/src/Illuminate/Database/Connection.php:1718)
[stacktrace] ( REPEATS THIS ALOT) Then later I send out news get more of the above but also see "Sending notification to 11 users"

....

[2023-12-13 00:46:28] production.INFO: NotificationEvents::onNewsAdded  
[2023-12-13 00:46:28] production.INFO: Sending notification to 11 users  

 

BUT

No emails arrive anywhere.

 

I tried changing email providers thinking maybe it is my host. CLeared all caches. No change.

 

Then I thought, wait, it worked under PHP8.1 then I switched to PHP8.2

So I switched back to PHP8.1. Cleared Caches

 

Here is the entire log after clearing the cache and sending another NEWs posting. Plus 5 min Cron hit my webserver. Cron hit and floodgates opened.

[2023-12-14 05:03:50] production.INFO: NotificationEvents::onNewsAdded  
[2023-12-14 05:03:50] production.INFO: Sending notification to 11 users  
[2023-12-14 05:18:16] production.INFO: NotificationEvents::onNewsAdded  
[2023-12-14 05:18:16] production.INFO: Sending notification to 11 users  
 

Then I jumped over to my discord server because I saw some rate limiting messages in Cron log. Holy crap all the pireps hit at the same time and all my emails I had sent hit my phone.

 

So something in my hosting or something in PHP8.2 is breaking email and the PDO error is the reason maybe? I think PDO is the driver for PHP to mysql, right?

 

Do you want me to put a bug report on github?

 

Leaving it under PHP8.1 for now.

 

-Nac

Edited by Nacman
Link to comment
Share on other sites

  • Nacman changed the title to Interesting issue maybe with PHP8.2

image.png.d91bc44705a2d9f8f778caf0cfa0ce1f.png

 

Interesting solution probably lies in your cron settings :)

 

After changing php versions, there are three steps to follow

 

  1. Hosting Control Panel | Restart php itself (most of the hosting providers do this automatically, check if they provide a button - link etc. for it, if so restart it manually)
  2. Hosting Control Panel | Edit your cron command to reflect your latest changes to php version (this MUST be done manually, running php8.2 but trying to use a cron command for php8.1 will cause problems)
  3. PHPVMS v7 | Go to admin > maintenance and clear cache (this is not mandatory but eliminates risks)

Only after these steps are completed, and you still get php or extension related error, double check enabled extensions and php settings for your new version. As they need to be installed and configured per each version installed.

 

Good luck ;)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...