Bash不能执行certbot命令

Bash无法执行certbot命令,如何找出问题所在?

当我使用ls命令测试正常的bash功能时

php:

$cmd = "/bin/bash /usr/local/openresty/nginx/html/pHpServer-PG/api/cert.bash test.com";
echo $cmd;
$ww = shell_exec($cmd);
var_dump($ww);

bash:

#!/bin/bash
certbot certonly --rsa-key-size 4096 --webroot --agree-tos --no-eff-email --email email@gmail.com -w /usr/local/openresty/nginx/html -d $1 -d admin.$1 -d www.$1

我使用php-fpm和nginx,用户为root

提取bash错误的一些方法?

点赞
用户11639109
用户11639109

你在代码的 -d $1 -d admin.$1 -d www.$1 端口中指定了变量 $1,这意味着你将一个域名传递给了代码。

你也可以使用 bash -x 运行 Bash 脚本,例如如果你的脚本名为 certificate.sh,则运行

bash -x certificate.sh domain.com

其中 domain.com 是你的域名。

2019-06-12 21:05:24