链接到根PHP上的文件
我最近换了服务器。从共享带控制面板到VPS 在我的旧服务器上,这个PHP工作:链接到根PHP上的文件,php,download,webserver,hosting,Php,Download,Webserver,Hosting,我最近换了服务器。从共享带控制面板到VPS 在我的旧服务器上,这个PHP工作: header("Content-disposition: attachment; filename= 'welcome.doc'"); header('Content-type: application/msword'); readfile("/home/abcme/aboveroot/admin/welcome.doc"); 新服务器中存在相同的文件夹结构。主页上方有一个名为UpperRoot的文件夹,其中有一个
header("Content-disposition: attachment; filename= 'welcome.doc'");
header('Content-type: application/msword');
readfile("/home/abcme/aboveroot/admin/welcome.doc");
新服务器中存在相同的文件夹结构。主页上方有一个名为UpperRoot的文件夹,其中有一个名为admin的文件夹和一个名为welcome.doc的文件
我更改了/home/abcme,以便“abcme”是正确的新帐户名
现在我得到一个错误,说文件找不到。“我的服务器”中是否需要启用某些功能,或者有什么其他原因可以解释这一点?根据您所说的结构:
>aboveroot
-home
-admin
-welcome.doc
因此,您的标题会说(假设/UpperRoot是您的webroot,这似乎与给定名称的情况不同):
我猜是目录或文件权限错误。如果它在主目录上方,路径不是
/overroot/admin/welcome.doc
?这可能是一个错误。您可以使用getcwd()获取脚本所在的路径,并检查文件结构是否正确,然后更正路径。
header("Content-disposition: attachment; filename= 'welcome.doc'");
header('Content-type: application/msword');
readfile("/aboveroot/admin/welcome.doc");