1

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
4
  • Is OutputStream.php file present inside SabreAMF folder? Commented Apr 12, 2013 at 10:57
  • You are wrong in the way you are including , you just need to say require_once OutputStream.php Commented Apr 12, 2013 at 11:00
  • Because you PHP already knows that you your include path is $inc_path .= PATH_SEPARATOR . "./rtmp" . PATH_SEPARATOR . "./SabreAMF"; Commented Apr 12, 2013 at 11:01
  • Yes, ofc... all the files are there Commented Apr 12, 2013 at 11:29

3 Answers 3

1

Updating to php 5.4 solved the problem.

Sign up to request clarification or add additional context in comments.

Comments

0

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';

Comments

0

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

5 Comments

The questing is, I think php suppose to have some settings that I can change for that code to work, because it is working on other php servers.
may be its not hapening at boot strap or you have not given read permissions to your files
I can change all the filed manually till it works, but I wanna know why it works at one system and not in the other.
How can I change the master directory, so require_once 'SabreAMF/AMF0/Const.php'; will work, cause the general folder is one before.
I am not actually getting what your problem is ,there are somany reasons for not getting included , and not getting accessed , your problem is in the deployment level , you have not deployed it properly , that is the problem , and also look into the apache logs carefully follow the application flow properly by using debug log and see where its breaking

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.