Welcome Guest, Not a member yet? Register   Sign In
[MAYBE SOLVED] HTTPS site losing PHP connection overnight!
#1

(This post was last modified: 03-04-2021, 11:17 PM by John_Betong.)

I have an Ubuntu VPS server with over a dozen sites and recently added a new free domain with CI4. The site still opens a index.html but PHP is not working?

For the past couple of days I have had to reinstall the Certbot certificate and that cured the problem. 

Now the PHP is giving the following error report:


This site can’t be reached
MyNewSite.com unexpectedly closed the connection.
Try:
  • Checking the connection
[color=var(--error-code-color)]ERR_CONNECTION_CLOSED[/color]


Any suggestions as to where I should start looking for the problem?
Reply
#2

(This post was last modified: 03-04-2021, 08:42 PM by John_Betong.)

I think I have found the problem now that I have added declare(strict_types=1); to every system PHP file:

Quote:( ! ) Fatal error: Uncaught TypeError: filter_var(): Argument #3 ($options) must be of type array|int, null given in /var/www/ci4-strict.tk/system/HTTP/RequestTrait.php on line 341


The following KLUDGE fixes the problem:

File: /system/HTTP/RequestTrait.php on line 341
PHP Code:
# KLUDGE - 2021-03-05
   $flags NULL ?: 0;

  return 
filter_var($value$filter$flags);
}
// public function fetchGlobal($method, $index = null, $filter = null, $flags = null) 

Usually the site has previously gone down overnight and I will check again tomorrow to ensure the KLUDGE cures the problem... watch this space Smile
Reply
#3

(This post was last modified: 03-05-2021, 11:38 AM by iRedds.)

In the latest version CI 4.1.1 line 341 //--------------------------------------------------------------------

declare(strict_types=1); - Strict type matching. Without this, null will not throw errors.
Reply
#4

(This post was last modified: 03-05-2021, 04:56 PM by John_Betong.)

@iReddis,
> declare(strict_types=1); - Strict type matching. Without this, null will not throw errors.

That was why I added strict_types. The site was going down and there were no errors being reported!

Where should I have started looking for problems without any errors logged?

Update:
The site did not go down last night I am delighted to say Smile
Reply
#5

I may be wrong, but it seems to me that you have a problem on the path from the browser to the server. But not including the framework.
Set environment as development in the .env file.
See server logs.
Reply
#6

@iReddis,
Quote:Set environment as development in the .env file.
See server logs.

I set the online .env file development and managed to get the error_logs to render...

I prefer using strict_types=1 and will raise some Pull Requests where necessary.
Reply
#7

(03-05-2021, 06:41 PM)iRedds Wrote: I may be wrong, but it seems to me that you have a problem on the path from the browser to the server. But not including the framework.
Set environment as development in the .env file.
See server logs.

The server was still going down overnight but at least errors were reported thanks to strict_types=1;

After well over a week I bit the bullet and purged apache2 and a2dismod php7.4... then reinstalled apache2 and php8.0. It took a while but eventually after installing a2enmod missing apache2 modules and using certbot to reinstall about sixteen domains the new domain was still going down overnight!!!!!

Fortunately I had a spare domain (which is seldom used) and swapped all the content from the new domain to the spare domain and the new domain has not gone down!!!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB