I have a php script that updates a database table as soon as i fill up a form through localhost. I am able to access my localhost homepage and then fill up the respective form, but as soon as i hit submit, i get the above error. When i check for the wamp icon that time, it turns form green to orange. This is creepy, it is green all the time but as soon as that particular php file is called, it turns orange. There is nothing wrong with the script cuz i had used it many times before. I had to reinstall wamp in betweeen and its giving error since then.
Also, phpmyadmin page does not open everytime, it says #2002 Cannot log in to the MySQL server many times. Maybe this is the reason, my php script cannot connect to the MYsql server, i have tried solutions from other threads but none of them in working :( :(
Please help me i am stuck and have an important work to do. Is anybody willing to help me out with temaviewer?
The most common reason for the MySQL server has gone away error is that the server timed out and closed the connection.
ini_set('mysql.connect_timeout', 300);
ini_set('default_socket_timeout', 300);
they are set to default at 60 seconds and this caused my problem.
see here for more details
Related
I'm currently writing a laravel application (7.4) and haven't had that many problems, then I cam back from the just gone weekend, booted up the local environment with artisan serve, and I've gotten the following;
SQLSTATE[HY000] [2006] MySQL server has gone away (SQL: select * from actions where date(time) = CURDATE() and type = hitBudget order by time desc)
That error comes up whenever the main page loads, which has a controller on it to fire off a query to populate something. The table is most certainly still there, as is the database as the LIVE version us still up and running. the IP in the .env file still points to the same server, the database credentials haven't changed at all, the only thing I recall valley is updating composer packages on the server a day or so before this happened.
Most solutions so far have pointed to timeouts, but the error occurs instantly and local works off the exact same database and tables that live does, yet live works fine.
Edit; I've done some fiddling and discovered that this error comes up regardless of what is set as the databases credentials in the .env file, I can set the host to 8.8.8.8 and its the same error, yet if I replace this ENV with a copy of the live one, it still persists.
Any ideas would be appreciated.
I have a MySQL server that is hosting my website. Yesterday, after trying to empty a certain database, I started receiving the following error when attempting to connect to my site :
PDOException: SQLSTATE[HY000] [1040] Too many connections in lock_may_be_available()
(line 167 of /home/vksappc/public_html/prod/includes/lock.inc).
After searching online for a possible solution, I restarted the server and everything was okay. Today, however, I've noticed that the number of active connections is constantly and slowly rising until it reaches the limit of 151 :
Screenshot of thread count
At which point the server then seems to timeout those connections and everything resets, only to start its gradual climb all over again:
Screenshot of new thread count
This is really becoming a big problem and as I am quite new to managing a server, I am not too sure what could be causing this or what to do next.
Any ideas?
Turns out there was a specific connection that was stuck in a loop of sending a request unsuccessfully and trying over and over again. Once we found which connection it was, we were able to kill all its processes and fix the issue. Thanks to #WilsonHauck for the tip in the comments.
Error displaying the error page: Application Instantiation Error: Could not connect to MySQL.
This Error is shown sometimes (one every 20 pageviews) and I tried a lot of solutions without any change.
This error found with Joomla 3.5+
This will help you do some testings...
On MySql server run this query...
show processlist;
If this shows a lot of connections then you may be hitting the max_connections problem. Try to increase that to a reasonable number. But, do not make it too much because if it goes beyond the amount of available resources on your server then it will make MySql server crash and it will become a bigger problem where your website will go offline.
Try to check if you are closing sessions properly in your scripts using session_write_close(); You can find more about this function here: http://php.net/manual/en/function.session-write-close.php
This function will write user's current session on disk to be reloaded next time and most important part it will do for you with this problem is that it will close PHP's any connection made to the MySql server, so it will free up the MySql server for next visitor to come and open another page.
Lets say if you have 150 max_connections and at the same time you get 200 visitors, then PHP will still wait for some time for another 50 connections to be free before giving a timeout error where you get "Could not connect to server". But, if sessions are not closing properly, then its so bad that 50 connections will never get processed because 150 will never go away very soon, there is a separate MySql setting for that named wait_timeout. So, any MySql connection you open will keep waiting until you close yourself in script just like you open OR until wait_timeout happens. But, if you close sessions properly then next connection will become available as soon as your PHP script has finished processing and page is generated for the user for viewing and it will make the connection seat free for next connection to come in.
Server RAM was very low!
After upgrade from 0.5GB to 2GB all the kind of error starts with Error displaying the error page: gone.
I found the problem solution by using htop while connecting to the server via SSH, after that, I start opening pages rapidly which show the error plus the htop shows that the RAM was close to full.
show processlist; were helpful to find that the problem not about the connection number.which it may sometimes cost the same error in the same way.
I use Wamp server. when we start wamp server first time, it show shows green icon. but when try to access phpmyadmin, the icon goes to orange color. Apache server working fine. only Mysql service is getting stop automatically.
Even also their is no log generation in MySql log file.
it shows
2002 - No connection could be made because the target machine actively refused it. The server is not responding (or the local server's socket is not correctly configured).
i have gone through various solution but it's not working.
please help if some one facing same problem and having a perfect solution for it.
thanks.
I have installed phpMyAdmin on linux server, worked fine for a couple of weeks, but now suddenly I cannot login to phpMyAdmin anymore. I can connect from my website, but cannot login manually on the server.
I have googled and searched on this forum but alle the suggestions include editing the file /var/lib/phpmyadmin/config.inc.php
Strange thing is, this file is empty. Nothing in it. So I guess, that could be my problem, but then why is it now empty and not before? And is there a default I can restore or is this something generated upon installation?
The real question I am asking myself now is, am I hacked? If not, why would this file be empty?
EDIT: directly trying to connect via SSH gives an error too: Can`t connect to local mysql server throught socket '/var/run..'
EDIT2: I did a search for files named config.inc.php and found one in /etc/phpmyadmin, this one has a lot of settings so I guess I was looking into the wrong file.. Everything from Authentication Type is not active
Any help is appreciated!