Reputation: 21
I installed the pear/http_request2
version 2.2.1
using Composer in my project but when I am trying to make my first request I am getting this Warning and Fatal error:
Warning: require_once(Net/URL2.php): failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/http_request2/HTTP/Request2.php on line 24
Fatal error: require_once(): Failed opening required 'Net/URL2.php' (include_path='/Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/pear_exception:.:/Applications/XAMPP/xamppfiles/lib/php') in /Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/http_request2/HTTP/Request2.php on line 24
I appreciate any help on how to fix it, thanks in advance.
David.
Upvotes: 2
Views: 5338
Reputation: 166929
This should work:
composer require pear/http_request2:2.2.1
By default pear/net_url2
should be installed which has the required URL2.php
file (./vendor/pear/net_url2/Net/URL2.php
).
Then make sure you're including vendor/autoload.php
file in your scripts to load automatically the include paths (see: vendor/composer/include_paths.php
file).
Here is a simple PHP command to test this out:
php -r 'require_once "vendor/autoload.php"; require_once "Net/URL2.php";'
Note: The above command should run without any errors.
Related: Errors in the autoloaded HTTP/Request2 code, how to troubleshoot composer?
Upvotes: 2
Reputation: 31146
You need HTTP_Request2
from git master
, because it has not been released/tagged yet at the time of writing.
Upvotes: 0