简体   繁体   中英

Run executable directly from PHP script with parameters

Let's say I have an executable PHP file that is usually run like this:

php somefile -d someParameter --verbose

How can I run this file using an existing PHP script? I am not looking into doing shell_exec('php somefile -d someParamter --verbose') since many webhosts disallow the use of shell_exec.

I am thinking something like using require('somefile') and then magically passing in the parameters needed for the command to run.

If your hosting does not allow shell_exec nor exec then you cannot run any external binaries. And it's always common practice to sandbox vhost content so if they would not block shell_exec / exec you may be hosted from noexec mounted volume anyway, so sidede "loaded" binaries would not work either. If you need to run 3rd party binaries, VPS is the way to go, not shared hosting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM