splitbrain / docker-phpfarm

A Dockerfile to build an image running multiple PHP versions on Apache
http://www.splitbrain.org/blog/2014-02/02-docker_phpfarm
MIT License
226 stars 61 forks source link

Can't connect to local MySQL server through socket #8

Closed yuriyant closed 7 years ago

yuriyant commented 7 years ago

Hi! I work on Fedora 25. I ran to the local mysqld server, but the php script cannot access the database from the Docker.

I'm not familiar with Docker, can you help ?

#docker run --rm -t -i -e APACHE_UID=48 -v $PWD:/var/www:rw -p 8052:8052 -p 8053:8053 -p 8054:8054 -p 8055:8055 -p 8056:8056 -p 8070:8070 -p 8071:8071 splitbrain/phpfarm:jessie

AH00112: Warning: DocumentRoot [/var/www/html] does not exist

AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message

[Sun Jan 15 14:13:37.545861 2017] [mpm_event:notice] [pid 16:tid 140507995342720] AH00489: Apache/2.4.10 (Debian) mod_fcgid/2.3.9 configured -- resuming normal operations

[Sun Jan 15 14:13:37.545947 2017] [core:notice] [pid 16:tid 140507995342720] AH00094: Command line: '/usr/sbin/apache2'

/var/www/index.php(9) : Warning - mysqli_connect(): (HY000/2002): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
splitbrain commented 7 years ago

not really specif to this image. when the image runs think of it as another computer. your mysql database is not local, you need to connect to it over the network.