user1018517
user1018517

Reputation:

PHP: set_include_path and require_once(): Failed opening required

I got a problem with my php settings, I know that for sure 'cause the exact same lib works perfectly for my partner at HIS server.

$inc_path = get_include_path();
$inc_path .= PATH_SEPARATOR . "./rtmp" . PATH_SEPARATOR . "./SabreAMF";
set_include_path($inc_path);

require_once 'rtmp/SabreAMF/OutputStream.php';
require_once 'rtmp/SabreAMF/InputStream.php';
require_once 'rtmp/SabreAMF/AMF0/Serializer.php';
require_once 'rtmp/SabreAMF/AMF0/Deserializer.php';
require_once 'rtmp/SabreAMF/TypedObject.php';

and this is what I get

Warning: require_once(rtmp/SabreAMF/OutputStream.php): failed to open stream: No such file or directory in C:\Program Files (x86)\EasyPHP-12.1\www\phpLoL-master\rtmp\RtmpClient.php on line 7

Fatal error: require_once(): Failed opening required 'rtmp/SabreAMF/OutputStream.php' (include_path='.;C:\php\pear;./rtmp;./rtmp/SabreAMF;./rtmp;./SabreAMF') in C:\Program Files (x86)\EasyPHP-12.1\www\phpLoL-master\rtmp\RtmpClient.php on line 7

Upvotes: 1

Views: 3841

Answers (3)

user1018517
user1018517

Reputation:

Updating to php 5.4 solved the problem.

Upvotes: 1

Aravind.HU
Aravind.HU

Reputation: 9472

Actually you are setting the include path

already like this

$inc_path .= PATH_SEPARATOR . "./rtmp" . PATH_SEPARATOR . "./SabreAMF";
set_include_path($inc_path); 

Since now PHP knows that what ever file you are including might be in this path you can just include like below

require_once 'OutputStream.php';

or

require_once 'AMF0/Deserializer.php';

NOTE : - I assume that you are doing set_include_path at your application bootstrap , other wise this approach of set include path pro grammatically wont work at all

Upvotes: 0

Ifkooo
Ifkooo

Reputation: 51

Try with

$inc_path = $_SERVER['DOCUMENT_ROOT'];    
require_once $inc_path.'/rtmp/SabreAMF/OutputStream.php';    
require_once $inc_path.'/rtmp/SabreAMF/InputStream.php';    
require_once $inc_path.'/rtmp/SabreAMF/AMF0/Serializer.php';    
require_once $inc_path.'/rtmp/SabreAMF/AMF0/Deserializer.php';    
require_once $inc_path.'/rtmp/SabreAMF/TypedObject.php';

Upvotes: 0

Related Questions