mecha-cms / mecha

Minimalist content management system.
https://mecha-cms.com
GNU General Public License v3.0
177 stars 23 forks source link

Internal server error 500, again when installing #289

Closed desbest closed 2 months ago

desbest commented 3 months ago

Make sure that your issue is reproducible by doing the following tasks

What installation method did you use?

File

Describe your issue in the field below

I've tried the steps described in my previous issue and it doesn't work,

As the error is non-descript, showing a video is better. See this video for details. https://www.bitchute.com/video/TNdfL4XFoiad/

Package version

Stable release version (package with semantic version label such as v1.0.0)

Package version number

3,0,0

What browsers are you seeing the problem on?

Others

Error logs of the core application if any

[04-Aug-2024 14:37:53 UTC] PHP Fatal error:  Declaration of Genome::unserialize(string $lot) must be compatible with Serializable::unserialize($serialized) in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/genome.php on line 107
[04-Aug-2024 14:37:53 UTC] PHP Fatal error:  Uncaught Error: Class 'Genome' not found in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php:3
Stack trace:
#0 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require()
#1 [internal function]: {closure}('Hook')
#2 /home/desbest/public_html/flatfiletest/mecha3/engine/fire.php(164): spl_autoload_call('Hook')
#3 /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/genome.php(3): {closure}()
#4 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require('/home/desbest/p...')
#5 [internal function]: {closure}('Genome')
#6 /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/state.php(3): spl_autoload_call('Genome')
#7 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require('/home/desbest/p...')
#8 [internal function]: {closure}('State')
#9 /home/desbest/public_html/flatfiletest/mecha3/engine/fire.php(176): spl_autoload_call('State')
#10 /home/desbest/public_html/flatfiletest/mecha3/index.php(25): require('/home/desbest/p...')
#11 { in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php on line 3
[04-Aug-2024 14:37:53 UTC] PHP Fatal error:  Uncaught Error: Class 'Genome' not found in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php:3
Stack trace:
#0 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require()
#1 [internal function]: {closure}('Hook')
#2 /home/desbest/public_html/flatfiletest/mecha3/engine/fire.php(170): spl_autoload_call('Hook')
#3 [internal function]: {closure}()
#4 {main}
  thrown in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php on line 3
[04-Aug-2024 14:38:43 UTC] PHP Fatal error:  Declaration of Genome::unserialize(string $lot) must be compatible with Serializable::unserialize($serialized) in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/genome.php on line 107
[04-Aug-2024 14:38:43 UTC] PHP Fatal error:  Uncaught Error: Class 'Genome' not found in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php:3
Stack trace:
#0 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require()
#1 [internal function]: {closure}('Hook')
#2 /home/desbest/public_html/flatfiletest/mecha3/engine/fire.php(164): spl_autoload_call('Hook')
#3 /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/genome.php(3): {closure}()
#4 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require('/home/desbest/p...')
#5 [internal function]: {closure}('Genome')
#6 /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/state.php(3): spl_autoload_call('Genome')
#7 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require('/home/desbest/p...')
#8 [internal function]: {closure}('State')
#9 /home/desbest/public_html/flatfiletest/mecha3/engine/fire.php(176): spl_autoload_call('State')
#10 /home/desbest/public_html/flatfiletest/mecha3/index.php(25): require('/home/desbest/p...')
#11 { in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php on line 3
[04-Aug-2024 14:38:43 UTC] PHP Fatal error:  Uncaught Error: Class 'Genome' not found in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php:3
Stack trace:
#0 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require()
#1 [internal function]: {closure}('Hook')
#2 /home/desbest/public_html/flatfiletest/mecha3/engine/fire.php(170): spl_autoload_call('Hook')
#3 [internal function]: {closure}()
#4 {main}
  thrown in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php on line 3

Error log of the extension if any

none

Error log of the layout if any

none

General error logs if any (if the application fails to set a custom error log path, then the error log will usually appear in this location)

Fatal error: Declaration of Genome::unserialize(string $lot) must be compatible with Serializable::unserialize($serialized) in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/genome.php on line 107

Fatal error: Uncaught Error: Class 'Genome' not found in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php:3 Stack trace: #0 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require() #1 [internal function]: {closure}('Hook') #2 /home/desbest/public_html/flatfiletest/mecha3/engine/fire.php(164): spl_autoload_call('Hook') #3 /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/genome.php(3): {closure}() #4 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require('/home/desbest/p...') #5 [internal function]: {closure}('Genome') #6 /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/state.php(3): spl_autoload_call('Genome') #7 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require('/home/desbest/p...') #8 [internal function]: {closure}('State') #9 /home/desbest/public_html/flatfiletest/mecha3/engine/fire.php(176): spl_autoload_call('State') #10 /home/desbest/public_html/flatfiletest/mecha3/index.php(25): require('/home/desbest/p...') #11 { in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php on line 3

Fatal error: Uncaught Error: Class 'Genome' not found in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php:3 Stack trace: #0 /home/desbest/public_html/flatfiletest/mecha3/engine/f.php(1059): require() #1 [internal function]: {closure}('Hook') #2 /home/desbest/public_html/flatfiletest/mecha3/engine/fire.php(170): spl_autoload_call('Hook') #3 [internal function]: {closure}() #4 {main} thrown in /home/desbest/public_html/flatfiletest/mecha3/engine/kernel/hook.php on line 3
taufik-nurrohman commented 3 months ago

You don’t have to write PHP error reporting line manually. Mecha already has it set up in conditional statement internally. Simply change the TEST constant value to true will enable all PHP error reporting. Save changes, delete all log files, then reload the site to see the updated error log messages.

