r/PHPhelp • u/Erik84750 • Oct 23 '26
one single page of php code (v5.6) upgrade to 7.4: help request
I have one single page of code (functions.php), no mysql, that was written with php 5.6 and now needs an upgrade to 7.4.
I downloaded rector but I have no clue how to use that.
Can anyone help me to upgrade this page please? I have no php experience.
4
Upvotes
23
u/vincent_sch Oct 23 '26
If your host offers PHP 8.2 or newer, you should target that instead. 7.4 got its last security fix in November 2022, so otherwise you do this upgrade twice.
10
u/colshrapnel Oct 23 '26
Yes, anyone can. You could have gotten it fixed already if just posted it here.
6
u/No_Astronomer9508 Oct 23 '26
Setting up Rector for a single functions.php file is completely unnecessary and way too complicated if you don't have PHP/CLI experience. Since it's just one file without MySQL, upgrading it from PHP 5.6 to 7.4 is usually straightforward (mostly fixing deprecated functions, count() checks, or legacy constructor syntax).
If you'd like, you can post the code of functions.php here (or link a Pastebin / Gist), and I can take a look at it and maybe help to convert.
1
u/Erik84750 Oct 23 '26
Hi, many thanks for your fast replies.
I made the file available in Google Drive and in Github:
https://drive.google.com/drive/folders/1-tltwn4mHsXHv_xyB9mncs3m7y6A1uvW?hl=nl
https://github.com/Erik84750/PHP-upgrade
This file is also linked to a config.php fle and a form.php file. I am not sure if these require an upgrade to, so I posted them too.
The form.php file is the one visible here: https://studio61.be/website/en/formulier-en.html
It basically is a simple form-to-send-by-email.
4
u/BokuNoMaxi Oct 23 '26
Brother, just let AI handle this if you don't know how to code.. task is done in 10 minutes and it gets updated to PHP 8.5 ...
1
u/MateusAzevedo Oct 23 '26
Just update the PHP version, the latest one you can. If you have access to edit
php.ini, seterror_reporting = E_ALLanddisplay_errors = 1. If not, adderror_reporting(E_ALL);andini_set('display_errors', 1);as the first lines of code infunctions.php.Go to the page(s) that use those functions, see if any error pop up and fix them. If you don't know how to do it, post the code here with the error messages you got and we can take a look.
Remember to turn
display_errorsoff afterward.But for such amount of code, and if it doesn't do anything fancy, there's a high chance it is already compatible without any changes.
3
u/Calman00 Oct 23 '26
Claude code or codex
1
u/vasilegoian Oct 23 '26
Hi. I've sent you a PM. Since it's just a file I'll help you for free. Hit me up.
1
u/Devnzian Oct 23 '26
Yes very much possible and it's better to conver 8.2 or later version not 7.4.
1
u/martinbean Oct 23 '26
You don’t need to upgrade to 7.4. You need to upgrade to PHP 8. PHP 7.4 is still massively outdated.
1
u/elevarq Oct 24 '26
Moving from one unsupported version to another unsupported version. What’s the point? Waste of time.
If you want to spend some time, and/or money, migrate to a supported version of your favorite software platform.
1
u/Opinion_Less Oct 24 '26
I would bet that you could point this at 8.2 and get the latest patch for rce vulnerabilities and not have to change anything that you'd changed to get to 7.4
1
u/miglisoft Oct 28 '26
Hi, I’ve just seen your post; rather than updating some rather outdated code, I can offer you a more suitable solution. If you’re interested, please feel free to contact me via private message. Just so you know, I’m French.
0
u/[deleted] Oct 23 '26
[deleted] — view deleted comment