I have some basic python scripts up and working to access a pi camera v2 from my Nano. These scripts work fine from SSH or console but I cannot get the script to work properly when launched from PHP/Apache. The nano is running Apache and the script is executed as www-data user using exec() function. When it launches (using the same python binary as in testing) it throws this error:
(Argus) Error FileOperationFailed: Connecting to nvargus-daemon failed: No such file or directory (in src/rpc/socket/client/SocketClientDispatch.cpp, function openSocketConnection(), line 201)
(Argus) Error FileOperationFailed: Cannot create camera provider (in src/rpc/socket/client/SocketClientDispatch.cpp, function createCameraProvider(), line 102)
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:515 Failed to create CameraProvider
I have tried giving the www-data user every possible group for permissions which fixed earlier errors but it will not connect to the argus daemon to process the video stream. If I run the script from SSH/cli as the www-data user using “sudo -u www-data bash” it does work in that context. I am a bit rusty so not sure how php is spawning the process but it must be getting locked down in access to other sockets per the error?