dongmei9961 2011-08-16 10:57
浏览 69

在PHP中包含不在一个目录中工作的路径

Can anybody help with the last detail of my new system. I have hit a brick wall with some php code file references trying to include files and classes. I have a script that uses Pear Mail to send SMTP e-mails and it has been working fine for years in my public_html directory at my server service on a UNIX server. I have a copy of this script in a further directory, instructorapps, in my public_HTML directory and moving it up one level has broken it. From the errors it is obviously file references in the include path which is handled by the php code:

$path = "/home/thebrigh/php";
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
require_once ('../php/Mail.php');

This is the code that works in the public_html directory and I have tried many combinations of things to get it to work one level up. get_include_path() returns .:/usr/lib/php:/home/thebrigh/php in the working file and .:/usr/lib/php:/usr/local/lib/php:/home/thebrigh/php in the non working one. It's the middle bit /usr/local/lib/php: that I guess is causing problems but I can't seem to get rid of it.

Many Thanks Colin

  • 写回答

2条回答 默认 最新

  • dpqaaczn141761 2011-08-16 11:10
    关注

    Perhaps try require_once ('../../php/Mail.php');

    评论

报告相同问题?

悬赏问题

  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?