Textpattern CMS support forum
- From: New Zealand
- Registered: 2004-07-26
- Posts: 145
mySQL vs mySQLi and TXP 4.6
I tried to install TXP 4.6.2 on a server running php 5.4.45, and couldn’t establish a connection to the database in setup:
Checking database connection Fatal error: Call to undefined function mysqli_init() in /home/.../textpattern/setup/index.php on line 376
I received this response from the web-host:
The reason you’re getting the error when you try to setup textpattern is because mysqli_init() module has been disabled on the hosting server due to security reasons.
Do they have a point, or are they just trying to squirm out of the problem. I thought mySQLi was an improvement on mySQL…
- From: Leeds, UK
- Registered: 2006-01-29
- Posts: 7,637
Re: mySQL vs mySQLi and TXP 4.6
giz wrote #305670:
I thought mySQLi was an improvement on mySQL…
It allows parameterized queries that help prevent injection attacks, but they’re not enforced. We don’t actually use them in core (yet). That said, the host probably removed
mysql_* calls too for the same reason. PDO calls require parameters, making them far safer, so in that case the host is correct.
We only switched over to mysqli to buy us some time on newer versions of PHP. The long haul is to switch to PDO lock stock, though that brings with it annoying things such as not having the ability to do
IN queries without parameterizing by hand. Plus we lose the ability to use MySQL extensions such as sorting by FIELD to maintain sort order, so we’ll have to do extra processing in PHP to maintain that feature of Txp. And PDO’s a few percent slower in most cases, as far as I know.
As for this issue, I don’t know what you can do. If they’ve turned off all direct MySQL call support in PHP, the current Txp won’t run unless support is enabled.