PHP debug tool won't debug?

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Post Reply
FrankC
Posts: 126
Joined: Thu Aug 18, 2011 3:28 pm

PHP debug tool won't debug?

Post by FrankC »

Hello,

I want to use the PHP debug tool (PHP -> debug -> Run) on a pure PHP file, but it refuses and says: "Debugging features work with PHP files only." However, it is a pure and only PHP file.

Even when requested to debug this simple test.php

Code: Select all

<?php
echo("Hello world!")
?>
it says that.

Did I forget to pay my contribution? :)
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: PHP debug tool won't debug?

Post by Aivars »

Try placing cursor inside the PHP code block. I think WeBuilder gets confused and thinks you're trying to debug HTML.
Blumentals Software Programmer
FrankC
Posts: 126
Joined: Thu Aug 18, 2011 3:28 pm

Re: PHP debug tool won't debug?

Post by FrankC »

Unfortunately, that doesn't cure. Just to be sure, here is a file that WeBuilder thinks is not a php file:

activator.php:
<?php
if ((!isset($_GET['Act_code'])) || ($_GET['Act_code'] == ''))
{die ("Activation failed because the code is missing in the request URL.");}
else
{$Act_code = $_GET['Act_code'];}

require "connect_remote.php";
require "page_frame.php";

$act_rec_check = mysqli_query($con, "SELECT 1 FROM enq_vs WHERE Act_code='$Act_code' AND Activated='1'");
if (mysqli_num_rows($act_rec_check) != 0)
{die($first_part . "<p>This dataset has already been activated.</p>" . $last_part);}


$rec_check = mysqli_query($con, "SELECT 1 FROM enq_vs WHERE Act_code='$Act_code'");
if (mysqli_num_rows($rec_check) == 0)
{die($first_part . "<p>A dataset with this activation code has not been found.</p>" . $last_part);}
else
{
mysqli_query($con, "UPDATE enq_vs SET Geactiveerd=1 WHERE Act_code='$Act_code'");
echo($first_part . "<p>Your dataset has been activated. Have a nice day!</p>" . $last_part);
}

mysqli_close($con);
?>
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: PHP debug tool won't debug?

Post by Aivars »

Worked for me. What I did was: New PHP file, paste your code, save the file as debugtest.php, PHP - Debug -> Run. And I got the message from line 3 in the browser.
Blumentals Software Programmer
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: PHP debug tool won't debug?

Post by Aivars »

Could you check that PHP file extension hasn't been removed from PHP file types in your settings? Options -> Preferences -> Document Types -> PHP. Make sure that "php" is in the list of extensions.
Blumentals Software Programmer
FrankC
Posts: 126
Joined: Thu Aug 18, 2011 3:28 pm

Re: PHP debug tool won't debug?

Post by FrankC »

It was indeed not in the PHP file list! Only php2, php3 and php4. I very probably removed it myself, although I don't really remember, because moving php to the HTML file list gives consistent and pleasant editor text coloring. Most of my regular files have a .php extension, too.

I noticed that the function Syntax Check does work without php being in the PHP file list. And with the error report from XAMPP, I have all that I need.

I do have a related question, though. What makes the extensions .php2, 3 and 4 different from .php? And are they supported by all browsers and all server PHP versions? Why I'm asking is that I did notice that with such an extension, the WB editor text coloring is much better (because those extensions are still in the PHP file list).
User avatar
Aivars
Blumentals Software Developer
Posts: 2462
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia

Re: PHP debug tool won't debug?

Post by Aivars »

I don't think all servers support these extensions unless they are configured appropriately. As of what makes them different - as far as I can figure it out, it's mostly a convention thing or automatic php version switching implementation (e.g. you can have both php 4 and 5 on your server and configure your server to use php 4 for .php4 files and php 5 for .php and .php5 files).
Blumentals Software Programmer
FrankC
Posts: 126
Joined: Thu Aug 18, 2011 3:28 pm

Re: PHP debug tool won't debug?

Post by FrankC »

That makes perfect sense. Thanks again!
FrankC
Posts: 126
Joined: Thu Aug 18, 2011 3:28 pm

Re: PHP debug tool won't debug?

Post by FrankC »

FrankC wrote:It was indeed not in the PHP file list! Only php2, php3 and php4. I very probably removed it myself, although I don't really remember, because moving php to the HTML file list gives consistent and pleasant editor text coloring. Most of my regular files have a .php extension, too.
In the meantime, I found out that the HTML coloring settings can be made 'global', by selecting Advanced Tools > Apply All Stiles To All Languages. So now I have the best of both worlds: a good code coloring and a working php debugger, also for files with the .php extension. :)
Post Reply