PHP on execute导致HTTP错误500.我在driver_license.exe上有chmod -R 777。
<?php
$agent= $_GET['agentid'];
$userid = $_GET['userid'];
$file = "/home/www/file/driver_license.exe";
$path = "/home/www/file/";
"
$newfile ="driver_license_userid_1.exe";
$file_to_save = $path . $newfile;
if (!copy($file, $file_to_save)) {
echo "FAILED";
}
else {
echo "<a href=https://download.example.com/{$newfile}>DOWNLOAD & INSTALL</a>";
}
答案 0 :(得分:3)
1.在"
之后你还有$path = "/home/www/file/";
。删除它。
2.您忘记在href
周围添加引号。添加
所以代码必须是: -
<?php
$agent= $_GET['agentid'];
$userid = $_GET['userid'];
$file = "/home/www/file/driver_license.exe";
$path = "/home/www/file/";
//" need to remove or comment
$newfile ="driver_license_userid_1.exe";
$file_to_save = $path . $newfile;
if (!copy($file, $file_to_save)) {
echo "FAILED";
}
else {
echo "<a href='https://download.example.com/{$newfile}'>DOWNLOAD & INSTALL</a>"; // ' added around href
}
重要提示: - 文件夹需要获得访问权限(授予077
个文件夹home,www and file
权限)