I have an error when running Laravel5.
PDOException in Connector.php line 119:
could not find driver
I checked which PDO driver is installed and found sqlite.
$ docker run -it php:7.0 php -r 'phpinfo();' | grep pdo
pdo_sqlite
How can I add pdo_mysql?
you have a to build a new image based on this one, and use this command in the Dockerfile:
RUN docker-php-ext-install pdo_mysql
take a look at more detailed documentation there : https://hub.docker.com/_/php/
Really thank you!
I'm running a container without dockerfile, how would I do in this case? I would like to install "pdo_mysql" and "GD" php modules.
I'm running with the command:
docker run -d -p 3030:80 --name anchor-blog-1 -v "$PWD":/var/www/html php:7.0-apache
@tghelere you _could_ do that without a Dockerfile, but it鈥檚 going to be a pain: you鈥檇 need to write a command that install the modules and then starts apache. and it would need to do so each time you start the container..
something like:
docker run -d -p 3030:80 --name anchor-blog-1 -v "$PWD":/var/www/html php:7.0-apache bash -c "docker-php-ext-install pdo_mysql gd; apache2-foreground" (not tested)
you have a to build a new image based on this one, and use this command in the Dockerfile:
RUN docker-php-ext-install pdo_mysqltake a look at more detailed documentation there : https://hub.docker.com/_/php/
I wasted alot of time trying to install pdo_mysql using apt-get, and forget that docker phalcon offers an easy way to do this by using docker-php-ext-install pdo_mysql
RUN docker-php-ext-install pdo_mysql
Solved my problem!! Thanks
Most helpful comment
you have a to build a new image based on this one, and use this command in the Dockerfile:
RUN docker-php-ext-install pdo_mysqltake a look at more detailed documentation there : https://hub.docker.com/_/php/