• Uncategorized

About php : Trying-to-run-command-line-jq-from-php

Question Detail

I have been trying to run this PHP script. There is no output whatsoever and I cannot seem to understand the reason.


echo "Example DOI Query <be>";

$doi = someDOIvalue;

echo 'DOI: '.$doi.'<br>';

$query = 'curl -LH "Accept: application/json" http://doi.org/';

$cmd = $query.$doi." | jq '.title'";

echo $cmd;

$title = shell_exec($cmd);

echo 'Title:<br>'.$title;


However, when I try to use the same command on my LINUX command line (as below), it works perfectly fine.

curl -LH "Accept: application/json" http://doi.org/10.1016/someDOIvalue | jq '.title' 

Any idea what I’m doing wrong?

Question Answer

there are a lot of reasons for this issue try to check

the group and the permission also use the full path of the command

I hope it’s help full

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.