Jamshaid
Jamshaid

Reputation: 410

failed to open stream. no such file or directory Request2.php

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

Upvotes: 0

Views: 1309

Answers (2)

Volodymyr Sitdikov
Volodymyr Sitdikov

Reputation: 424

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

Upvotes: 1

Jamshaid
Jamshaid

Reputation: 410

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

Upvotes: 1

Related Questions