PHP include gotcha

This took an embarrassing amount of time to figure out so I thought I'd pass it along...

If you want to include or include_once a PHP library but don't want to include that library locally with your PHP application, you can use set_include_path to tell PHP where to look for includes.

For example, if you have the phpseclib library in a central location on your server, you can use:
set_include_path('/common/path/to/phpseclib/folder');
include('Net/SSH2.php');


Comments

Popular Posts