I have searched for a CGI and read about it but nothing useful found. what i can understand is the concept.
which in my case is an interface that is responsible for executing binary files without the apache permission or in an enviroment where the directing and redirecting of the binary execution is monitored and safe.
But couldn’t find any tutorials.
I have created a cgi-bin in my public_html and then i created a .sh file with the following header
#!/usr/bin/env bash
What i am trying to do is to execute some binary files from my web application. but every script line in this file work fine, exclude the binary execution.
Does anyone have any ideas or good tutorials of the following question:
1) Is the header i am using is fine?
2) what is the extension of the file should be?
3) does Zend provide any libraries that can make my job easier and tidy?
4) If it is configured okay. how can i excute it from a php script (my guess is exec(filename)).
Have you simply tried
exec()? I use it all the time… and has worked on virtual hosts, local servers, nginx (php-fpm). Sample code below:With output:
Most recently, I used a php script to act like a remote bash script to delete the cache in a Magento server when a special case happens and an extension’s developer said we need to manually delete the files.