Help Center *almost* working.
I'm currently getting the following message even though the database has been created and I am able to connect to it. boot.php is configured. Since this is nginx, fastcgi is run separately on port 9000. It seems odd that the database is not being selected even though it is defined.
2008/05/23 03:23:28 [error] 14226#0: *10 FastCGI sent in stderr: "Exception thrown while preparing page: Database error getting Sprinkles root URL: No database selected" while reading response header from upstream, client: 192.168.1.1, server: help.foo.com, request: "GET /admin-findsite.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "help.foo.com"
Aside from the fact that it's 3:47am, any suggestions would be welcome.
The more people who ask this question, the more it gets noticed.
-
Inappropriate?We've run helpcenter both in sub directories as well as sub domains using apache during the development; We haven't yet run it underneath nginx, but I'll work on that when I get into work.
I have a feeling that this is just a subtle mis-alignment of installation and configuration; My gut tells me it doesn't have anything to do with running underneath fastcgi.
To debug: The call to the DB is probably in line 10 of admin-findsite.php. Before that, but after the load of Sprinkles.php, I would paste:
$mysql = mysql_connect($mysql_connect_params, $mysql_username, $mysql_password);
if (!$mysql) throw new Exception("Stopping: Couldn't connect to MySQL database.");
mysql_select_db($mysql_db ? $mysql_db : 'sprinkles');
$result = mysql_query('select * from site_settings');
if (!$result) {
die("Database error looking up current session: " . mysql_error());
}
Get that to a point where it doesn't error out. It's an rough extraction of how the settings data gets loaded from the DB. var_dump each of those variables out to ensure that boot.php is setting them to the correct values.
I'll report back here if/when I have issues running under nginx/php. What version of each are you running?
Thanks for reporting this! -
Inappropriate?Scott,
Thanks for the quick followup. I agree it's probably a subtle config issue.
This is what I have in boot.php (small changes to protect the innocent).
$mysql_username = 'toor;
$mysql_password = 'n@@rf!!';
$mysql_db = 'sprinkles';
$mysql_connect_params = '192.168.1.29:3306';
I stuck the code fragment above in admin-findsite.php just before findsite->data.
It currently fails with "Database error looking up current session: No database selected" so it looks like the connect succeeded but it's not getting expected data back from the query.
I am able to do the select from the command line just fine so it's a little strange. I did note that only the background_color column has data (#86fff6) with everything else being null.
On a lark, I dropped and recreated the database but that did not seem to have any effect.
As far as the config goes, I'm running on Ubuntu 8.04 with standard packages for php, smarty, mysql etc. MySQL is set to run in UTF8 (due to my app) but should not affect things (in theory).
nginx is compiled and is at version 0.6.30. fastcgi is started via an init script and bound to port 9000.
PS. I would be happy to do a writeup once I get this working. nginx is my new favorite toy and it just didn't seem right to have to fire up apache or something else just to run this. =) -
Inappropriate?Are you connecting with the same credentials on the command-line? Could it be a permissions issue for the 'toor' user?
1 person says
this answers the question
-
Hah! That was it. I had localhost privs while connecting through mysql. On retesting using -h and trying to use sprinkles, it bombed out.
Works now! Awesome. -
good to hear! -
Inappropriate?Now that things are working, here's a couple suggestions.
There is a typo on http://getsatisfaction.com/company/ad...
It should be "sprinkles-schema.sql" instead of "sprinkles-schema.php".
That page is also somewhat misleading. It took me reading the INSTALL file to realize that I had to install smarty for instance. So I would either rework the text to have people read the INSTALL file or copy the contents over.
Database by default is latin1. utf8 is my preference but this is not a big one.
I did notice that there are no indices for any of the tables. I have not looked at the data structure closely yet but I would imagine this should be defined out of the box.
That's it for now and I'll play more with it later.
I’m happy
-
Inappropriate?You shouldn't need to install Smarty, it is bundled in the vendor directory of the source. The install instruction in the source just haven't been updated yet.
Did you get errors before installing the debian package for Smarty?
The DB only gets used for a few things: site_settings has a single row of configuration information, admins has one row per administrator in your company (1-10) rows with a single column of info.
The http_cache and sessions tables could definitely use some indices. For the most part they will remain pretty small since they are both transient and very gradual build ups, but it would become an issue eventually.
thanks for the feedback. -
Scott, you are right. I just removed the ubuntu smarty package and it works fine. I'll follow up with the rest later. -
Inappropriate?also, where's the install living? we'd love to check it out!
-
Lane, it's at http://help.vurbu.com/. It's the default install since I have not had time to customize it yet.
I would say that the INSTALL file should point out which css file to modify so that it's more evident.
One side benefit though is that the config I have now properly sets expires and gzip so that things are nice and fast. -
One more thing, it would be nice to be able to add Google Analytics code to track who is visiting the help forum. -
Inappropriate?Okay, I've finished dressing things up so it should be part of the same look and feel now.
I had to do some digging around to get nginx and php to work, especially since there is no php-fastcgi init file. If you are using Debian, ensure that php5-cli and php5-cgi packages are installed.
I found the following links useful for doing setup.
http://drupal.org/node/110224
http://blog.codefront.net/2007/06/11/...
http://www.mail-archive.com/debian-bu...
http://bugs.debian.org/cgi-bin/bugrep...
The following is the nginx config that I am using. As mentioned, it comes with the added bonus of max expires for CSS, Javascript and image files. For even more of a boost, you can turn gzip compression on (see http://tumblelog.jauderho.com/post/27...)
Enjoy!
# the server directive is nginx's virtual host directive.
server {
# port to listen on. Can also be set to an IP:PORT
listen 80;
# Set the charset
charset utf-8;
# Set the max size for file uploads to 10Mb
client_max_body_size 10M;
# sets the domain[s] that this vhost server requests for
server_name help.foo.com;
# doc root
root /var/www/help.foo.com;
# vhost specific access log
access_log /var/log/nginx_access.log main;
# Set image format types to expire in a very long time
location ~* ^.+\.(jpg|jpeg|gif|png|ico)$ {
root /var/www/help.foo.com;
expires max;
break;
}
# Set img, css and js to expire in a very long time
location ~* ^.+\.(css|js)$ {
root /var/www/help.foo.com;
expires max;
break;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/help.vurbu.com$fastcgi_script_name;
include /usr/local/nginx/conf/fastcgi_params;
}
# Catchall for everything else
location / {
root /var/www/help.foo.com;
index index.php index.html;
if (-f $request_filename) {
break;
}
# if (!-e $request_filename) {
# rewrite ^(.*)$ /index.php?q=$1 last;
# break;
# }
}
error_page 500 502 503 504 /500.html;
location = /500.html {
expires 5d;
root /var/www-rails/foo.com/public;
}
error_page 404 /404.html;
location = /404.html {
expires 5d;
root /var/www-rails/foo.com/public;
}
} # end help.foo.com block
I’m excited
1 person says
this answers the question
-
Awesome details! This will be helpful to others I'm sure.
Loading Profile...





EMPLOYEE
EMPLOYEE