I have no idea what the problem is PHP CLI

Written by James McDonald

June 11, 2016

Trying to do some PHP tutorials using vim and running php from the command line and I get…. nothing back.

If it’s a syntax error (e.g. a missing line ending ; ) then no reply at all. If the syntax is correct and it’s something else then the error isn’t displayed

Apparently PHP CLI is muted by default.

So this link shows the answer which is:

php -d display_errors <script_filename.php>

So the silence is now throwing the Catchable fatal error duva:

php -d display_errors class.php 
This is a test of "TestClass" test class
object(TestClass)#1 (1) {
  ["prop1"]=>
  string(16) "My Test Property"
}
My Test Property from TestClass

Catchable fatal error: Object of class TestClass could not be converted to string in /Users/jmcd/class.php on line 37

Instead of uninformative silence:

php class.php 
This is a test of "TestClass" test class
object(TestClass)#1 (1) {
  ["prop1"]=>
  string(16) "My Test Property"
}
My Test Property from TestClass

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

How to Research a CPU Upgrade

How to Research a CPU Upgrade

Upgrade Time! Doing a lot of VMWare Workstation virtualization to create labs for self-study and training. Finding...