r/PHPhelp • • 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 ...

0 Upvotes

35 comments sorted by

View all comments

Show parent comment

3

u/pascalstandaert Aug 24 '25 edited Aug 24 '25

the guy who did the troubleshoot is the owner of a small local hosting company ... I was one of his first customers, way back ... he's also kind of a friend ...

and yes, I understand the actual problem, that's why I'm reaching out to get this updated, so we can move on into the future ...

the website is built in Drupal, and I think it shells from Drupal to execute this script to encrypt the MP3's and then Drupal offers them for download ...

might that be the reason why it requires Shell_exec ?

and if so, how to fix this ?

3

u/allen_jb Aug 24 '25

Without seeing (at least) the command that shell_exec is running, nobody is going to be able to tell you for sure what it's doing (and even then, if it's running some custom script / executable further investigation might be required).

If the entire site is built in Drupal and hasn't been updated since it was built, it's likely the entire site needs to be updated to work with newer PHP versions.

shell_exec() in itself hasn't changed, so there must be other things the PHP code is doing that are preventing it working on more recent PHP versions.

Updating a framework like Drupal (from such an old version) to work with newer PHP versions is not likely to be simple. There are tools that can help (such as the PHPCompatibility ruleset for CodeSniffer, and Rector) but these may not catch every issue and aren't going to be helpful if you don't know PHP.

Have you asked your friend if this is something they can do for you?

Is the site something they built for you? (Or who built it?)

You mention the site does something with "encrypted MP3s" (DRM? Not sure what else this would be). What is the site doing overall? If you're doing something relatively simple / common like selling music through the site it may be worth looking at alternative solutions / platforms (eg. BandCamp).