I am just starting to use the PHP Debug extension in Visual Studio Code (Ubuntu 14.04). It mostly works fine for me, but I have a problem that every time an exception is thrown, the debugger …
Tag: debugging
PHP autologout inactive users
first time poster here, finally decided to make an account here after i used too many hours of my workday trying to solve this problem yesterday. so i have this “sessionCheck.php” script that is supposed to logout the user if he is inactive see code below. Right now the variable $inactive = 15; wh…
PhpStorm built-in server: Debug incoming requests
I am (locally) hosting a PHP script with PhpStorms built-in Server. Is there a way to debug an incoming HTTP request? I know that there is the “PHP HTTP Request” run-configuration, which allows you to perform a request and debug it, but somehow my problem only occurs when the requests is coming fr…
How to debug “FastCGI sent in stderr: Primary script unknown while reading response header from upstream” and find the actual error message?
SO has many articles mentioning this error code: That probably means that this error message is more or less useless. The message is telling us that the FastCGI handler doesn’t like whatever it was sent for some reason. The problem is that sometimes we have no idea what the reason is. So I’m re-st…
Connection between phpstorm and xdebug
I configured phpstorm-xdebug and I was able to debug my code with breakpoints. These days I updated php (through brew) and xdebug and now I have php 5.5.26 with xdebug 2.3.3. When I try to debug tests …
Best way to find out which php file has generated an html line of code in WordPress
Using Chrome you can right click – Inspect element to see the html code behind that element: I wonder how to find which php file has generated that html. Maybe there is some tool to put a breakpoint into the html so the php server will stop when trying to generate it again? I’m using WordPress loc…
How to debug Laravel framework?
I’m a newbie PHP programmer now casting an eye at frameworks, and among them Laravel sounds appealing to me as a beginner (somehow unfortunately because I’ve already invested in literature on Zend 2). …
Printing debug output to console in Codeception
Very thick question, but is there any way to print your own debug messages to the console in Codeception? I mean messages that have nothing to do with assertions, purely for debugging the tests themselves (e.g. like you would var_dump() a variable in any regular PHP website) I have already tried var_dump(), e…
PHP parse/syntax errors; and how to solve them
Everyone runs into syntax errors. Even experienced programmers make typos. For newcomers, it’s just part of the learning process. However, it’s often easy to interpret error messages such as: PHP Parse error: syntax error, unexpected ‘{‘ in index.php on line 20 The unexpected symbol is…
How to return a line number in a PHP script
Is it possible for a PHP script to return a line number in which some command is called? I’m having trouble describing what I want so maybe an example. I have PHP code that calls MySQL on many occasions. In line 49 is: The text “line 49” I wrote manually. Is it possible to get this number &#…