1

Disclaimer: There are similar kind of issues posted in stack overflow but those questions are their respective answers, neither suited this issue nor their answers helped to fix. Those problems are different and answers suited only those specific questions and not generic. They are no way helpful after a long struggle thinking twice I am posting this question to get a help. If someone don't like this question or don't understand, please communicate and get clarified instead of barely setting flag to close this question; better you can ignore and pass on...Thank you!

Requirement : I am using Zend framework for google calendar API with a core PHP website. It's an online taxi booking. If someone wants to book a taxi, the form should use the booking details to mark on the google calendar then database and finally paypal. If the payment is made in paypal then again it should update by a re-phrasing the calendar data to something like "Paid" else "Payment - Pending".

Problem : If I try to add the below code in the file the program throws the error message which is from the below line of codes.


  • The below are mandatory to read where as the above are optional

.

This code is used to add an event to the google calendar.

How I should fix this issue?

Source Code:

error_reporting(E_ALL);

define('ROOT_DIR', dirname(dirname(FILE)));

// Setup path to the Zend Framework files

set_include_path('.' . PATH_SEPARATOR . ROOT_DIR.'/app/' . PATH_SEPARATOR . ROOT_DIR.'/lib/' . PATH_SEPARATOR . ROOT_DIR.'/lib/incubator' . PATH_SEPARATOR . get_include_path() );

echo 'Setup path to the Zend Framework files - completed'.'
';

error_reporting(E_ALL);

// Register the autoloader

require_once 'Zend/Loader.php';

echo 'loader.php - require() completed'.'
';

Zend_Loader::loadClass('Zend_Gdata'); Zend_Loader::loadClass('Zend_Gdata_ClientLogin'); Zend_Loader::loadClass('Zend_Gdata_Calendar'); Zend_Loader::loadClass('Zend_Http_Client');

echo 'Register the autoloader - Completed';

// connect to service

$gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; $user = "email@gmail.com"; $pass = "*"; $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal);

echo 'connect to service - Completed';

ERRORS:

// I have printed this statement - refer above code.

Setup path to the Zend Framework files - completed

  1. Warning: require_once(Zend/Loader.php): failed to open stream: No such file or directory in /home/website/public_html/add-session-dev.php on line 20

  2. Fatal error: require_once(): Failed opening required 'Zend/Loader.php' (include_path='.:/home/website/app/:/home/website/lib/:/home/website/lib/incubator:.:/usr/share/pear:/usr/share/php') in /home/website/public_html/add-session-dev.php on line 20

There are nothing executed after the above errors.

Neocortex
  • 653
  • 9
  • 32
  • 1
    Is there a copy of Zend Framework in one of the folders on your include path? If so is there a file at Zend/Loader.php? – Tim Fountain Mar 15 '13 at 16:00
  • Tim Fountain - Yes, there is a copy of Zend Framework in one of the folders in website's include path. Yes, there is a file in location Zend/Loader.php. The error #1 says the message clearly. – Neocortex Mar 16 '13 at 05:42
  • One often runs into this error, and to quickly troubleshoot it, follow these steps : http://stackoverflow.com/a/36577021/2873507 – Vic Seedoubleyew Apr 12 '16 at 16:56

1 Answers1

1

Search for

Change the below from

define('ROOT_DIR', dirname(dirname(FILE)));

to the below

define('ROOT_DIR', dirname(dirname(FILE))."/public_html/zend");

and everything has worked fine for me. If anyone couldn't be able to fix this issue let me know.

Neocortex
  • 653
  • 9
  • 32
  • define('ROOT_DIR' etc. didn't work for me. I added echo getcwd() to Autoloader.php (before line 24 where it was failing) and saw that php was reading one directory before. I then used chdir("php") in the script that called require_once to change the current directory to the correct one, and everything worked. – roberto Nov 22 '15 at 09:12
  • There is now a troubleshooting checklist for this frequent error here : stackoverflow.com/a/36577021/2873507 – Vic Seedoubleyew Apr 12 '16 at 16:56