Add check for PHP_SAPI
merged branch Seldaek/patch-1 (PR #79)

This PR was submitted for the master branch but it was merged into the 2.1 branch instead (closes #79).

Discussion
----------

Add check for PHP_SAPI

See https://github.com/symfony/symfony/issues/7082#issuecomment-16074887

Commits
-------

e144e85 Add check for PHP_SAPI