我正在尝试将文件保存到 Linux 中的当前目录,然后将其显示在网页上。目前,我使用以下代码从 php 脚本运行 C++ 可执行文件
exec("/var/www/html/radsim/plotFluence $rMin $rMax $zMin $zMax $lum $graphStyle $basepath[$path]", $return);
当我在 Linux 中从控制台运行可执行文件时,文件创建得很好,当我从 php 中尝试时出现问题;该文件根本不在目录中。用户输入值并运行可执行文件但不生成文件。C++ 看起来像这样
canvas->Print(("/var/www/html/radsim/"+histoName+_FileFormat).c_str());
权限设置为 777。此外,在另一个 PHP 脚本上,我使用 fopen("data.txt", 'w') 或 die() 创建一个文本文件,但它总是死掉。