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…

Toggen builds a new website

So I have built and hosted a new website for Roger Clark Pest Management they are a family owned and operated Pest...

WizTree

Just downloaded WizTree (not a sponsor) from https://wiztreefree.com/ It seems to do what it says on the tin which is...

Scam call from “Telstra”

Just had a call from a man with a sub-continental accent from caller ID 0734946596 Told me there was problem with my...