million12 / docker-nginx-php

Docker with Nginx / PHP-FPM 7.3 7.0 5.6 5.5
https://registry.hub.docker.com/u/million12/nginx-php/
123 stars 65 forks source link

missing mysql extension for PHP? #11

Closed FezVrasta closed 4 years ago

FezVrasta commented 8 years ago

I'm trying to use your image to run a container which runs nginx and php, which connects to the official mysql container.

When I try to start my Joomla application, tho, it says:

Error displaying the error page: Application Instantiation Error: Could not connect to MySQL.

After some digging, I've found that the MySQL extension is not loaded in PHP.

I've then mounted /etc/php.d and used it to load a custom ini file with inside:

extension=/usr/lib64/php/modules/mysql.so
extension=/usr/lib64/php/modules/mysqli.so

(I've also tried writing just mysql.so without the full path)

But nothing seems to load...

Any clue?

pozgo commented 8 years ago

HI, I'm using this image for my Cacti server and Mysql database and all seems to work ok. Can you attach information how you run both containers? Mysql setup and nginx-php

FezVrasta commented 8 years ago

I'm using Docker Cloud.

I've started the mysql container specifying the root password. The nginx-php contains starts specifying just the www/default path and adding a basic default.conf to serve files from there.

I've then put a test.php file which tries to connect to mysql and it doesn't work. Same with Joomla.

I try to connect to mysql host, with root as user and mysql as database.

Using another imge (nginx-docker) everything works fine, but I'd like to use this one because it's easier to configure.

pozgo commented 8 years ago

are those containers linked?

Remember that docker-compose.yml for docker cloud differs in few options.

As far as I remember links: works a bit different.

See example of this docker-compose.yml

PS. If possible attach your cloud-config.yml

FezVrasta commented 8 years ago

Yes they are linked, if I ssh in the container and do ping mysql I get a reply... Also, configuring the same way the other php/nginx container, everything works.

Also, when I read the phpinfo(), there not seem to be any extension loaded.

No idea where to find cloud-config.yml sorry :(

pozgo commented 8 years ago

sorry, I mean docker-dompose.yml I need more details to diagnose it.

FezVrasta commented 8 years ago

Sorry I can't find where to get such file from the Docker Cloud UI...

Here some details, I hope they can be useful:

Image tag million12/nginx-php:php56
Deployment strategy
Deploy tags
No deploy tags
Ports
Run command
Entrypoint
AutoredeployOff
Autorestart Off
Autodestroy Off
PID None
Network Bridge
Sequential deployment Off
Memory limit
No Limit

CPU shares
No Limit

Privileged Off

Linked to
mysql-ad0c2c3e  MYSQL  Running

Volumes
/data   /mnt/xxx/data       
/etc/php.d      /mnt/xxx/php.d      
/etc/nginx/conf.d   /mnt/xxx/nginx
pozgo commented 8 years ago

You are using a yml file to deploy into docker-cloud. That's where you set up everything. I would need to see how exactly you are deploying both database and Nginx.

FezVrasta commented 8 years ago

I'm not using any yml, I'm creating the services manually using the UI...

pozgo commented 4 years ago

MariaDB was added to the image some time ago. Closing