What does .: mean in php include_path?
I'm trying to install Zend on a machine running xampp. Zend's help file says that in order to set up the command-line tools, I need to make sure that the contents of the /library directory are placed inside my php include_path specified directory.
When I look at my php.ini, include_path is commented out, but the value looks like this:
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
Where exactly is the include_path pointing to? I'm pretty new to Linux, and have never seen .: as part of a file path.
Solution 1:
.:
is actually just .
( since :
is the keyword that separates multiple paths ) which means the current folder the script is being executed in is included as part of the include_path. That way when you have two files in the same directory:
index.php
include-me.php
You can include the second in PHP with include('include-me.php');
. Without .
being in path you wouldn't be able to do so.
So in order to complete the install as mentioned you would need to either put the contents of /library
in the same folder the script you are working on is in - or in /php/includes
(Granted you remove the ;
from the ini file). You can also create another directory - like /opt/Zend/library
and add /opt/Zend/library
to your include path statement: include_path = ".:/php/includes:/opt/Zend/library"
Lastly - since you are running Ubuntu it is recommended that you use Ubuntu's LAMP setup instead (Most all documentation assumes you are using). This can be installed by removing XAMPP and performing sudo tasksel install lamp-server
which will install Apache 2.2, MySQL, PHP 5.3 onto the system. As covered in What's the easiest way to set up a LAMP stack?
Solution 2:
: is a separator in the list of directories.
. means the current directory
So when a php script is looking for an include file, it will look it the same directory as the php file, and /php/includes.