PHP Execute not working?

Hello,

we’re using the latest v17.3 and since I migrated to 10.15 Catalina, I’m facing a problem that a call to PHP Execute is no longer working.

$vbOK:=PHP Execute("";“str_shuffle”;$vtResultat;$vtValue)

$vtResultat remains empty and $vbOK is empty too.

Is there a problem with php execute on 10.15? Is there a permission that needs to be granted?

Many thanks in advance

Alex

Hi,

seems that php version bundled with v17.3 is still 32bits … surprise Apple announced only a couple of years ago that 32bits support would be dropped with 10.15.

It turns out that v17R5 contains a 64bits version of the php executable and it seems that you can simply replace the old 32bits version with the 64bits version at least my call is now working again as expected.

Regards,

Alex

please be careful.

It is correct that v17.x is not compatible to Catalina when included PHP is used.
Minimum Version for Catalina to use included PHP is 4D v17 R5, better the soon to be released R6, which includes some some other modifications for Catalina.

If you need to use v17, use v17.3 HF1, which includes some other modifications for Catalina, but not PHP. If you need to use PHP, use an external PHP interpreter (see documentation for external PHP interpreter).

Please be aware that v17.x used PHP 5, while 4D v17 R5 and newer is using PHP 7.
PHP 7 and 5 are not fully compatible, major code changes might be required.

Apple ships with Catalina PHP 7.(3.8), so script changes are also needed if you use system PHP.

Using the PHP interpreter from R5 with v17.x seems to work, but (beside that it is version 7 and not 5), is not tested and not developed for this usage, you might run into serious issues, so we cannot recommend it.

Hi Thomas,

thank you very much for your reply and the detailed explanations.

We never execute php scripts but only have 2 lines of code that use php commands like str_shuffle and base64_encode.

So far I haven’t encountered any problem by simply replacing the php executable and that’s also just impacting my machine since I’m the only one executing that part of the code.

Kind regards,

Alex

: Alex WEIRIG

We never execute php scripts but only have 2 lines of code that use
php commands like str_shuffle and base64_encode.
Just wondering: why using php for that?
base64_encode exists (https://doc.4d.com/4Dv17R5/4D/17-R5/BASE64-ENCODE.301-4127709.en.htmlBASE64 ENCODE>), and str_shuffle seems easy to write.

Hi Arnaud,

I guess/supose because by the time the code was written that might not have existed or the “developer” didn’t know about … it’s not our code, so I can’t tell for sure.

Alex

Hi,

Time to refactor this code to 4D plain/native code avoid PHP decencies :slight_smile:

First, convert the call to each PHP function as a 4D function (if it is not already the case), then write unit tests to check you new code is behaving the same way as the old one…

Just my 0.02 €…

HTH

Hi Bruno,

no actually time to get rid of 4D.

Alex