Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

aylara's avatar

shell_exec, exec discard all query parameters apart from the first

I'm running this command from php 7.4 (I know it's EOL):

shell_exec("curl https://$domain/$url.php?importid=$importid&org=$org&t=".urlencode($t)." >> /var/log/bgrd_call.log 2>&1 ");

The nginx/access.log file shows it correctly substitutes all variables with runtime values but try as I may, it only passes the first query parameter and truncates the rest of the line. I know this because whenever I re-arrange the query parameters, the first one shows up in the access.log entry.

What is the correct way to do this?

0 likes
2 replies
aylara's avatar

A timestamp. When I put the parameter sent to shell_exec and echo out, this is what comes out (without the domain):

accept_orders.php?importid=268&org=4&t=2023-06-12+14%3A26%3A43 >> /var/log/bgrd_call.log 2>&1

Please or to participate in this conversation.