Skip to content

Instantly share code, notes, and snippets.

@phpdave
Last active March 11, 2016 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save phpdave/c4df76111d3804afe487 to your computer and use it in GitHub Desktop.
Save phpdave/c4df76111d3804afe487 to your computer and use it in GitHub Desktop.
Learn about your php cli setup
# learn what php-cli is doing
cat /usr/local/zendsvr/bin/php-cli
# learn what configuration values are set
cat /etc/zce.rc
# learn what extensions are enabled in php.ini
cat /usr/local/zendsvr/etc/php.ini | grep extension
# see extensions included
/usr/local/zendsvr/bin/php-cli -r "phpinfo();" | grep conf.d
# things you should probably create for setting up php-cli specific configuration
cp /usr/local/zendsvr/etc/php.ini /usr/local/zendsvr/etc/cli/php.ini
cp /usr/local/zendsvr/etc/conf.d /usr/local/zendsvr/etc/cli/conf.d
cp /usr/local/zendsvr/etc/conf.d/*.ini /usr/local/zendsvr/etc/cli/conf.d/*.ini
#and edit /usr/local/zendsvr/bin/php-cli
$ZCE_PREFIX/bin/php "$@"
#to
$ZCE_PREFIX/bin/php -c "/usr/local/zendsvr/etc/cli/php.ini" "$@"
#edit /usr/local/zendsvr/etc/cli/php.ini and remove
zend.ini_scandir=conf.d
#then run your phpcli against your script and tail -f the error log to see what extensions you need and modify the /usr/local/zendsvr/etc/cli/conf.d file and include only those extensions
tail - f /usr/local/zendsvr/var/log/php.log
#if you don't tknow your php error log you can find it by:
cat /usr/local/zendsvr/etc/php.ini | grep "error_log ="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment