开发者

what is the Zend path

Where should i set the set_include_path for zend... i am trying to use google calendar on m开发者_运维百科y site, and it works on zend.. i never used zend, i am new to stuff like that,

so on this google calendar api page it says:

Before running this sample or developing your own code which uses the Zend Framework, you may need to set the include_path and load the appropriate classes. The include path can be set using either a php.ini setting or using the set_include_path method. This code requests a ..

Where should i find the zend path? i hav a typical php-apache config. shared host

I searched a lot for it but did not find anything;

I tried st like this:

set_include_path('/usr/local/');

require_once 'usr/lib/Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

but doesnt work

Thanks a lot!


Setting it to /usr/lib should work.

Zend should then search for libraries relative to that, so it will look for

Zend_Gdata

in

/usr/lib/Zend/Gdata


To make sure your previously set include path is preserved, you can do the following:

set_include_path(implode(PATH_SEPARATOR, array(
    realpath(APPLICATION_PATH . '/usr/lib'),
    get_include_path(),
)));


First, I suggest that confirm you have the Zend Framework installed on your system. Since I don't know your environment, I will explain how I got my Zend installed on my cPanel shared system.

Start by downloading the Zend GData library for Google API and contain everything you need to access Google's Data APIs from your PHP 5 application.

Download Zend Gdata Library

I uploaded the Zend library to my cPanel using FileZilla, and placed it OUTSIDE the public_html directory, one level under. I did this for security reasons, and to protect my library from being accidently deleted by an unknown person/developer.

<username> is the account name root folder. (replace with whatever is appropriate for your hosting environment.

 /home/<username>/Zend

I then created a directory /home/<username>/conf which is also outside my web root folder, and did this to protect sensitive information against prying eyes.

In my /conf directory, I created a php.ini file and set the path to add the path to the include_path:

include_path = ".:/usr/lib/php:/usr/local/lib/php:/home/<username>"
allow_url_fopen = On 
allow_url_include = On

This instructs PHP to look in the /home/<username> directory for includes.

require('Zend/somefile.php'); 

Then, I edited my /public_html/.htaccess file to instruct PHP to load the php.ini file:

SetEnv PHPRC /home/<username>/conf/php.ini

Now, when I call my library, it's an easy:

require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
Zend_Loader::loadClass('Zend_Http_Client');

Vala! Works like a charm, keeps my library from being deleted, and protects system info from peeping tomolies to boot.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