desbest commented 3 months ago

When I made the video, I didn't know about the TEST constant, so it's somewhat outdated now.

The error log with the TEST constant set to true, is indicated above under "core application" logs, not "general" logs.

taufik-nurrohman commented 3 months ago

I might not yet delete-create the v3.0.0 tag as usual. But since the previous bug has been resolved the Genome class should be updated already to fix the last issue.

My suggestion: download the main branch then install it then let me know if it gives you the same errors as in version 3.0.0 (dev).

desbest commented 3 months ago

I've tried running the branch and I just get Error 403 Not Authorised, with no logs, even with TEST set to true.

taufik-nurrohman commented 3 months ago

403 is not typical error caused by Mecha. Check the file permission of your .\index.php file.

desbest commented 3 months ago

The file permissions are normal. 755 for folders and 644 for files. Deleting all the `.htaccess files doesn't help either. See this video for details.

taufik-nurrohman commented 3 months ago

Downloading the ZIP file from repo will not include the submodules, maybe that’s why. After extracting, if you open the .\lot\x folder there will contain empty folders. Download it from the site instead, so it will also include all the submodules automatically, so it will install.

The 403 status code is the default status where there is no route defined. Page routes are defined in the .\lot\x\page extension which is missing in your case.

desbest commented 3 months ago

But you told me to download the main branch.

My suggestion: download the main branch then install it then let me know if it gives you the same errors as in version 3.0.0 (dev).

I've now downloaded it from both these places and the error still happens, except the error changed.

Minifying the php is set to off

desbest commented 3 months ago

Errors shown in web browser

[07-Aug-2024 05:37:03 UTC] PHP Fatal error:  Exception thrown without a stack frame in Unknown on line 0

Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in /home/desbest/public_html/flatfiletest/mecha3-mainbranch-gen/engine/kernel/genome.php on line 1

Fatal error: Exception thrown without a stack frame in Unknown on line 0

Parse error: syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in /home/desbest/public_html/flatfiletest/mecha3-mainbranch-gen/engine/kernel/genome.php on line 1

Fatal error: Exception thrown without a stack frame in Unknown on line 0

Errors from log file

[07-Aug-2024 05:42:08 UTC] PHP Parse error:  syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in /home/desbest/public_html/flatfiletest/mecha3-mainbranch-gen/engine/kernel/genome.php on line 1
[07-Aug-2024 05:42:08 UTC] PHP Parse error:  syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in /home/desbest/public_html/flatfiletest/mecha3-mainbranch-gen/engine/kernel/genome.php on line 1
[07-Aug-2024 05:42:08 UTC] PHP Fatal error:  Exception thrown without a stack frame in Unknown on line 0
[07-Aug-2024 05:42:08 UTC] PHP Parse error:  syntax error, unexpected end of file, expecting function (T_FUNCTION) or const (T_CONST) in /home/desbest/public_html/flatfiletest/mecha3-mainbranch-gen/engine/kernel/genome.php on line 1
[07-Aug-2024 05:42:08 UTC] PHP Fatal error:  Exception thrown without a stack frame in Unknown on line 0
taufik-nurrohman commented 3 months ago

But you told me to download the main branch.

Sorry, I mean from the website, there’s a dropdown that shows 3.0.0 by default. There’s also an option with the label “main” in the dropdown.

taufik-nurrohman commented 3 months ago

Any error message that said on line 1 is likely come from a PHP file that has been minified. Open .\engine\kernel\genome.php with a code/text editor and see its content. Is it minified?

The token error likely caused by the new PHP attribute that is not supported by your PHP. It should be treated as normal PHP comment in older PHP versions, but since its code is minified and my server does not remove the PHP attribute syntax (because it is not a comment) so that any code that comes after the #[asdf] token will be treated as a continuation of a comment on a web server that does not support PHP attributes.

desbest commented 3 months ago

I've just tried that now and now although I can see the home page, the about page doesn't work.

mecha 3 about page doesn't work

taufik-nurrohman commented 3 months ago

That means your web server does not support URL rewrite. You didn’t remove the .htaccess files, right?

desbest commented 3 months ago

All the initial .htaccess files still exist

/.htaccess
/engine/.htaccess
/lot/.htaccess
/lot/asset/.htaccess
/lot/y/log/.htaccess
taufik-nurrohman commented 3 months ago

Just one more step, you just need to make sure that URL rewrite feature is available and active.

From the video, I saw some other CMSes are also installed, do they have URL rewrite issue like Mecha?

desbest commented 3 months ago

It works now. I just uploaded it somewhere else like here. So it was the CMS I was already using on my website (in the parent directory) causing it.

With that said, how about fixing the v3.0.0 release on github?

taufik-nurrohman commented 3 months ago

When I visit the new site, it displays the HTML as plain text for once then it displays as proper HTML on the later hot-reload.

taufik-nurrohman commented 3 months ago

With that said, how about fixing the v3.0.0 release on github?

Show me the .htaccess file content of your parent site.

You may truncate/censor certain parts that you think private.

desbest commented 3 months ago

Here it is. I was using the Stacey CMS v2.3.0 It's associated website was archived here.

taufik-nurrohman commented 3 months ago

Not really sure, but the trailing slash enforcing part may cause it to always visit the URL twice (to add the / ending), since Mecha’s URL are mostly clean but does not end with trailing slash by nature.

desbest commented 2 months ago

It looks like the v3.0.0 release has been updated. I can now close this issue.