PHP include_path performs the same task as the system PATH environment variable:
"It defines a list of directories to search when looking for a command to execute." ( Bob Rankin , 2011).
As pointed out in a previous comment by andre matos, you can either copy the library directory to your PHP include_path directory, or you can set the PHP path configuration directive, include_path, to the php.ini file to include the library directory as a directory for searching PHP.
No matter how you choose, you need to know your PHP include_path directory. To find your PHP include_path directory, you can:
% php -i | grep include_path
-or, create a file, for example, "phpinfo.php", and add the following PHP code:
<?php phpinfo(); ?>
and run the file through PHP,
% php phpinfo.php | grep include_path
-or, otherwise, add a file, for example, "phpinfo.php", to the directory that your web server knows about, and open it as a URL in a web browser and look for "include_path".
For example, my PHP include_path system is located at /usr/lib64/php
Although the easiest way is to simply copy the library directory to your PHP include_path directory (for example, / usr / lib64 / php), you can also easily set the include_path path configuration directive on your system php.ini file.
To set the PHP path configuration directive "include_path" in your php.ini system file, open the file and find the path configuration directive "include_path" in the "Paths and directories" section. It should look something like this:
;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" ;include_path = ".:/php/includes" ; ; Windows: "\path1;\path2" ;include_path = ".;c:\php\includes"
Remove the ';' from the PHP include_path configuration directive for your operating system.
For example, if you are on Linux, it should look like this:
;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" include_path = ".:/php/includes" ; ; Windows: "\path1;\path2" ;include_path = ".;c:\php\includes"
Then set the "include_path" path configuration directive to the library directory, as the directory for PHP search.
For example, I downloaded ZendFramework on
/usr/src/done/ZendFramework-1.11.4-minimal/
Therefore, I have to set the PHP include_path configuration directive to include the library directory in the ZendFramework directory, for example:
include_path = ".:/usr/lib64/php:/usr/src/done/ZendFramework-1.11.4-minimal/library"
The "Paths and directories" section in the php.ini system file should now look like this:
;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; ;;;;;;;;;;;;;;;;;;;;;;;;; ; UNIX: "/path1:/path2" ;include_path = ".:/php/includes" include_path = ".:/usr/lib64/php:/usr/src/done/ZendFramework-1.11.4-minimal/library" ; ; Windows: "\path1;\path2" ;include_path = ".;c:\php\includes"
Let me explain the directories added to the PHP include_path configuration directive in the php.ini file (shown above):
"." is the current directory, '/ usr / lib64 / php' is the PHP include_path system directory, and '/usr/src/done/ZendFramework-1.11.4-minimal/library' is the path to the library directory in the ZendFramework directory. Please note that each directory specified in the PHP include_path configuration directive must be separated by a ":" symbol (the same as the directories listed in the system PATH environment variable).
After you have added the directory listing to the PHP include_path configuration directive in the php.ini file, you must restart the web server to save the changes to PHP.
e.g. % sudo apachectl restart # assumes you are using Apache as your web server
Hope this helps,
//. Elliot