Raspberry pi nginx PHP execute shell command

I am trying to execute this code with nginx/php 7.3 / wordpress site on my raspberry pi

<?php
   $output = shell_exec('v4l2-ctl -d /dev/video0 --list-formats-ext');
   echo "<pre>$output</pre>";
?>

The problem is I get no answer If its called from wordpress site. If I manually run shell command

pi@localhost:/var/www/html/wp-content/plugins/RPi/View/main_part $ php 1.php

It works fine.
If I remove “-d /dev/video0 –list-formats-ext” and leave only v4l2-ctlit

<?php
   $output = shell_exec('v4l2-ctl');
   echo "<pre>$output</pre>";
?>

I get the correct answer on wordpress site (General/Common options list).

Any suggestions what am I doing wrong?