CakePHP: Database connection “Mysql” is missing, or could not be created.

Written by James McDonald

August 18, 2014

This error on Fedora 20 with CakePHP 2.5.3

CakePHP is NOT able to connect to the database.

Database connection "Mysql" is missing, or could not be created.

These commands fixed it (basically the MySQL PDO adapter is missing)

yum install php-ZendFramework-Db-Adapter-Pdo-Mysql.noarch
systemctl restart nginx
systemctl restart php-fpm

Then refresh your browser and success!

CakePHP is able to connect to the database.

This was with a cakephp “development installation”. Which means you unpack the whole cakephp download in one spot:

[me@bpc01 cakephp]$ ls /home/www/cakephp/ -1
app
build.properties
build.xml
composer.json
CONTRIBUTING.md
index.php
lib
plugins
README.md
vendors

This is the relavent part of my nginx.conf showing how I get re-writing working

 server {
        listen       80;
        server_name  localhost;
        root         /home/www;

        #charset koi8-r;

        #access_log  /var/log/nginx/host.access.log  main;

        location / {
        }

        location /cakephp/ {
            # rewrite every /cakephp url to point to the webroot but not
            # if it's already been done
            rewrite ^/cakephp(?!/app/webroot)(.*)$ /cakephp/app/webroot$1 break;
            try_files $uri $uri/ /cakephp/index.php?$uri&$args;

        }

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…