无法找到带有AJAX请求的PHP文件

Cant find PHP file with AJAX request

本文关键字:请求 PHP 文件 AJAX      更新时间:2024-05-10

我有一个PHP文件,位于:/epcusers/toolsamc/users/epcvt/VT/CTM/CTM80/Billing/bin/runVT.php

其权限为rwxrwxrwx (777),所有者为epcvt : users

我想通过从该文件启动的AJAX请求调用runVT.php文件:/var/www/html/evtgen/evt_run.php

我试着用这个Javascript来称呼它:

var xmlhttp;
if (window.XMLHttpRequest) 
{
    xmlhttp=new XMLHttpRequest();
}
else
{
     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","/epcusers/toolsamc/users/epcvt/VT/CTM/CTM80/Billing/bin/runVT.php" ,true);
xmlhttp.send();

}

但我总是收到一个找不到文件的回复:

The requested URL /epcusers/toolsamc/users/epcvt/VT/CTM/CTM80/Billing/bin/runVT.php was not found on this server.

我也试过

xmlhttp.open("GET","../../../../epcusers/toolsamc/users/epcvt/VT/CTM/CTM80/Billing/bin/runVT.php" ,true);

xmlhttp.open("GET","epcusers/toolsamc/users/epcvt/VT/CTM/CTM80/Billing/bin/runVT.php" ,true);

但这也没用。

为了检查文件夹上是否遗漏了什么,我转到Unix中的/var/www/html/evtgen/文件夹,并检查了两者:

vi /epcusers/toolsamc/users/epcvt/VT/CTM/CTM80/Billing/bin/runVT.php
vi ../../../../epcusers/toolsamc/users/epcvt/VT/CTM/CTM80/Billing/bin/runVT.php

他们俩都工作了(我拿到了剧本文本)。我错过了什么?

在文档根目录(/var/www/html/)中创建一个文件,根据需要进行调用。

在这个文件中,让它将您的文件称为/epcusers/toolsamc/users/epcvt/VT/CTM/CTM80/Billing/bin/runVT.php

示例:

<?php
require_once '/epcusers/toolsamc/users/epcvt/VT/CTM/CTM80/Billing/bin/runVT.php';

任何不在文档根目录中的内容都不能被客户端访问,除非你有一个PHP文件链接它(或者apache重写,但那是另一回事)。