Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

website error

Posted on 2013-06-26
11
Medium Priority
?
461 Views
Last Modified: 2013-07-01
we imported a website and database from a hosted environment to a web server here in our office and when ever we launch the web site we get this error "SQLSTATE[HY000] [2003] Can’t connect to MySQL server on ‘xxx.xxx.xxx.xxx’ (13)" we checked the settings.php file on the web server but everything looks to be ok. Can you please tell me what settings should be in the settings.php file
0
Comment
Question by:dcircolone
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
11 Comments
 

Author Comment

by:dcircolone
ID: 39278725
I should mention that I can connect to the database using the user name and password that are in the setting.php file from the web server to the database server, we are using PHP 5.3.3, CentOS 6.4, mysql 5.6, drupal 7
0
 

Author Comment

by:dcircolone
ID: 39278735
This is the exact error

PDOException: SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'xxxx.xxxx.xxxx (13) in lock_may_be_available() (line 165 of /var/www/pathapi/includes/lock.inc
0
 

Expert Comment

by:chrisvee
ID: 39278941
in settings.php  you have to replace ip address xxxx.xxxx.xxxx  to  " localhost "

anyway send me your settings.php file once.
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:dcircolone
ID: 39278971
even if the database isn't on the local host?
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39279049
If your MySQL database is on Godaddy, you had to set it up for remote access when you created it or you will not be able to get to it from 'outside'.  Other hosting companies have similar restrictions.
0
 

Expert Comment

by:chrisvee
ID: 39279059
yes. i agree with @DaveBaldwin. remote access is not allowed almost in all hosting services.
0
 

Author Comment

by:dcircolone
ID: 39279103
we are currently hosting both the database and webserver in our datacenter, they used to hosted at a university ( we are a medical association ) but we moved the web site and database here to our office, we moved 3 sites total 2 of the sites are on server 2008 R2 using IIS and PHP, these sites can connect to the database with no issues. The site in question is on CentOS 6.4 , Apache, PHP but when we try to go to the site is when we get the error.

I can connect to the database server from the CentOS web server using the mysql command.
The database is hosted on a windows 2008 server.
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39279400
Which machine is the MySQL database on?  You need to see if the username and password you are using is allowed to connect from the CentOS server.
0
 

Accepted Solution

by:
dcircolone earned 0 total points
ID: 39279401
I found the answer, we had to run this command on our CentOS web server
"setsebool -P httpd_can_network_connect 1" and then we were able to connect the web server to the database server
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 39279427
Ok, that's a new one on me.  Never had that problem on my Ubuntu Linux servers.  I see that is part of SELinux which I don't run.  http://linux.die.net/man/8/setsebool
0
 

Author Closing Comment

by:dcircolone
ID: 39289430
I was able to find the solution by researching on line, none of the experts answers solved the issue, I appreciate the help you give on most issue though
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question