Broken pdo_mysql in php 8.3

This syntax is incorrect. ‘server’ should be ‘host’ and then the connection would attempt to use the tcp/ip stack to make a connection, not a socket. Since it is attempting to use a socket, it’s likely that the unknown ‘server’ keyword defaults to ‘localhost’ which on your operating system attempts to use a socket.

If after correcting this syntax to use a socket, the error comes and goes on its own, it means that the database server is or is not running, and you should be troubleshooting why the database server is not running. If after correcting this syntax to use a socket, it always fails, it is most likely because there’s a mismatch in the socket setting between php and the database server.

Or, you can correct this syntax to actually use a tcp/ip connection, which it appears was the intent, based on the presence of the ip address of the database server, and see if the entire problem goes away.

Edit: I see in the previously posted connection function/code that ‘host’ was used. So, at this point, none of the provided information means anything. We don’t know why the previous code, which wasn’t producing any connection error information, was failing or if the last test code, which is producing connection error information, would have ever worked because of the socket settings.

Yeah, that ‘server’ error I caught and fixed. The database servers have never been a problem: I run a separate db client in another window where I write the sql procedures (nobody gets direct access to tables or views), then move to a shell to write the php code to test those procedures and make sure php is getting what I intend. The databases have never been a problem. Who knows, maybe dumping apache will making diagnosis easier as and when this happens again.

If you are using php from the cli, you wouldn’t need a webserver.
That’s true. However, when there are no conflicts, it should run with the apache as well.

Is php 8.3 the default of your distribution already?
When running on apache via mod_php, with installed libapache2-mod-php8.3 for example is possible, that by default a different one is enabled.
Thus you would need to just do something like
a2dismod php8.1
before your
a2enmod php8.3
to avoid conflicts

Unrelated to the issue you are facing, I’d recommend to run a different webserver than apache anyways unless you really really reaaaaalllly need some of the advanced features.
Take a look at nginx or caddy webservers.
Faster, leaner and decoupled from the php (you are running php-fpm besides those instead of having a module)

Tks r, I’ve thought about other web servers, but just been too busy with other projects. And since the bulk of what I’m building is running in shells as I say, I’m more or less leaving web servers by the wayside: coding in php & sql is enough work without the added burden of html/jscript/json.
As to xubuntu, I’m not sure what the default version of php is. When a new version appears, it’s always my habit to do fresh OS installs as opposed to upgrading for this very reason. Having come from the Windows world, upgrading is just not something you do if you value your sanity. :weary:

Sponsor our Newsletter | Privacy Policy | Terms of Service