php - Facebook api: "open_basedir restriction in effect" -
I have uploaded my script for Facebook script, which is based on Facebook php API 4.0, PHP 5.4 on web hosting Supports, but I'm getting
WARNING: is_readable (): Open_basedir restriction in effect. The file / (/ dev / urandom) is not allowed within the path: /home/myuserid/public_html/Facebook/FacebookRedirectLoginHelper.php in line 244 (/ home / myuserid: / usr / lib / php: / tmp)
Line 244 and some of the following
if (is_readable ('/ dev / urandom')) {$ fp = fopen () '/ Dev / urandom ',' rb '); If ($ fp! == incorrect) {$ buf = fread ($ fp, $ bytes); Fclose ($ FP); If ($ buf! = FALSE) {return bin2hex ($ buf); }}}
If this can be helpful, here is the original login script:
; GetSessionFromRedirect (); } Catch (FacebookRequestException $ East) {// Facebook gives an error} Catch (Exceptions $ pre) {// When validation fails or if we have one session see other local issues} // If (isset ($ session) ) {// Graf API Request for User Data $ Request = New FacebookRequest ($ session, 'GET', '/ me'); $ Response = $ request-> carry about (); // Get feedback $ graph = object = $ response-> GetGraphObject (); // [...] uses data to login} other {// show login url echo & lt; A href = "'. $ Helper-> getLoginUrl ().' '& Gt; Login & lt; / a & gt;';}? & Gt;
Note: With PHP, locally easy, the script works perfectly
Most shared hosting providers actively prohibit users from accessing other users' content and system resources .
In this case they have used the option open_basedir
option which allows PHP only To open files in paths, and deny access to each other.
To solve the problem, you can either access them to / dev / urandom
If you do not do your code with the following, then change it:
If (function_exists ('openssl_random_sese_bytes')) {return bin2hex (openssl_random_pseudo_bytes ($ Bytes));}
openssl_random_pseudo_bytes
function is almost exactly the same and it is available on PHP 5.3.0 or higher.
Comments
Post a Comment