Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2021-01-04 05:19:37

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Vanilla Textpattern 4.8.4 hiccup

Not a good start to the year …!

Having trouble with a brand new Textpattern 4.8.4 install. Two problems:

  1. the config.php contents provided during setup is missing the final ?> – the last line is // For more customization options, please consult config-dist.php file.
  2. unable to access the Diags panel – see below

In Safari I get:

Safari Can’t Open the Page
Safari can’t open the page “xxxxxx-imac.local/~adi/textpattern-4.8.4/textpattern/index.php?event=diag” because the server unexpectedly dropped the connection. This sometimes occurs when the server is busy. Wait for a few minutes and then try again.

In Firefox I get:

The connection was reset
The connection to the server was reset while the page was loading.
    The site could be temporarily unavailable or too busy. Try again in a few moments.
    If you are unable to load any pages, check your computer's network connection.
    If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

All other tabs seem to be OK, public side looks fine, no plugins installed, can add articles OK, green English on Languages.

Same issues with Textpattern 4.8.3. The only significant thing that’s changed since I last did a successful TXP install is a MacOS upgrade to 10.15.7 Catalina.

The truncated config.php code provided doesn’t stop the site from working and fixing it doesn’t sort out my Diags issue. Have also tried deleting .htaccess.

Any thoughts?

Offline

#2 2021-01-04 06:27:25

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Vanilla Textpattern 4.8.4 hiccup

UPDATE: Am getting the same browser issues with 4.8.2 vanilla, which I’d installed successfully some time ago, so it must be something peculiar to my local setup.

I’ve narrowed it down to the following code in function checkUpdates() in txp_diag.php:

   if (function_exists('curl_version')) {
        $ch = curl_init($endpoint);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $contents = curl_exec($ch);
    } else {
        $contents = file_get_contents($endpoint);
    }

More specifically, the curl_exec line – if commented out I see the Diags panel OK.

If I force the use of file_get_contents() the panel displays OK albeit with “There was a problem connecting to the Textpattern update server. Please try again later. Help”.

Offline

#3 2021-01-04 06:36:08

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Vanilla Textpattern 4.8.4 hiccup

UPDATE 2:

Forcing a rerun of function checkUpdates(), using file_get_contents() gives me:

Warning "file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version".

Warning "file_get_contents(): Failed to enable crypto".

Warning "file_get_contents(https://textpattern.com/version.json): failed to open stream: operation failed".

Yuck!

Offline

#4 2021-01-04 06:37:25

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,007
Website GitHub Mastodon Twitter

Re: Vanilla Textpattern 4.8.4 hiccup

gomedia wrote #327994:

Not a good start to the year …!

Having trouble with a brand new Textpattern 4.8.4 install. Two problems:

  1. the config.php contents provided during setup is missing the final ?> – the last line is // For more customization options, please consult config-dist.php file.

Hi Ad, and best wishes for the new year.
I noticed that too and there is an explanatiion further down in that thread.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#5 2021-01-04 08:30:34

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,058
Website

Re: Vanilla Textpattern 4.8.4 hiccup

