Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating leads to fatal PHP Error #1286

Open
Nepsi-cola opened this issue Oct 9, 2024 · 11 comments
Open

Updating leads to fatal PHP Error #1286

Nepsi-cola opened this issue Oct 9, 2024 · 11 comments

Comments

@Nepsi-cola
Copy link

versions:
shimmie: "2.11.0-alpha"
schema: 21
php: "8.2.18"
db: "mysql 10.11.6-MariaDB-cll-lve"
os: "Linux cp37-ga.privatesystems.net 4.18.0-513.9.1.lve.el8.x86_64 #1 SMP Mon Dec 4 15:01:22 UTC 2023 x86_64"
server: "LiteSpeed"

extensions:
core: ["admin","alias_editor","bbcode","comment","download","et","ext_manager","four_oh_four","handle_pixel","help_pages","image","index","media","mime","post_lock","post_owner","post_source","post_tags","replace_file","setup","static_files","system","tag_list","upgrade","upload","user","user_config","view"]
extra: ["approval","auto_tagger","autocomplete","blocks","bulk_actions","favorites","featured","forum","handle_mp3","handle_video","holiday","home","image_view_counter","notes","numeric_score","pm","pools","random_image","regen_thumb","relationships","report_image","site_description","sitemap","source_history","statistics","tag_categories","tag_history","tag_tools","wiki"]
handled_mimes: ["image/jpeg","image/gif","image/png","image/webp","audio/mpeg","video/x-ms-asf","video/x-msvideo","video/x-flv","video/x-matroska","video/mp4","video/ogg","video/quicktime","video/webm"]

stats:
images: 3560
comments: 52
users: 28

media:
memory_limit: "8.0MB"
disk_use: "1.5TB"
disk_total: "2.0TB"

thumbnails:
engine: "convert"
quality: 75
width: 192
height: 192
scaling: 100
mime: "image/jpeg"

Client Software
Device: Desktop
Browser: Firefox

Updating from 2.11.0 to the latest leads to no site loading, just a completely blank page with the following error every 5 to 15 seconds:
PHP Fatal error: Cannot declare enum Shimmie2\PageMode, because the name is already in use in /public_html/core/page.php on line 13

Might have just been a bad update or not related at all, still new and kind of stuck.

@shish
Copy link
Owner

shish commented Oct 11, 2024

How are you updating? I would expect this to happen if you've downloaded 2.12-alpha over the top of 2.11, and ended up with files from both versions in one place (specifically core/page.php (which should only exist in 2.12) and core/basepage.php (which should only exist in 2.11))

@Nepsi-cola
Copy link
Author

That's what I tried doing. I previously tried using git to update from the main branch but ran into problems there as well. Would the proper course of action be to use the 2.11 branch until 2.12 gets it's own branch instead of just using main?

@shish
Copy link
Owner

shish commented Oct 13, 2024

If you want stability, stick with 2.11 - that said, upgrading from 2.11 to main via git should work (there are no known issues, so if you're hitting an issue with 2.11->main then we'll want to make sure that that's fixed so that people don't have problems with 2.11->2.12 when it releases :) )

@Nepsi-cola
Copy link
Author

This is probably an issue on my side with an incorrect cpanel file, but updating from main branch results in the site loading up as an index instead of the default site. No errors in error log afterwards.
Screenshot_2024-10-14_19-57-45

@shish
Copy link
Owner

shish commented Oct 15, 2024

That is very weird o_O Does index.php even exist in that folder? It definitely exists in the main branch :S

For reference, the files and folders there should match up with what's shown at https://github.com/shish/shimmie2, (except that you should have additional "data" and "vendor" folders which aren't on github, because those get created during installation)

@Nepsi-cola
Copy link
Author

Yes index.php is there, I only took a screenshot showing the folder structure, it also shows the normal files further below, which remain unchanged and all have the correct permissions. I'm using cpanel to perform the git update, here is my cpanel.yml

deployment:
tasks:
# NOTE: public_html on cPanel must not be removed or renamed.
# This folder has owner USER:nobody, and the USER user does not have
# access to change owner. So this folder must stay as-is to keep the nobody
# group, which is critical to the site working. A new folder won't work.
- export DEPLOYPATH=/home/USER/public_html
- export REPOPATH=/home/USER/repositories/NAME
# Remove previous old files, if any.
- /bin/rm -Rf ${DEPLOYPATH}_old
# Copy old site files to another directory.
- /bin/cp -R ${DEPLOYPATH} ${DEPLOYPATH}_old
# Back-up custom files (This backs up my custom htaccess file).
- /bin/bash /home/USER/backup/backup.sh
# Sync repository files to the deploy target path, excluding .git folder.
- /bin/rsync -aP --exclude '.git' --exclude '.well-known' ${REPOPATH}/ ${DEPLOYPATH}
# Run the replacement script. (This replaces the custom htaccess file that was just updated)
- /bin/bash /home/USER/backup/replace.sh
# Set correct permissions. (Make sure files are 644 and directories are 755)
- /bin/bash /home/USER/backup/chmod.sh

@shish
Copy link
Owner

shish commented Oct 18, 2024

That is very weird D: If index.php is there, but the web server is ignoring it, then it sounds like a system issue, but I have no experience with cpanel to go by >.<

The one clue is that it was working with a different install method... I wonder if there's some file ownership / permission issue when downloaded from git vs zip?

Does the web server have error logs that might contain more clues?

@Nepsi-cola
Copy link
Author

I was able to figure out it was a permissions issue, all the files had the correct permissions, but the main folder did not. Giving it 755 fixed that issue, but now the original PHP error comes back

[21-Oct-2024 00:14:49] PHP Fatal error: Cannot declare enum Shimmie2\PageMode, because the name is already in use in /home/NAME/public_html/core/page.php on line 13

Just to clarify, this is the same error that occurred when I initially just replaced all the files manually but this latest way was using cpanel's GIT controls. Any ideas would be appreciated. Thanks

@shish
Copy link
Owner

shish commented Oct 21, 2024

I wonder if you've somehow ended up with the files from git and the files from the zip - specifically, in the core folder do you have both page.php and basepage.php?

@Nepsi-cola
Copy link
Author

Thanks for your continued help. I do have both the core/page.php and core/basepage.php in place. I'm assuming this is because I had done the initial installation by just downloading the 2.11 ZIP and dropping it into my webserver file structure and didn't use GIT? If I delete core/basepage.php (since I'm trying to upgrade to 2.12) I get the following new error:

PHP Fatal error: Declaration of Shimmie2\Danbooru2IndexTheme::build_navigation(int $page_number, int $total_pages, array $search_terms): MicroHTML\HTMLElement must be compatible with Shimmie2\IndexTheme::build_navigation(int $page_number, int $total_pages, array $search_terms): string in /home/USER/public_html/themes/danbooru2/index.theme.php on line 35

@Nepsi-cola
Copy link
Author

Would the proper course of action be to get a new install straight from GIT and then manually populate the database files? Hope that makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants