Codeception: [Docker] Would be feasable to add mysqli php extension to the docker image?

Created on 8 Sep 2020  路  5Comments  路  Source: Codeception/Codeception

What are you trying to achieve?

Using the official docker image (https://hub.docker.com/r/codeception/codeception/) to test a Wordpress theme.

What do you get instead?

Uncaught Error: Call to undefined function mysql_connect() in /builds/[...]/wordpress-wordless-codeception/wp-includes/wp-db.php:1658

I flewlessly solve the issue with a simple

docker-php-ext-install mysqli

but my question was born because I feel it's a bit of overhead to build and maintain a custom image just for a PHP extension and obviously installing the extension into a CI setup script slows down tests. That said I'd like to understand if it would be feasable and interesting for the maintainers to add this extention or if it'd better for me to go on my own.

Thanks in advance for your kind reply

Most helpful comment

I merged PR.

All 5 comments

@schmunk42 What do you think about it?

Hmm, yeah could be done in the Codeception image ... I actually only use PDO, but since this is a tool for Dev/CI I think it's fine.

... but, isn't mysql_connect() a deprecated function from https://www.php.net/manual/en/book.mysql.php ?

Hmm, yeah could be done in the Codeception image ... I actually only use PDO, but since this is a tool for Dev/CI I think it's fine.

Sounds good

... but, isn't mysql_connect() a deprecated function from https://www.php.net/manual/en/book.mysql.php ?

Yeah, but as you can notice I'm suggesting to add mysqli extension, which is the "newer" version and provides mysqli_connect method. When WordPress fails to open DB connection using mysqli_connect it tries to fallback to the old mysql_connect, thus the error I reported.

I absolutely never intended to add extension for deprecated stuff 馃檪

Was just double-checking :)

Could you create a PR?

I think here would be a good place to add it. https://github.com/Codeception/Codeception/blob/4.1/Dockerfile#L26

I merged PR.

Was this page helpful?
0 / 5 - 0 ratings