K20GH
K20GH

Reputation: 6263

How to include 3rd party libraries in CodeIgniter?

I'm trying to get Google Plus Authentication into CodeIgniter using the following: https://code.google.com/p/google-api-php-client/

I have put these files in third_party/google-api-php-client/src

If I was doing this without CI, I would simply use:

require_once 'google-api-php-client/src/Google_Client.php';
require_once 'google-api-php-client/src/contrib/Google_PlusService.php';

What would be the CI equivalent way to "require" these files? I have tried doing

require APPPATH .'third_party/google-api-php-client/src/Google_Client.php';

However get issued the following message:

Message: require(application/third_party/google-api-php-client/src/Google_Client.php): failed to open stream: Permission denied

Upvotes: 5

Views: 25544

Answers (2)

MJ X
MJ X

Reputation: 9054

download the third party library and put it inside your library or third party folder and the same you load your other libraries you can load this as will, check out this way i hope it will work

$this->load->library('phpword');

for third parties. for google api check read out this i hope this will solve your problem https://github.com/joeauty/Google-API-Client-CodeIgniter-Spark

Upvotes: 5

Bad Wolf
Bad Wolf

Reputation: 8349

PHP does not have the required permissions to access the file. This can either be due to the group that the web server is running under not having read permissions on the file or because the file is not associated with the web server group. There are two ways to resolve this. The better option is to change the ownership of the file so that the web server group is associated with the file provided you know what group the web server uses. This can be done using the command chown myuser:www Google_Client.php In this command replace myuser with your user name and www with the group that the web server runs under. If using this method the file permissions should be set to 640 using chmod 640 Google_Client.php.

If you do not know what group the web server runs under you can change the file permissions so that all users and groups have read access to the file. This can be achieved by using the command chmod 644 Google_Client.php.

Upvotes: 0

Related Questions