Search

A few days ago, I apt-get upgrade the server(nginx+php-fpm+mysql), then all of the sites by symphonycms notie:

Symphony Database Error. There was a problem whilst attempting to establish a database connection. Please check all connection information is correct. The following error was returned:

0:

But on the same server, all website by wordpress can be a normal visit.

Then I look at the error.log and found that there is such a prompt,

2014/04/15 05:43:17 [error] 2545#0: *454 FastCGI sent in stderr: "PHP message: PHP Notice: Undefined index: HTTP_HOST in /srv/www/bber.im/public_html/index.php on line 6" while reading response header from upstream, client: 123.125.232.11, server: bber.im, request: "HEAD / HTTP/1.0", upstream: "fastcgi://127.0.0.1:9000"

how can I solve this problem?thanks

You need to find out how to get Nginx to pass the HTTP_HOST through to PHP FPM.

We don't support Nginx natively, although some of our community use it. As this is an Nginx configuration option issue, you probably would find more help on their forums.

ok,thanks.why the wordpress webiste in the same server is OK?

It may be that Wordpress uses SERVER_NAME and not HTTP_HOST.

I running a Symphony 2.3.x site on Nginx 1.4.6/PHP-FPM 5.5.9/MariaDB/Ubuntu 14.04 LTS machine... but I am no receiving this error...

Symphony Database Error. There was a problem whilst attempting to establish a database connection. Please check all connection information is correct. The following error was returned:

0:

Any thoughts on how to get Nginx to recognize the Symphony database? No other problems with other CMS's.

Here's my site setup...

server {
    listen 80;
    server_name example.com www.example.com;
    root /var/www/example.com/html;
    index index.php;

    location / {

        ### BACKEND
        if ($request_filename ~ /symphony/) {
          rewrite ^/symphony/?$ /index.php?mode=administration&$query_string last;
          rewrite ^/symphony(/(.*/?))?$ /index.php?symphony-page=$1&mode=administration&$query_string last;
        }

        ### IMAGE RULES
        rewrite ^/image/(.+.(jpg|gif|jpeg|png|bmp|JPG|GIF|JPEG|PNG|BMP))$ /extensions/jit_image_manipulation/lib/image.php?param=$1 last;

        ## Add trailing slash
        rewrite ^(.*[^/])$ $1/ permanent;

        ### MAIN REWRITE - This will ignore directories
        if (!-d $request_filename) {
            rewrite ^/(.*)$ /index.php?symphony-page=$1 last;
        }

    }  

    location ~* .(?:ico|css|js|gif|jpe?g|png|ttf|woff)$ {
        access_log off;
        expires 30d;
        add_header Pragma public;
        add_header Cache-Control "public, mustrevalidate, proxy-revalidate";
    }

    location = /robots.txt { access_log off; log_not_found off; }
    location = /favicon.ico { access_log off; log_not_found off; }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    location ~ .php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTPS off;
    }

    location ~ /.ht {
        deny all;
    }

}

It's probably more an error with MariaDB than Nginx from the looks of that error. If you have mysql available, test with that to rule out Nginx.

Weird. I am running the same version of MariaDB in my development environment with Nginx and it is running fine.

Plus, I have used the db credentials that I use for the site to connect to the database via the command line.

I am stuck.

Found the problem!!! I looked at phpinfo on both my development environment and my production server, and found that my development machine was using the MySQL native driver for PHP php5-mysqlnd and on my production server I was using php5-mysql. So, I ran sudo apt-get install php5-mysqlnd to install that package and it says that it will replace php5-mysql package when php5-mysqlnd installs. Ran that. Restarted php and it works now!!!

So it wasn't MariaDB or Nginx... it was the way PHP was configured. Thank you for your help!

@iwyg - the solution per that page (and what I mentioned in my post above)... is that you need to install mysqlnd (MySQL Native Driver for PHP), that fixes the issue.

Glad you found the resolution :) How has your MariaDB experience been?

it's been good. no problems so far

@bzerangue I just saying that this is a known issue.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details