Tag Archives: command line

Open a file in Sublime Text 2 from command line

The idea is to create a symbolic link to the Sublime Text’s executable and put in the system’s path (execute “echo $PATH” to see your’s). I used /usr/local/bin:

GNU/Linux:

sudo ln -s /opt/sublime_text_2/sublime_text /usr/local/bin/sublime

Mac OS X:

sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime

sublime_text_2

Ref: https://www.sublimetext.com/docs/2/osx_command_line.html

See PHP configuration of an extension in the command line

For SOAP for example:

$ php --ri soap

soap

Soap Client => enabled
Soap Server => enabled

Directive => Local Value => Master Value
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_dir => /tmp => /tmp
soap.wsdl_cache_ttl => 86400 => 86400
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_limit => 5 => 5

Execute PHP code directly on command line

I always wondered if running PHP code directly in the command line could be posible and today, thanks to a tweet from Symfony creator Fabien Potencier, I learned how to do it. You just have to use the -r option of PHP:

$ php -r 'echo "Hello World!" . PHP_EOL;'
Hello World!