我有 php 7.3、nginx、ubuntu 22.04,还有这个 php:
$cmd = 'LD_PRELOAD="/var/www/localhost/node/so/libcrypto.so.0.9.8 /var/www/localhost/node/so/libssl.so.0.9.8" /var/www/localhost/node/node /var/www/localhost/node/nodejs-highcharts.js /tmp/201c0374305c6a74d019739c0f519a9d';
$output = exec($cmd, $out, $retval);
file_put_contents('/tmp/output.txt', 'output: [' . print_r($output, true) . "]\n\nout: [" . print_r($out, true) . "]\n\nretval: [" . print_r($retval, true) . "]\n\ncmd: [" . $cmd . ']');
当我在命令行上运行那个确切的命令时,它会生成一个没有问题的 svg。但是,当从 php 运行相同的命令时,我得到这个:
output: []
out: [Array
(
)
]
retval: [1]
cmd: [LD_PRELOAD="/var/www/localhost/node/so/libcrypto.so.0.9.8 /var/www/localhost/node/so/libssl.so.0.9.8" /var/www/localhost/node/node /var/www/localhost/node/nodejs-highcharts.js /tmp/74d8fe466d722be67ef78c606c3e5d37]