Database Connection Failed, only on certain pages/devices

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
Chris F
Forum Members
Forum Members
Posts: 31
Joined: Wed Jan 28, 2009 3:33 pm

Database Connection Failed, only on certain pages/devices

Post by Chris F »

Having an odd but serious error on my install (http://www.houstonswimclub.com). The site runs normally as expected without errors on a desktop (Chrome, Edge, etc), except for 1 URL http://www.houstonswimclub.com/employment where I get the following error:

Code: Select all

Database Connection Failed
Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) (2002)
Function Performed: CONNECT
On mobile devices, the root URL doesn't work either. If you go to http://www.houstonswimclub.com on a phone (any browser, Chrome, stock, etc) you get the error:

Code: Select all

Database Connection Failed
Error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) (2002)
Function Performed: CONNECT
All the other URLs/pages work fine. If you visit http://www.houstonswimclub.com/home it will load fine. I just changed the name of the /employment page to /jobs and now jobs loads just fine. (employment should now go to the 404 page, but it doesn't).

I thought it might have something to do with my htaccess file and PrettyURL use, but I checked and don't see anything out of the ordinary. It's been working with PrettyURL just fine for over a year, just suddenly stopped working in those two instances without any changes on my part. Host just says it's a "scripting error".

Anyone else encountered this or know what the solution might be? Thanks!

CMSMS 2.2.3.1


Installed Modules
AdminSearch 1.0.4
CGBlog 1.15.5
CGCalendar 2.5
CGExtensions 1.57.1
CGFeedback 2.1
CGSimpleSmarty 2.1.7
CMSContentManager 1.1.6
CMSMailer 6.2.14
Captcha 0.5.5
CmsJobManager 0.1.1
DecisionTree 0.2.12
DesignManager 1.1.3
FAQ 2.0.3
FileManager 1.6.4
FilePicker 1.0.1
FormBuilder 0.8.1.6
FrontEndUsers 2.1.1
Gallery 2.3.2
JQueryTools 1.4.0.3
MenuManager 1.50.3
MicroTiny 2.2.1
ModuleManager 2.1.2
Navigator 1.0.8
News 2.51.3
Search 1.51.2

Config file

Code: Select all

<?php
# CMS Made Simple Configuration File
# Documentation: https://docs.cmsmadesimple.org/configuration/config-file/config-reference
#
$config['dbms'] = 'mysqli';
$config['db_hostname'] = 'localhost';
$config['db_username'] = 'xxxxx';
$config['db_password'] = 'xxxxx';
$config['db_name'] = 'xxxxx';
$config['db_prefix'] = 'cms_';
$config['timezone'] = 'America/Chicago';
$config['url_rewriting'] = 'mod_rewrite';
?>
Last edited by Chris F on Tue Oct 24, 2017 1:29 pm, edited 1 time in total.
Chris F
Forum Members
Forum Members
Posts: 31
Joined: Wed Jan 28, 2009 3:33 pm

Re: Database Connection Failed, only on certain pages/device

Post by Chris F »

Code: Select all

RewriteEngine on

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^smartbaby$ "http\:\/\/www\.houstonswimclub\.com\/news\/25\/42\/Babies\-Need\-Swim\-Lessons" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^birthdays$ "http\:\/\/www\.houstonswimclub\.com\/uploads\/Documents\/2017_birthday_flyer\.pdf" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^birthday$ "http\:\/\/www\.houstonswimclub\.com\/uploads\/Documents\/2017_birthday_flyer\.pdf" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^partyinvites$ "http\:\/\/www\.houstonswimclub\.com\/uploads\/Documents\/birthday_card\.pdf" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^katy\-portal$ "https\:\/\/www\.iclassprov2\.com\/parentportal\/houstonswimclubkaty\?new\-url" [R=301,L,NE]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^cypress\-portal$ "https\:\/\/www\.iclassprov2\.com\/parentportal\/hsccypress\?new\-url" [R=301,L,NE]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^sharpstown\-portal$ "https\:\/\/www\.iclassprov2\.com\/parentportal\/hscsharpstown\?new\-url" [R=301,L,NE]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^sugarland\-portal$ "https\:\/\/www\.iclassprov2\.com\/parentportal\/hscsugarland\?new\-url" [R=301,L,NE]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^pearland\-portal$ "https\:\/\/www\.iclassprov2\.com\/parentportal\/hscpearland\?new\-url" [R=301,L,NE]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^support$ "https\:\/\/www\.fastsupport\.com\/392874261" [R=301,L]

