Question: I have a relatively fresh instance of Ubuntu 16.04 running a Drupal 7 site, with php5.6 installed instead of php7. The drupal site runs well. I am trying to get drush installed so that I can easily do updates.

I have done the global install per <http://docs.drush.org/en/8.x/install/>

Specifically, as the ubuntu user (no root login)

wget <http://files.drush.org/drush.phar>

/usr/bin/php5.6 drush.phar core-status

PHP configuration : /etc/php/5.6/cli/php.ini 
 PHP OS : Linux  

 Drush script : /home/ubuntu/drush.phar  

 Drush version : 8.1.12  

 Drush temp directory : /tmp  

 Drush configuration :  

 Drush alias files : 

chmod +x drush.phar

sudo mv drush.phar /usr/bin/drush

/usr/bin/php5.6 drush --version

Could not open input file: drush

What am I missing?

Answer: 
To use namespaced classes in Drupal 7, you can use one of these modules:

* <https://drupal.org/project/xautoload>
* <https://drupal.org/project/registry_autoload>

One reason for choosing one or the other may be if you have other modules that also depend on one of those modules.

Otherwise I guess it is largely a matter of taste.

One difference is that xautoload is more convenient during development, because newly created PSR-4 classes are immediately available without rebuilding the class registry.

On the other hand, it does a lot of things which you probably don't need right now, and the code looks complex.

Of course you could do some profiling to find out which is faster, but as always you would need to be careful what you measure and what you compare. I currently cannot tell you which one is faster, or better for memory.

There is also the [alternatives](https://drupal.org/project/alternatives) module that can help to have only one of those enabled, instead of both.

*Disclaimer: I am the author of one of these modules, and I am subscribed to the autoload tag on drupal.stackexchange.com.*
I believe the reason is that Drupal 7's class loader doesn't account for namespaces, so it would find \TestClass but \Drupal\testmodule\TestClass is not found.

There are two ways around this: don't use namespaces (may not be possible), or include your own class loader as one of the files mentioned in your .info file.

There are examples of trivial autoloaders on this page:
<http://php.net/manual/en/language.oop5.autoload.php>