Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to undefined function mysql_connect() (PHP5.6.35, MYSQL5.7, APACHE2) #1483

Closed
jerfeson opened this issue Apr 12, 2018 · 6 comments
Closed
Labels

Comments

@jerfeson
Copy link

Info:

  • Docker version Docker version 18.03.0-ce, build 0520e24
  • Laradock commit #0c41fce:
  • System info PC
  • System info 10.0.16299 Compiltaion 16299

Issue:

According to information the mysql_connect function was deprecated in version 7.0 of PHP, but when I set up the environment with PHP 5.6.35, my projects with this function do not work

Expected behavior:

The use of this method should occur naturally.


Reproduce:

`<?php

$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');

if (!$link) {
die('Could not connect: ' . mysql_error());
}

echo 'Connected successfully';

mysql_close($link);

?>`


### PHP Version ###########################################

# Select a PHP version of the Workspace and PHP-FPM containers (Does not apply to HHVM). Accepted values: 7.2 - 7.1 - 7.0 - 5.6 - 5.5
PHP_VERSION=5.6

### PHP Interpreter #######################################

# Select the PHP Interpreter. Accepted values: hhvm - php-fpm
PHP_INTERPRETER=php-fpm

...

@philippeboyd
Copy link

Do you have the extension installed?

mysql_connect() is still part of 5.6 (removed in 7)
try to do the following :

docker exec $container_name docker-php-ext-install mysql
docker restart $container_name

@jerfeson
Copy link
Author

Actually, the extension was not installed, but this should already be automatic at the time of mounting the container, I will study laradock, and try to develop this, for now I am still exploring the tool.

Many thanks for the help;

@hlorofos
Copy link

Any update how this could be persistently done?

@vv12131415
Copy link
Contributor

@hlorofos you can put the code (that was suggested by @philippeboyd) in your Dockerfile. Or even send PR. The problem is, it probably will not be merged, because the 5.6 EOL is in 2 mouths from now.
So the installing of the extension is mostly up to you.

@stale
Copy link

stale bot commented Feb 2, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the Stale label Feb 2, 2020
@stale
Copy link

stale bot commented Feb 23, 2020

Hi again 👋 we would like to inform you that this issue has been automatically closed 🔒 because it had not recent activity during the stale period. We really really appreciate your contributions, and looking forward for more in the future 🎈.

@stale stale bot closed this as completed Feb 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants