Another one with HTTP 500 codes

Website URL

http://ducks.us.to

Error Message

500 Internal Server Error

Other Information

It was fine until a few days ago when my fellow member friends started saying they couldn’t access the site.

Now I find out you’ve been tinkering with PHP and lots of sites are broken.

My forum no longer works. So I moved it over to my VPS which i hired recently for another project. IT crashes apache webserver completely. If I install a fresh version of SMF 2.0.17 which i had on this service, it runs. As soon as i copy over the database, it crashes again.

What have you done to my site?

Hi Guys,

I’m also getting 500 errors. I run a smf forum on my site and it’s been completely killed.

So i moved it over to my VPS with a company that has a genuine uptime…

The forum doesn’t run there either. Infact it’s been trashed so badly that even after changing all the configuration paths, running the repair script and seeking assistance over at SMF, the forum STILL crashes the apache webserver - with eaccelerator. If I disable eaccelerator then apache survives it but i still get white pages.

I’ve tried a fresh install and it works fine - same version. As soon as i delete the database from the fresh version and copy my forum’s tables into it, the forum is dead again.

Infinityfree, care to comment on what you’ve done to my database? - which now crashes my VPS…

I moved your post here to make it easier for other users to follow everything you mentioned

6 Likes

Well i’ve narrowed it down to the members table of the SMF forum. It’s borked beyond all borkness.

I don’t know what infinityfree have done to it but it hangs mysql repeatedly - even after flushing, checking, repairing, analysing etc. It STILL hangs mysql which in turn causes a php crash which takes down apache.

How did I find this?

I created a fresh install and one by one copied each original table over to the fresh database then refreshed the new install. It worked perfectly on every single table except the members one (and yes i tried those other tables after it - restoring the fresh members table to do so).

So looks like the server had a power hiccup or something and borked my table beyond repair. Daft thing is phpmyadmin can still work with it, it just takes mysql over 30 odd seconds to access the table each time.

Infinityfree, please help.

Nothings changed with the database setup, only the PHP version was updated. Can you enable error logs in the control panel and see what comes up?

6 Likes

You say that but then why is my site not displaying a simply index.htm file? - the webserver typically prioritises .htm over php and yet my .htm file still causes a 500 error.

There is something very wrong here.

It’s displaying it just fine:
http://ducks.us.to/index.htm

Not this webserver. If you want to do that, you’ll need to add your own DirectoryIndex configuration.

6 Likes

Hi Delta4orce,

Only PHP files can cause 500 error codes, static HTML is whatever you have coded to display, nothing fancy going on there.

Normally, it is considered bad practice to have index.html and index.php exist at the same time but it is completely up to how you set the DirectoryIndex Apache directive using the .htaccess file.

As for your original issue, MySQL hanging has nothing to do with server updates whatsoever, it simply means either the export is bad or the data is too much for either MySQL to handle, depending on how your table is structured.

If you’re doing large imports, 30s is nothing beyond normal, some would take hours if you endeavour. Chop things up and run import statements in batches to avoid awkward issues and keep things intact. Then you can try refreshing installations again.

As for this one, a PHP crash at most would cause a Fatal error to be displayed or a white page if you have display_errors disabled. It simply won’t take down Apache or something else happens so that your Apache cannot survive. (Overload CPU on your local during a massive import going on? Hosting Apache simply can’t die or the whole thing won’t be working for others.)

From the coding perspective, you should always handle the case in your PHP code just in case MySQL cannot fetch your required information. Frameworks would normally do this automatically if you use their syntax correctly. If you custom-coded your website, you might want to put an HTTP timeout response code or redirect users to a message and then automatically bring them back to the previous page to try again.

Cheers!

6 Likes

I appreciate that… but i did not write SMF forum.

Come on guys, enough is enough. Can I please have my website back online? - I don’t have enough time to be faffing about trying to fix it on another server.

Try installing a fresh installation of SMF, does it work? If so, maybe something got corrupted with the other install you had. If it does not work, do what I told you to do before:

If there was a magically button that fixed everything, this forum would not exsist, and thousands of support operators around the world would be out of a job. Unfortunately for everyone but people invested in job security, there is no such button.

Now technically, your website is ‘online’ - but I’m assuming the technical definition of the word is not the one you intended to use.

4 Likes

With error logs enabled, your website seems to show this:
Fatal error: Array and string offset access syntax with curly braces is no longer supported in htdocs/Sources/Subs.php on line 3825

Seems like the SMF version you’re on is not one intended for PHP 8.2…

4 Likes

yet strangely others who grumble on here about 500 errors then replay saying their site is back online… hence my request.

I tried to enable error logging in the main script, i continued to get a white page showing a 500 error. It’s interesting that you’ve managed to get it working. I’m not exactly unskilled at debugging having used php for years and debugged all sorts of odd hiccups but this one (with the limited control panel that we have) had me stumped.

I can rectify parse errors etc… but i’m still stumped as to why a clean SMF install works on my VPS running 5.3.6 but copying tables into it screws it over. Additionally if i then copy the fresh tables back into it, it still hangs. Same with the forum files too. It’s very bizzarre as if mysql is caching the database tables -even after restarting it. Same with Apache.

If i can get the site running again here i’ll leave it here with infinity…

So can perl… or a bad server config.

Not really, index.htm uses virtually no resources on a heavily strained server - should you need to put a site offline, index.htm does a great job if you upload it (or rename a saved file to it). There is a reason apache allows it by default.

It’s only a small forum though with 12 members at most that are active (we’re a breakaway group from our ISPs forum - too many flamewars etc were going on). It’s not a large forum at all and all the data I would expect to see IS in the tables but it’s as if mysql struggles with it. I wonder if MariaDB being imported to mysql might be an issue.

No that’s just to BROWSE the table in phpmyadmin. Imports didn’t really take too long in the grand scheme of things.

So why do I have to start the apache service again on my VPS every time I attempt to visit the forum with a browser? - With all due respect, apache CAN be crashed. If I renable eaccelerator in php.ini then the windows server can’t even restart it automatically. If i disable eaccelerator then windows is able to restart it but the logs still show apache crashed. It’s all well and good you talking about the theory of it but i’m telling you directly from first hand experience what is happening.

Last paragraph isn’t really relevant. I mentioned in my opening post that it’s SMF, there is little point lecturing me abnout handling php errors and database woes. You might want to suggest it to the authors of SMF though - whos own database version checking code complains that v5 of mysql is below the minimum of version 4.1 lol. I tried to tell them about this, they weren’t keen on accepting it was a fault. Probably doesn’t help that floats don’t have two decimal points and thus can’t really be operated on in a numerical sense for version comparison.

This could be an issue; if I’m correct, MariaDB 10.4 is being used here. I know MariaDB can replicate from MySQL, but I’m not sure if the opposite is true.

Have you tried importing to a MariaDB test database (on a localhost environment) and see if SMF still crashes?

3 Likes

From the error logs just seconds ago… (on my vps)

*** UnKnown can’t find 127.0.0.1: Not implemented

[Sun Oct 01 12:10:41 2023] [notice] Parent: child process exited with status 3221225477 – Restarting.
[Sun Oct 01 12:10:43 2023] [notice] Apache/2.2.17 (Win32) DAV/2 mod_ssl/2.2.17 OpenSSL/1.0.0d PHP/5.3.6 configured – resuming normal operations
[Sun Oct 01 12:10:43 2023] [notice] Server built: Oct 16 2010 13:40:27
[Sun Oct 01 12:10:43 2023] [notice] Parent: Created child process 5560
[Sun Oct 01 12:10:45 2023] [notice] Child 5560: Child process is running
[Sun Oct 01 12:10:45 2023] [notice] Child 5560: Acquired the start mutex.
[Sun Oct 01 12:10:45 2023] [notice] Child 5560: Starting 250 worker threads.
[Sun Oct 01 12:10:45 2023] [notice] Child 5560: Starting thread to listen on port 443.
[Sun Oct 01 12:10:45 2023] [notice] Child 5560: Starting thread to listen on port 80.

I don’t have any other MariaDB databases to test it against other than the one I have here. However in inifinityfree’s phpmyadmin I exported it for Mysql4… and then imported it as that at the other end - literally done in the last few minutes wth all the original files from the infinity server…

Crash.

Logs:
*** UnKnown can’t find 127.0.0.1: Not implemented

