r/PHPhelp • u/pascalstandaert • Aug 24 '25
need help "updating" a PHP script ?
I recently got this message from my web hoster after a website crash :
After half a day of searching, I discovered that your download script needs shell_exec rights. During the last update of cpanel, those rights were disabled for security for php5.6 (which went end of support 6 years ago). The script does not work on newer php versions. php5.6 is currently still on the server, but if I refresh the server within a few years (or faster if due to unforeseen circumstances) I may not be able to install php5.6 anymore and the script will definitely no longer work.
who can help me "update" this download script to work with current PHP versions ?
I have a zip file with the script(s), where can I upload it for someone to take a look at ?
please let me know ...
8
u/martinbean Aug 24 '25
So yes, PHP 5.6 is very old, has been unsupported for years now, and you should be upgrading it to PHP 8.
Why does your script need
shell_exec? What is it actually doing on the server?6
u/colshrapnel Aug 24 '25
There is a site called Upwork. You can put such a request there, and it will be done for a very moderate price.
3
u/isoAntti Aug 24 '25
How about you remove any passwords from it and put it to pastebin or here?
3
u/Aggressive_Ad_5454 Aug 24 '25 edited Aug 24 '25
Wow. A hosting company tech support person spend HALF A DAY troubleshooting for you? That is real dedication. Be sure to thank that person. And maybe tell us the name of that company. It’s a big deal.
Here’s what their message means. (Apologies if some of this is obvious.)
Php is the programming language that runs on your web server. It’s wildly popular. Its developers roll out new versions regularly, they are up to 8.4. Your script uses 5.6
Because php runs on many web servers, cybercreeps spend a lot of time looking for ways to hack it and break into those servers. Occasionally they find one, and then the php developers roll out an update to plug the loophole. Your hosting company puts the update on their servers, to keep the cybercreeps from messing with your site. The developers stopped doing these security updates with version 5.6 of php a while ago. (Php is free and the developers are open source volunteers.)
Your “download script” is a program written in this php language. It sounds like it’s been serving you well for a long time. That is good. But …
Your script uses
shell_exec, a feature of php that lets your script run some other program on the server. It’s as if your script opens a command, powershell, or terminal window on the server computer and types a command into it to do something it needs to do.Cybercreeps love love love this
shell_execfeature. It’s an easy way to break into a server. So most hosting companies have disabled it.So, the task of renovating your script means figuring out another, safer-from-cybercreeps, way to do whatever it does with
shell_exec.I hope this helps.
2
u/OppieT Aug 24 '25
First of all, why are you trying to encrypt MP3’s?
1
u/mgkimsal Aug 24 '25
Sounds like it’s some code in drupal itself that is calling shellexec. I don’t mean drupal, but code someone wrote that is executing in the context of drupal - a custom block or similar.
The process of encrypting your mp3s will need to be rethought. If you can’t shellexec on that machine, it might mean that you have to invoke this another way - moving that step to AWS lambda jumps to mind but might be wrong.
Short answer is this is possible. Longer answer is it may require a bit of deep dive. Longer answer still is you need to upgrade all that Drupal to an updated version, but that’s unrelated to the shell issue.
1
u/[deleted] Aug 24 '25
not shure about latest Cpanel, but about yer ago I fixed it for client by adding shell_exec to allowed functions list. It is disabled by default, but can be added manually
1
u/phpMartian Aug 24 '25
Doing these upgrades is a specialty of mine. Give me an idea of how much code it is.
1
u/[deleted] Aug 24 '25
Let's clarify what you told us, and what you are being told.
So you have two non-trivial issues.
1
u/Zlodej5 Aug 26 '25
In risk of being antisocial I should warn-you against pasting or sharing code you know to have obsolete/unsafe practices involved.
Such step can show your websites vulnerabilities too. even running site on php5.6 will give info about vulnerabilities found since it was abandoned.
re-encoding is doable using ffmpeg and many server hosting companies have their media related software available.
your bigger problem would be safeties. If your site stores third party personal details, then it will no longer befit for purpose and sites which 7 years ago costed thousands can these days be done for few bucks updated.
0
u/Vk2djt Aug 24 '25
The files you listed are for the language of 'C' not 'PHP'. It also relates to the encryption version sha1. That version was found to be vulnerable 10 years ago and also is not supported as sha2 is now applicable with PHP 8.n. The encryption/decryption could possibly now be done with the current version of PHP but your MP3 library will need to be re-encrypted in the process. I can see your issue but it is beyond my skills.
-1
u/UnbeliebteMeinung Aug 24 '25
Copy paste your script into a LLM with this prompt:
"Upgrade the used php version for this script to 8.3. Remove the shell_exec and replace it with some code that doesnt need to call a exec. Dont make mistakes."