Question

Has anyone solved this error?A PHP Error was encountered Severity: Warning Msg: mysqli:real_connect(): (HY000/2002): Connection refused

Posted August 23, 2019 8k views
UbuntuMySQLPHP

error 1
A PHP Error was encountered

Severity: Warning

Message: mysqli::real_connect(): (HY000/2002): Connection refused

Filename: mysqli/mysqli_driver.php

Line Number: 201

error 2
A PHP Error was encountered

Severity: Warning

Message: fopen(/var/www/arquiv/htdocs/application/ciarquivsessions/ci_sessionunb9drq50aqrr8buagl3tfe4tf4qnh6d): failed to open stream: No space left on device

Filename: drivers/Sessionfilesdriver.php

error3
An uncaught Exception was encountered

Type: Error

Message: Failed to create(read) session ID: user

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello,

It looks like that your server is running out of disk space. You can check that with this command:

df -h

My guess would be that the server ran out of space and MySQL crashed, that is why you are getting the first error. The second error on the other hand is self explanatory: No space left on device.

You would have to extend your disk space or clear some old files in order to free up some space and then start MySQL.

Hope that this helps!
Regards,
Bobby

  • Fixed space issue, now nginx is giving 502 bad gateway error , do you know how to fix?

    • Hello,

      I would recommend checking your error log at /var/log/nginx/error.log. This would give you more information on what could be causing the issue.

      Regards,
      Bobby

      • these errors appeared:
        nginx: [emerg] bind() to [::]:18915 failed (98: Address already in use)
        nginx: [emerg] bind() to [::]:443 failed (98: Address already in use)
        nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
        nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
        nginx: [emerg] bind() to [::]:80 failed (98: Address already in use

        Do you know how to solve them?

        • Hello,

          Yes it looks like that another service is using port 80 at the moment, and it is not possible to have two services listening on the same port at the same time.

          To find out which service is using the port you could run this command:

          netstat -plant | grep 80
          

          Then if you do not need this service you could stop it and disable it so that it does not start on boot.

          After that you should be able to start Nginx as normal.

          Hope that this helps!
          Regards,
          Bobby

Submit an Answer