RewriteCond %{HTTP_HOST} ^houstonswimclub\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.houstonswimclub\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^timeclocksl$ "https\:\/\/hscsugarland\.shiftplanning\.com\/tct\/b82df92738bdea35adb4aa3de267f9b6" [R=301,L]

RewriteOptions inherit

# Use PHP5.4 Single php.ini as default
AddHandler application/x-httpd-php54s .php
#Force www:
RewriteCond %{HTTP_HOST} ^houstonswimclub.com [NC]
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.*)$ http://www.houstonswimclub.com/$1 [L,R=301,NC]
ErrorDocument 404 /index.php?page=404

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^timeclockSH$ "https\:\/\/hscsharpstown2\.shiftplanning\.com\/tct\/7191375e82eeb6c60a60995e8363d06f" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^voteCY$ "https\:\/\/surveynuts\.com\/surveys\/take\?id\=58468\&c\=319001425NJPT" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^votePL$ "https\:\/\/surveynuts\.com\/surveys\/take\?id\=58469\&c\=319006881VHVL" [R=301,L]

# This file is specific to Apache configurations.
# It attempts to optimize traffic and configuration for your CMS Made Simple website.
# Many options are disabled by default as some providers do not allow you to override some of these settings in the .htaccess file.

#
# Attempt to override some PHP settings.
# These settings may be helpful on some hosts if your default configuration does not meet CMSMS's minimum requirements,
# and your host has given your account appropriate permissions.
#
#php_value upload_max_filesize "10M"
#php_value session_save_path "tmp/cache"
#php_value session.cookie_httponly true
#php_flag magic_quotes_gpc Off
#php_flag register_globals Off
#php_flag session.use_trans_sid Off

#
# Disallow directory indexes. This can be an important security enhancement
#
#Options -Indexes

#
# Don't allow the browser to know the type of signature.
#
ServerSignature Off

#
# Allow the Apache server to follow symbolic links.  This is usually not necessary.
#
#Options +FollowSymLinks

#
# To prevent E_STRICT problems with PHP 5.3+ you can uncomment the following lines
# Note: These settings should only be enabled for production sites!
#
#php_flag display_startup_errors 0
#php_flag display_errors 0
#php_flag html_errors 0
#php_value docref_root 0
#php_value docref_ext 0

#
# The following is to enable pretty URLS, only applicable if url_rewriting is set to 'mod_rewrite' in the config.php
#
<IfModule rewrite_module>
# If your CMSMS installation is in a subdirectory of your domain, you may need to specify the relative path (from the root of the domain) here.
# i.e: RewriteBase /cmsms
RewriteBase /

# Rewrites urls in the form of /parent/child/grandchild but only rewrites if the requested URL is not a file or directory.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>

#
# The following are highly recommended security settings for files in your CMSMS install that should not be browsed directly
#
<Files ~ "\.htaccess">
  Order allow,deny
  Deny from all
</Files>
<Files ~ "\.ini$">
  Order allow,deny
  Deny from all
</Files>
<Files ~ "\.log$">
  Order allow,deny
  Deny from all
</Files>
<Files ~ "config\.php">
  Order allow,deny
  Deny from all
</Files>
<Files ~ "/lib/*php">
  Order allow,deny
  Deny from all
</Files>

