0

First a note: Yes, I'm well aware this extension in deprecated and has a ton of security flaws, I'm duplicating a clients active server in docker for recovery and migration (after client's server was compromised).

Clients server is Centos6 based with php 5.6 and uses the original php mysql module (they just call it the original module) https://www.php.net/manual/en/book.mysql.php

I've tried a few of the original mysql repos (remi, webtatic) and they install PDO (the new mysql module).

I'm looking for a way to add the (insecure) original module to my docker container for working locally to recover assets and modernize the project, however it seems most of the repo's are using security best practices to remove the flawed software (or I'm not correctly understanding how to enable it).

I'm willing to build it myself if theres a repo of the original source, or if theres prebuilt somewhere I'm not aware of I'd be grateful.

6
  • check PHP's php-src Github page for old releases. here's PHP 5.6.40, latest PHP 5.6.x release. please do not use it for production server.
    – mforsetti
    Nov 18, 2020 at 17:17
  • @mforsetti the MySQL module is not in php core, but is a PECL extension library. The link you gave me is to build core.
    – Philippe
    Nov 18, 2020 at 18:15
  • mysql extension in PECL was superseeded by ext/mysql in PHP source since 2008 -- PHP 4.x. see ext/mysql.
    – mforsetti
    Nov 18, 2020 at 18:37
  • @mforsetti oh, thats interesting - if its in the core how do I go about enabling it? the mysql functions are throwing undefined errors in my code.
    – Philippe
    Nov 18, 2020 at 19:23
  • you can't enable non-compiled and non-installed extensions. install php5-devel, gcc, and mysql-devel, check your php versions by running php --version, then download matching PHP source from php-src Github. Extract PHP source files, cd to ext/mysql, and build the extension.
    – mforsetti
    Nov 18, 2020 at 19:41

1 Answer 1

2

I've tried a few of the original mysql repos (remi, webtatic) and they install PDO (the new mysql module).

Looks like you have not checked properly.

With a proper configuration, following the Wizard you can install the mysql extension, and most existing extensions:

yum install php-mysql

The package name is php-mysqlnd and provides

You can check using:

$ php --modules | grep -i mysql
mysql
mysqli
mysqlnd
pdo_mysql

Of course I recommend to switch as soon as possible to mysqli to avoid being blocked to 5.6 which have reached its end of life, even if "remi" repository have some security backports.

1
  • "yum install php-mysql" will also work on PHP 7.x and will pull the php-pecl-mysql package provided for legacy application, but this can only be used as a temporary workaround. Nov 19, 2020 at 6:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.