hugopereira84
10/7/2015 - 4:47 PM

PHP CLI

PHP CLI

To run commands in bash with root privilegies and without asking for pwd:
Edit file sudoers with next command: sudo visudo and do the following

# User privilege specification
root    ALL=(ALL:ALL) ALL
hugopereira ALL=(ALL:ALL) NOPASSWD: ALL
When running a PHP script from command line interface (CLI), a higher memory limit may be required in order for the script to be successfully executed. This can be achieved using the “-d” or “–define” option in the command. According to the manual:

This option allows you to set a custom value for any of the configuration directives allowed in php.ini.

An example of running a PHP script in CLI with custom memory limit:
$ php -d memory_limit=128M my_script.php

Of course the “-d” or “–define” option is not limited to the memory limit directive; it can be use to alter other php.ini directives as well.
phpsh -- An interactive shell for php
http://www.phpsh.org/