General Electric
General Electric

Reputation: 1226

Require paths not working using google api php library

My problem is the next one,

I tried to integrate the google login using OAuth 2.0 feature into my company backend.

I tested it on my domain , www.gabrielestevez.com, everything here works perfect, there is no problem with the require paths, everything runs smothly

But , the company backend directories has the following structure enter image description here

I'm using a mvc framework developed by me , the Google_SL.php file contains the class where I make the first two require_once

require_once 'Google/Client.php';
require_once 'Google/Service/Oauth2.php';

which works fine, but then when it goes to the client.php and is trying to load this class

require_once 'Google/Auth/AssertionCredentials.php'; 

is not working , this is the error An error occurred in script '/home/xxx/public_html/admin/hmf/Core/library/auth/Google/Client.php' on line 18: require_once(Google/Auth/AssertionCredentials.php) [function.require-once]: failed to open stream: No such file or directory Date/Time: 9-19-2014 11:50:29

, I don't want to change manually all the path within this library because I know there is got to be a better solution to this

any input is appreciated.

Upvotes: 0

Views: 176

Answers (2)

General Electric
General Electric

Reputation: 1226

for future reference

I fixed my issue using this set_include_path($_SERVER['DOCUMENT_ROOT'] . '/admin/hmf/Core/library/auth/' . PATH_SEPARATOR . get_include_path());

Upvotes: 1

ivan.sim
ivan.sim

Reputation: 9268

Try use __DIR__ to get the current directory of the script. Not exactly sure where your AssertionCredentials.php is, but try something like

require_once(__DIR__ . '/Google/Auth/AssertionCredentials.php');

Upvotes: 0

Related Questions