I have no problem installing / running (various) TXP locally on macOS 10.15.7 and macOS 11 with the default Apache and PHP. One difference with your install is that I access all of them in their specific domain space (e.g http://txp-dev.local/ and http://phiw13.local/).

That said accessing the diagnostics panel is a little slow, but accurate and does not trigger any errors.

Maybe there is some difference between your and my httpd.config? Or my virtual hosts settings?


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#6 2021-01-04 08:36:12

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,134
GitHub

Re: Vanilla Textpattern 4.8.4 hiccup

gomedia wrote #327996:

Warning "file_get_contents(): Failed to enable crypto".

That’s a PHP error, I’ve had that before. My solution was to use a known-good certificate bundle and that made the error go away.

Aside: in your phpinfo(), what is allow_url_fopen set to?

Offline

#7 2021-01-04 08:59:24

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Vanilla Textpattern 4.8.4 hiccup

phiw13 & gaekwad, thanks for the replies.

Access to the 4.8 sites (admin & public) is working OK.

This has the smell of an old version of PHP compiled with an old version of curl/OpenSSL. If not that then something’s out of date.

TXP 4.8 seems to be the first one to start using curl in Diags to check for updates. My 4.7 sites Diags work OK and, as mentioned before, bypassing the curl code to force it to use file_get_contents gets around the issue.

I’ll bodgie it for the time being, so I can get on, and then give PHP an upgrade.

Offline

#8 2021-01-04 09:25:57

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,578
Website

Re: Vanilla Textpattern 4.8.4 hiccup

Are you accessing your site with https:// locally? I’ve had errors before with file_get_contents being disallowed when using a self-signed certificate on a localhost. Maybe curl stumbles over the same thing.

The workaround in this stackoverflow post helped in my case.


TXP Builders – finely-crafted code, design and txp

Offline

#9 2021-01-04 09:46:27

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Vanilla Textpattern 4.8.4 hiccup

jakob wrote #328001:

Are you accessing your site with https:// locally?

No, & access to the site is working OK. The Diags panel is accessing “https://textpattern.com/version.json” using curl (in 4.8) which is where it’s failing.

Offline

#10 2021-01-04 10:26:51

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,134
GitHub

Re: Vanilla Textpattern 4.8.4 hiccup

gomedia wrote #328004:

https://textpattern.com/version.json

Anecdotally, we do seem to having more reports of update checks failing in recent years. The somewhat baffling thing is that the file above barely makes a dent in the web hits, and I’ve even set up a curl header check every second for weeks and nothing unexpected was reported (i.e. 200 OK all the way unless Nginx was restarting after an update).

I have encountered “Failed to start crypto” stuff on my own server (see the somewhat cryptic comment here: github.com/textpattern/textpattern/issues/1546#issuecomment-708247901), which reared its head on a PHP 8.0 RC compile and a cert bundle that, for whatever reason, just shrugged and failed. My solution was to get the Mozilla cert bundle (see here: curl.haxx.se/docs/caextract.html for info) on a sensible schedule, edit the PHP config, and it all just works fine…which means I haven’t investigated why it bombed out in the first place, ‘cos it just works now. Bad form, I know, but it was a funny year.

Offline

#11 2021-01-04 10:55:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,250
Website GitHub

Re: Vanilla Textpattern 4.8.4 hiccup

This is indeed intriguing. We switched to cURL recently because anyone whose host had restricted allow_url_fopen would get the ‘failed to check for updates’ message forever, which was a) misleading, and b) annoying.

Now, however, it seems to have caused another potential issue if the crypto stack isn’t fully realised. This may be that cURL assumes (or requires?) a secure connection if the request is secure, or cannot mix insecure (e.g. local http) page requests with subsequent requests to external secure sources.

Not sure exactly what we can do about this. The plan was to introduce or tweak a class that handled ‘connections’ which would do the same thing as we do on the Diagnostics panel now. I was using this panel as a testbed for the idea, with the goal of ultimately always trying cURL first, then falling back on file_get_contents() and then (maybe) trying some other mechanism such as sockets or streams, before failing as gracefully as we can.

EDIT: The solution that jakob found on StackOverflow for the secure streams might be worth investigating but I’m not sure if that can be applied to cURL too. Haven’t grokked the code yet.

If obtaining the new cert bundle works then I guess we can chalk this up to the configured environment and move on, but it would be nice to have a “broken” crypto environment to play in, so if there is any way we can detect this at the application code level, we could bail out more gracefully than a screeching halt.

As far as the closing ?> goes, it’s not been required for, what, maybe a decade or more in PHP (?) and used to cause issues if there was whitespace after it. The primary driver, though, was to simplify instructions for adding stuff to config.php – a task that may become more commonplace in the next version of Txp, with CSP headers and SMTP routing parameters being permitted in the config file.

Last edited by Bloke (2021-01-04 10:58:21)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#12 2021-01-07 04:39:26

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Vanilla Textpattern 4.8.4 hiccup

colak wrote #327997:

I noticed that too

Thanks Yiannis, and all the best to you too.

Offline

Board footer

Powered by FluxBB