PHP - Relative path's fail in the Qube 3

Posted in: Linux
By dePoPo
Mar 10, 2009 - 12:49:10 PM

Q: Relative PHP paths fail in the Qube 3

A: The Qube3 fails to handle relative paths for PHP include files correctly. A typical error message is something like:Warning: Failed opening 'albums.php' for inclusion (include_path='/usr/sausalito/ui/libPhp') in /home/users/pictures/web/index.php on line 115

The solution is to add the current path "." to the php search path, which will resolve this issue. Here is how to do it:

* Telnet into the Qube
* Type; su root to become the root user
* Type; pico -w /etc/httpd/php.ini
* Hit ctrl-w to open the search box, and have the system search for "include". Pico will jump to a line reading:include_path = "/usr/sausalito/ui/libPhp" ; UNIX: "/path1:/$
* change this line to read:include_path = "/usr/sausalito/ui/libPhp:./" ; UNIX: "/path$
* Type; /etc/rc.d/init.d/httpd restart to restart apache and php.



Visitor Comments