I have no idea what the problem is PHP CLI

Trying to do some PHP…

Login

Blog History

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 *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.