RedirectMatch 403 ^/.*\.htaccess$
RedirectMatch 403 ^/.*\.log$
RedirectMatch 403 ^/.*\.ini$
RedirectMatch 403 ^/.*config\.php$
RedirectMatch 403 ^.*/doc/.*$
RedirectMatch 403 ^.*/lib/.*\.php$
RedirectMatch 403 ^.*/tmp/.*\.php$
RedirectMatch 403 ^.*/plugins/.*\.php$
RedirectMatch 403 ^.*/modules/.*\.php$
RedirectMatch 403 ^.*/uploads/.*\.php$

# The following are performance optimizations and security enhancements for content that is served by your CMSMS installation.
#
<IfModule mod_headers.c>
        # Disable Last-Modified for performance
        Header unset Last-Modified
	# Disable ETags
	Header unset ETag
	FileEtag None
	# For Security
	Header set X-Frame-Options "SAMEORIGIN"
</IfModule>

#
# The following setups compression for content, if compression is enabled on the server.
#
<IfModule deflate_module>
	AddOutputFilterByType DEFLATE text/html text/css text/plain text/html text/xml image/gif image/jpeg image/png image/ico text/javascript application/x-javascript application/javascript application/json application/pdf
</IfModule>

#
# The following allows the browser to cache images, scripts, stylesheets and videos.  If the expires module is enabled on the server.
#
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
# Set expires tags on various file types... so that the browser wont attempt to reload them.
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/ico "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType video/x-flv "access plus 1 year"
ExpiresByType application/pdf "access plus 1 year"
ExpiresByType application/x-shockwave-flash "access plus 1 year"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType application/x-javascript "access plus 1 month"
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
	<IfModule mod_headers.c>
		# Setting cache control to public allows proxy servers to cache the items too.
		Header set Cache-Control "public"
	</IfModule>
</IfModule>

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^birthdaycard$ "http\:\/\/www\.houstonswimclub\.com\/uploads\/Documents\/birthday_card\.pdf" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^autopay$ "http\:\/\/www\.houstonswimclub\.com\/uploads\/Documents\/2017_autopay\.pdf" [R=301,L]

RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^techsupport$ "https\:\/\/www\.fastsupport\.com\/535810731" [R=301,L]
RewriteCond %{HTTP_HOST} ^houstonswimclub\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.houstonswimclub\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^cyclock$ "https\:\/\/houstonswimclub\.humanity\.com\/tct\/1f8e7a63929aa77e4f2ceb31dbb8bae9" [R=301,L]
RewriteCond %{HTTP_HOST} ^houstonswimclub\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.houstonswimclub\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^plclock$ "https\:\/\/houstonswimclubpearland\.humanity\.com\/tct\/872142d706da4b80ffc64b58752d220a" [R=301,L]
RewriteCond %{HTTP_HOST} ^.*$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^plclock$ "https\:\/\/houstonswimclubpearland\.humanity\.com\/tct\/872142d706da4b80ffc64b58752d220a" [R=301,L]
Chris F
Forum Members
Forum Members
Posts: 31
Joined: Wed Jan 28, 2009 3:33 pm

Re: Database Connection Failed, only on certain pages/device

Post by Chris F »

I have another domain aliased www.houstonswimlesson.com and it works fine, root URL on phones and all.
User avatar
Rolf
Dev Team Member
Dev Team Member
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: Database Connection Failed, only on certain pages/device

Post by Rolf »

I suspect the SSL code that cPanel(?) has injected in your htaccess file for broke the function of it... like:

Code: Select all

RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
Do you have a previous version to check?
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Chris F
Forum Members
Forum Members
Posts: 31
Joined: Wed Jan 28, 2009 3:33 pm

Re: Database Connection Failed, only on certain pages/device

Post by Chris F »

Yes! By George that fixed it. I just restored an older htaccess file from one of my backups.

I can't believe I didn't think of doing that. :o Ya'll are just genius!
Locked

Return to “CMSMS Core”