[Sun Oct 01 12:10:41 2023] [notice] Parent: child process exited with status 3221225477 – Restarting.
[Sun Oct 01 12:10:43 2023] [notice] Apache/2.2.17 (Win32) DAV/2 mod_ssl/2.2.17 OpenSSL/1.0.0d PHP/5.3.6 configured – resuming normal operations
[Sun Oct 01 12:10:43 2023] [notice] Server built: Oct 16 2010 13:40:27
[Sun Oct 01 12:10:43 2023] [notice] Parent: Created child process 5560
[Sun Oct 01 12:10:45 2023] [notice] Child 5560: Child process is running
[Sun Oct 01 12:10:45 2023] [notice] Child 5560: Acquired the start mutex.
[Sun Oct 01 12:10:45 2023] [notice] Child 5560: Starting 250 worker threads.
[Sun Oct 01 12:10:45 2023] [notice] Child 5560: Starting thread to listen on port 443.
[Sun Oct 01 12:10:45 2023] [notice] Child 5560: Starting thread to listen on port 80.

Whatever inifinity did, they did it real good…

This is very strange… MariaDB 10.4 is compatible with MySQL 5.7… MySQL4 is quite old and I’d assume no longer supported.

Aside from that, I can’t seem to find the option in IF’s PHPMyAdmin; these are my export options instead:
image

3 Likes

It was one of the export options - i figured if it wasn’t working with ‘none’ selected, i’d try an older version.

Needless to say that did import (like the previous version) but still the forum crashes and takes php with it - in turn taking apache.

Hi Delta4orce,

Holy smokes that’s a long reply, let me read it as I’m catching up with 2-days stacked posts.

If the error is a server architecture level, many hosting would have handled that as a 503 gateway timeout, as 500 would confuse clients, despite the low possibility given this entire hosting shares pretty much the same infrastructure.

There are a lot of configs that are possible and yet not a good practice. When I say placing the files alongside is not a good practice, there are 2 reasons:

  1. The server still tries to seek index.php then index.html, which means the server would return 500 instead of the index.html that you’ve mentioned. It was never about using how much resources in the first place.
  2. Having multiple defaults in the DirectoryIndex directive simply enables more flexible website architecture planning. It was designed as a fallback when one is not available in existence.
  3. Bad internet bots would first try html versions so that they can test for folder existence without triggering any PHP dynamic codes that may block them by user-agent, rules, or queries. Although they can be easily blocked using .htaccess, this is still a tactic they employ so this can have concerns as well.

Depending on how you structured the table, assuming you exported the SQL in MySQL format.

If you have a small table size then this can be true, but not all resources are allocated to imports here.

You typically don’t, that does not sound reasonable to restart an entire server for a single visitor just to be able to visit your site. I have no idea what is “eaccelerator in php.ini”, it might be something you have in custom which is why it crashes, you might have to elaborate more on this.

In normal typical hosting scenarios, even if the Apache somehow stopped working due to magic, the hosting has a monitoring mechanism to keep it up and restart it. If after certain retires the problem is located under a certain account, the said account will be suspended.

With all due respect, it’s your website. If the vendor that you choose does not fix it in time and it’s a showstopper for you, then you will have to compromise whether to take things into your own hands by either fixing it or using another vendor. It’s all about attitude and how you wish to proceed. Good developers would even fix open-source for their use case regardless of whether they have paid support as it’s their big-ticket business going on, not your vendors’.

In this case, it’s more a customer support issue, which might suggest to you that their code quality is not that good and they are not willing to make changes unless it makes them loss money. In case you application is a free AS-IS, then you cannot have expectations but to fix it yourself.

3221225477 means the stack is way too much, adjust your httpd.conf to solve this.

<IfModule mpm_winnt_module>
    ThreadStackSize 8888888
</IfModule>

As you can see, your VPS has restarted, not crashed, Apache has very stable handling to keep serving your website.

With your log as supporting information, the cause is more about the stack size, assuming the import does (and very likely from what we see here) involve the application in the middle. This is not Infinity’s fault, it’s the code attempt to call too much stack, they are not responsible for providing a huge stack size given that each application’s requirements are different, and adding that they are providing for free, so we simply can’t complain on the nature of “not enough”.

Whether your vendor or you want to take this up and ultimately fix the code is out of the question and we’ll not discuss it here.

Cheers!

3 Likes