0

I am using Ubuntu 19.10 and have installed pear/Request2 using sudo pear install http_request2. I am trying to use it inside my PHP file while sending a request to Azure Face API but it is giving me the following error.

Warning: require_once(HTTP/Request2.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/php_to_flutter/create_face_list.php on line 3

Fatal error: require_once(): Failed opening required 'HTTP/Request2.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/php_to_flutter/create_face_list.php on line 3

I have verified that the required files are available at

/usr/share/php/HTTP

but it isn't picking them. How am I supposed to resolve it? Thanks

Community
  • 1
  • 1
Jamshaid
  • 370
  • 2
  • 11
  • 40

2 Answers2

1

I have resolved the issue. It might not be an efficient solution but it worked for me. Here are the steps

  1. copied Net folder to HTTP folder
  2. copied HTTP folder from /usr/share/php to my htdocs where my .php files were saved.
    Boom!!! It worked perfectly fine. If anyone has any other solution, please share it. I'll try that too. Thanks
Jamshaid
  • 370
  • 2
  • 11
  • 40
1

As official PEAR manual states, before requiring the packages files you should check if the directory where pear stores all its extensions added to "include_path" .ini php settings, and if it's not you should add it manually. Official documentation

But you better switch from pear to composer as pear already dead package manager that is not updating for long term

  • I'll check the composer. For now, It's working fine. I hope it'll work too when I'll upload my database online and the PHP files too. Thanks for that. I'll check out your method too – Jamshaid Jan 14 '20 at 16:01