Adding Google’s Data APIs to CakePHP – include_path Problem Fix

I recently developed a web app with youtube api. In this app I submit comment on any video, like or favorite any video. I used the zend gdata library. So i put them in the vendor folder and add it to my the controller. But i found the famous include_path problem. So i will share the solution with you.

You need to add the vendors folder into your PHP include path. There are lots of ways to do this, although I didn’t want to hard code the strict path, so I edited the /app/webroot/index.php file as follows:

Define the vendors folder based on the existing environment variables

if (!defined('VENDORS_DIR')) {
    define('VENDORS_DIR', ROOT . DS . APP_DIR . DS . 'vendors' . DS);
}

Later in the file, where ini_set(‘include_path’) is called, add this new VENDORS_DIR variable to the path:

	
		if (function_exists('ini_set') && ini_set('include_path', CAKE_CORE_INCLUDE_PATH . PATH_SEPARATOR . ROOT . DS . APP_DIR . DS . PATH_SEPARATOR . ini_get('include_path'))) {
			define('APP_PATH', null);
			define('CORE_PATH', null);
			ini_set('include_path', ini_get('include_path'). PATH_SEPARATOR .VENDORS_DIR);
		} else {

About Zakir Hyder

This entry was written by .

10. June 2011 by Zakir Hyder
Categories: CakePHP, Google's Data API, PHP, Web Development | Tags: , , , | Comments

Comments

  1. m16u31 says:

    thank u thank u, but i have a problme, maybe you can help me… please

    I have this error:
    Fatal error: Uncaught exception ‘Zend_Gdata_App_HttpException’ with message ‘Unable to Connect to ssl://www.google.com:443. Error #218491568: Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP?’ in E:\xampp\htdocs\cakeyt\app\vendors\Zend\Gdata\AuthSub.php:122 Stack trace: #0 E:\xampp\htdocs\cakeyt\app\views\youtubes\add.ctp(30):

    do you know how can i solve this…
    thank you again, and sorry for my bad english

  2. Zakir Hyder says:

    I think you XAMPP is preventing SSL socket transport.
    Here’s the solution to make your XAMPP support socket transport SSL.
    1. First stop your Apache service
    2. Find libeay32.dll and ssleay32.dll in xampp\php\ folder, and copy it into xampp\apache\bin\ folder. Just overwrite the older files in there.
    3. Edit php.ini file in xampp\apache\bin, remove the semicolon in “;extension=php_openssl.dll”
    4. Start the Apache service

  3. […] Adding Google’s Data APIs to CakePHP – include_path Problem Fix Saturday, June 11, 2011 12:56 AM I recently developed a web app with youtube api. In this app I submit comment on any video, like or favorite any video. I used the zend gdata library. So i put them in the vendor folder and add it to my the controller. But i found the famous include_path problem. So i will share […] […]