0

I've never used PEAR libraries, but now I need to modify the scripts that someone wrote php with PEAR libraries. I installed WAMP server and PEAR packages. The pear is installed in the directory 'C:\wamp64\bin\php\php5.6.40'. My website contents is installed in the directory 'C:\wamp64\www\mysite'. When I typed 'http://localhost/mysite/main/login.php' on a browser, there is always errors below.

Warning: require_once(/HTML/Template/ITX.php): failed to open stream: No such file or directory in C:\wamp64\www\mysite\main\login.php on line 13 Fatal error: require_once(): Failed opening required '/HTML/Template/ITX.php' (include_path='.;C:\php\pear') in C:\wamp64\www\mysite\main\login.php on line 13

Line 13 in login.php: require_once "/HTML/Template/ITX.php";

"/HTML/Template/ITX.php" is installed in the directory "C:\wamp64\bin\php\php5.6.40\pear".
I added "C:\wamp64\bin\php\php5.6.40" in the path of system variables and added 'include_path=".;C:\wamp64\bin\php\php5.6.40\pear"' in the file of php.ini, but the issues still exist.

Can anyone help me solve the issues? Thank you very much.

Sven Eberth
  • 3,057
  • 12
  • 24
  • 29
  • is the php.ini effective (display phpinfo() and check the include_path setting)? What happens if you prefix the backslash at the beginning of the require_once line with a dot (".") character? – hakre Jul 10 '21 at 21:43
  • 1
    This is not specifically related to PEAR, it is about using the include_path ini directive in conjunction with require_once(). You can safely use `/` slashes in path on windows in PHP. I would even say it's recommended. docs: https://www.php.net/manual/en/ini.core.php#ini.include-path – hakre Jul 10 '21 at 21:53
  • The leading `\\` is causing the search to go to the root folder and start looking there, remove the first `\\` and see it that works – RiggsFolly Jul 19 '21 at 12:38

0 Answers0