当我用<代码>shell_exec在PHP中执行指挥时,我总是返回空洞。 I Trial shell_exec( ls -l );
and it work. 我将指挥视为单独档案,结果仍然相同。
$shellOutput = shell_exec("pacmd list-sinks | grep volume: 0: | tail -1 | awk { print $3 } ");
//return execute status;
echo trim($shellOutput);
当我用<代码>shell_exec在PHP中执行指挥时,我总是返回空洞。 I Trial shell_exec( ls -l );
and it work. 我将指挥视为单独档案,结果仍然相同。
$shellOutput = shell_exec("pacmd list-sinks | grep volume: 0: | tail -1 | awk { print $3 } ");
//return execute status;
echo trim($shellOutput);
I changed the sudoers to ALL ALL = (ALL) :NOPASSWD ALL (very un-secure, but just to find something sure to work),
当时我做了发言。
sudo -u myusername /path/to/script.sh
where script.sh has export VAR=value export VAR=value
for all the environmental variables that are necessary (you can do a printenv from a user who can properly pacmd to see what you need. probably a good HOME and maybe an XAUTHORITY).
希望
多数时间,如果用你的文字处理案件,那么阿帕奇使用者可能没有足够的许可来管理这一指挥。 首先检查。 如果它作为CLI的文字运行,那么如果PHP用户能够操作文字,就会进行检查。
You may want to try " > file.txt 2>&1" at the end of your command. It will redirect the outputs to a separate file.
$command = "cmd command > outputs.txt 2>&1";
shell_execute($command);
你们最后拿着这样的档案:
b cmd command output contents
或许这就是为什么
Try to use system
I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...
<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...
I found this script online that creates a thumbnail out of a image but the thumbnail image is created with poor quality how can I improve the quality of the image. And is there a better way to create ...
如何确认来自正确来源的数字。
Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...
I wonder there is a way to post a message to a facebook business page with cURL? thanks
I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...
How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...