简体   繁体   English

为什么我不能在我的PHP代码中执行此终端命令?

[英]Why I can't execute this terminal comand in my php code?

i want to test via ApacheBenchmark a website, and,after the execution, people.txt contains just sh: 1: ab: not found 我想通过ApacheBenchmark测试一个网站,并在执行后,people.txt只包含sh:1:ab:not found

i tried full path of ApacheBenchmark 我尝试了ApacheBenchmark的完整路径

<?php
$output = shell_exec('ab -k -c 350 -n 20000 www.yahoo.com 2>&1');
$file = 'people.txt'; 
file_put_contents($file, $output);
?>

You don't have "ab" tool installed on your system. 您的系统上没有安装“ab”工具。 If you're on Debian based OS (eg Ubuntu), use apt-get install apache2-utils to install it. 如果您使用的是基于Debian的操作系统(例如Ubuntu),请使用apt-get install apache2-utils进行安装。 For RedHat systems, try yum install httpd-tools 对于RedHat系统,请尝试使用yum install httpd-tools

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

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