Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Added dependency checks for the PHP script.
Browse files Browse the repository at this point in the history
  • Loading branch information
whatthejeff committed Sep 11, 2010
1 parent c1ad1b3 commit eeff837
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/phpsh.php
Expand Up @@ -20,6 +20,16 @@
// this is probably not the right fix, but we need it for now
ini_set('memory_limit', ini_get('memory_limit') * 2 . 'M');

if (version_compare(PHP_VERSION, '5.0.0', '<')) {
fwrite(STDERR, 'Fatal error: phpsh requires PHP 5 or greater');
exit;
}

if ($missing = array_diff(array('pcntl','pcre','posix','tokenizer'), get_loaded_extensions())) {
fwrite(STDERR, 'Fatal error: phpsh requires the following extensions: ' . implode(', ', $missing));
exit;
}

// we buffer the output on includes so that output that gets generated by
// includes doesn't interfere with the secret messages we pass between php and
// python we'll capture any output and show it when we construct the shell
Expand Down

0 comments on commit eeff837

Please sign in to comment.