简体   繁体   English

如何从PHP执行Shell命令?

[英]How to execute shell command from php?

I have a apache server running on raspberry pi and i want to execute shell script using command through in php, 我有一个在树莓派上运行的apache服务器,我想使用php中的命令执行shell脚本,

the code which is to be executed is : 要执行的代码是:

"usr/bin/libreoffice --pt trial1 /var/www/html/Book1.xlsx"

how to run this command ? 如何运行此命令?

use shell_exec() to run shell script. 使用shell_exec()运行shell脚本。

And also make sure that exec and shell_exec is enabled in PHP ini. 还要确保在PHP ini中启用了exec和shell_exec。

use shell_exec() built in php function here 使用此处内置的php函数的shell_exec()

shell_exec("usr/bin/libreoffice --pt trial1 /var/www/html/Book1.xlsx")

you can also used built in function exec() or system() here see 你还可以使用内置函数的exec()系统()在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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