Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialUnsubscribed User
48,988 PointsPHP Debugging in Chrome
Hello, is there a way to debug php code running on a local server in google chrome. What i found so far looks dubious...
Thanks
5 Answers
Richard Hall
9,139 PointsHave you tried echoing or print_r (depends on what you're trying to output)?
Unsubscribed User
48,988 Pointsmmmh no... i just fire the code and if there's an error i usually look in the console tab in chrome, that seems not to be working with php....
Richard Hall
9,139 PointsRight, but unless you're doing something with javascript, such as $_GET or $_POST to retrieve data from the PHP, you won't see it in the console.
PHP will output in the HTML of the inspect.
Unsubscribed User
48,988 Pointsseems to access php error messages in chrome is not possible, i found this very helpfull workshop on treehouse: https://teamtreehouse.com/library/basic-error-handling-in-php
thanks
Richard Hall
9,139 PointsIf you could post your code I could help a bit more directly. Without seeing it, the only thing I can think of off hand is try to echo or print the variables that aren't doing what you want them to do, then inspect element to find where it is displayed and see if the output is what you're expecting.
Unsubscribed User
48,988 Pointsah ok i see what you mean no no i am looking for a way to inspect elements in chrome and check what went wrong with the php code, like with javascript under the console tab....
Steve Seebart
Courses Plus Student 11,897 PointsIt sounds to me like you need to get into your php.ini file and enable error reporting. (There's a good guide in the file itself to help you along.) With default settings, the browser will only report that the page is not working. With error reporting on, you'll get detailed error messages pointing to the page and line number where the error occurs.
Richard Hall
9,139 PointsRichard Hall
9,139 PointsLet me know if I can be of any more help or explain something in more detail. My responses were a bit brief.