Troubleshooting php Zend includes a path

I am trying to configure the PHP path to my Zend Framework. I am very confused about how to do this. My Zend Framework is located in the following location on my server:

Amazon / ZendFramework-1.10.3-minimal

I am going to create a couple of php files in the amazon / directory that will require the Zend Framework. My inclusion path:

include("ZendFramework-1.10.3-minimal/library/Zend/Service/Amazon.php"); 

However, inside Amazon.php is a line

 require_once 'Zend/Rest/Client.php'; 

... and then Client.php has more dependencies set this way, etc.

How can I configure my inclusion path so that Amazon.php and Client.php (etc.) can correctly reference the location of the Zend Framework?

thanks

+4
source share
1 answer

You will need to specify your include path using set_include_path () in your boostrap file if you are using any. (you need to check the ZF layout for details if you use ZF).

Class loading will be handled by Zend Loader when you turn on the library /Zend/Loader.php file and call a function that will automatically load classes that are in your library / Zend folder.

When you set the inclusion path to your library, include the /Zend/Loader.php library and call Zend_Loader :: registerAutoLoad () I believe that you can work without problems.

short example in bootstrap.php file

 set_include_path('ZendFramework-1.10.3-minimal/library/'.get_include_path()); require_once('Zend/Loader.php'); Zend_Loader::registerAutoload(); 
+5
source

Source: https://habr.com/ru/post/1306514/


All Articles