Skip to content

Instantly share code, notes, and snippets.

@renan
Created September 12, 2016 13:59
Show Gist options
  • Save renan/777d575a14d79f02a278800b53b3b4aa to your computer and use it in GitHub Desktop.
Save renan/777d575a14d79f02a278800b53b3b4aa to your computer and use it in GitHub Desktop.
<?php
if (extension_loaded('xdebug')) {
// Use a empty php.ini and not extra ini files
putenv('PHP_INI_SCAN_DIR=/tmp/composer-php-empty');
passthru('php -c php.ini main.php', $exitCode);
} else {
// Run with the env var
passthru('php sub.php', $exitCode);
// Reset the env var
putenv('PHP_INI_SCAN_DIR');
passthru('php sub.php', $exitCode);
}
exit($exitCode);
<?php
var_dump(extension_loaded('intl'));
var_dump(extension_loaded('xdebug'));
@renan
Copy link
Author

renan commented Sep 12, 2016

Outputs:

bool(false)
bool(false)

/Users/renan/test/sub.php:3:
bool(true)
/Users/renan/test/sub.php:4:
bool(true)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment