473,320 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

PHP Debugging Engine?

markrawlingson
346 Expert 100+
Hi guys,

I'm an expert in ASP as well as a variety of other technologies, but I'd like to broaden my horizons a little bit. Thus, I'm learning PHP.

Since I use ASP I already have IIS 6.0 setup on my system for test environment purposes, so I downloaded and installed PHP onto my existing server configuration. I know that PHP is almost never run on an IIS configuration and that generally it's configured on Apache servers; Because of that I don't know if anyone would be able to assist me with the problem I am having, in fact, the problem I'm having may be related to the inherent use of IIS itself, but I thought I'd shoot it out there anyway.

The test pages I've created work perfectly when there is not an error within the script, however when there is an error in the script the page loads blank and I do not get any messages stating there was a problem with the script, on which line, etc. So currently I'm left to search through the script and manually attempt to find the problem with minimal knowledge of the language. I would hate to do this with ASP, let alone PHP.

Is there any reason for this, and if so how can I remedy this problem? Is there a script in the PHP engine somewhere with a switch to turn debugging on and off? Is there a switch within IIS itself to tell it to debug PHP scripts?

I'm thinking something is turned off somewhere, because I've attempted PHP years back, I remember getting detailed errors, and I'm quite certain I was also running an IIS configuration back then as well.

Any help would be greatly appreciated and would speed up the learning process immensely!

Thank you.

Sincerely,
Mark
Oct 28 '07 #1
7 1400
markrawlingson
346 Expert 100+
Oh, and I guess I should also mention that I've already tried:

Expand|Select|Wrap|Line Numbers
  1. error_reporting(E_ALL);
  2. ini_set('display_errors', True);
  3.  
Sincerely,
Mark
Oct 28 '07 #2
pbmods
5,821 Expert 4TB
Heya, Mark.

Let's have a look at some of your code. If you have display_errors turned on and you're still getting a blank page, then your script is probably encountering a logic error, not a syntax one.

P.S., As a minor nitpick, 'true' is faster than 'True' because then PHP doesn't have to convert it to lower case.
Oct 28 '07 #3
markrawlingson
346 Expert 100+
Heh, good eye! Very 'true' (no pun intended lol). I actually copied that right from the 'READ FIRST' forum post though :P.

I ended up finding the problem with the particular script I was working on at the time... which was a syntax error. I was missing a semicolon at the end of the line where I set the value of one of my variables, after that it worked apprioprately. I didn't get an error message before that though, so I had to manually search the file. In this case that's fine but when I start writing complicated scripts i really don't want to have to go around looking for missing semicolons and the like.

Expand|Select|Wrap|Line Numbers
  1. $sText = 'aBcDeFg1234%$#@#%$^&&'
  2.  
Above was the code throwing the problem, I added a ; to the end and the script executed.

Although I did screw up the script on purpose by placing dgfdfgfd at the top of the file inside the delimiters, and it did throw an error when I did so. That's fine, but whats up with it not throwing an error when I missed the semicolon? Is it not supposed to?

I checked the source code of the file when it was displaying a blank page and it was empty..

Sincerely,
Mark
Oct 29 '07 #4
pbmods
5,821 Expert 4TB
Heya, Mark.

Good call. I went ahead and fixed that post :)

Did you put the ini_set() stuff at the top of your script? Was it in an include file? That option has to be set first thing.

For example, this won't do you much good:

Expand|Select|Wrap|Line Numbers
  1. $str = 'Here\'s a syntax error -->'
  2.  
  3. ini_set('display_errors', 1);
  4. error_reporting(E_ALL);
  5.  
Oct 29 '07 #5
markrawlingson
346 Expert 100+
Yeah

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. error_reporting(E_ALL);
  3. ini_set('display_errors', True);
  4. $sText = "whatever..."
  5. #bunch of other random code to test php functions etc.
  6. ?>
  7.  
That was the code I was using, right at the top and in the same file as the rest of the code, not in an include. I just find it really wierd that I purposely attempted to generate an error by writing sdfdsgds within the delimiter tags (under the init_set() stuff) and it did give me an error, meanwhile the line with the missing semicolon didn't.

It is generating some error messages. I've been converting my ASP function list over to PHP, a lot of which use regular expressions, and the syntax for regular expressions is different than ASP - so I have been getting some error messages there, but not for simple things like the semicolon deal - which is a real annoyance because it's the little things we forget most often.

I purposely removed a { from an if statement and it killed the page with no error. Then I put it back and removed one from a function and it killed the page with no error. Improperly named variables, missing semicolons, etc. I purposely screwed the syntax in numerous locations and the page always bombs with no errors, but if I do something like...

Expand|Select|Wrap|Line Numbers
  1.  
  2. $sText1 = "Is this an alpha numerical string? It shouldn't be, it contains a question mark.";
  3.  
  4. function Alpha( $sText ) {
  5.    if (preg_match("/^[a-zA-Z0-9._-]+[\s]*$", $sText)) {
  6.       return true;
  7.   } else {
  8.      return false;
  9.   }
  10. }
  11.  
  12. Alpha( $sText1 );
  13.  
Which is, of course, missing the ending / in the preg_match function, it DOES throw an error.

But...

Expand|Select|Wrap|Line Numbers
  1. $sText1 = "Is this an alpha numerical string? It shouldn't be, it contains a question mark.";
  2.  
  3. function Alpha( $sText ) {
  4.    if (preg_match("/^[a-zA-Z0-9._-]+[\s]*$/", $sText)) 
  5.       return true;
  6.   } else {
  7.      return false;
  8.   }
  9. }
  10.  
  11. Alpha( $sText1 );
  12.  
Which, of course is missing the { in the if statement, Does not.

It seems extremely odd to me.

Sincerely,
Mark
Oct 29 '07 #6
Atli
5,058 Expert 4TB
Hi Mark.

Technically single-line if statements do not require {...} blocks, so the real error in your last example would be an extra { tag before the else statement. ;)

What you are describing is weird, because the two lines posted before should force your code to display all errors (except E_STRICT).

It is possible that IIS is somehow not doing this properly. You may want to try changing these values in the php.ini configuration file. Which, as with all changes made to a IIS server, requires a server re-start. I've even had to go as far as reboot the server to get the php.ini re-loaded.
Oct 29 '07 #7
markrawlingson
346 Expert 100+
Bingo! You guys are awesome. I changed the php.ini file yesterday before I posted this and it didn't work. This is only a test machine so I shut it down every night (effectively rebooting my server), so i tried it just now to see if that rebooting had helped, and what do ya know..

Parse error: syntax error, unexpected T_FUNCTION in D:\Inetpub\wwwroot\netTest\regexp.php on line 8

Parse error: syntax error, unexpected T_ELSE in D:\Inetpub\wwwroot\netTest\regexp.php on line 20

I thought it might have had something to do with IIS, never thought of rebooting it though.

Thanks a lot for your help guys. Much appreciated!

Sincerely,
Mark
Oct 29 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: T. Jones | last post by:
I want to create a debugging environment for PHP. I running Debian Woody and installed PHP4 from Debian's packaging system. I downloaded precompiled DBG from the webside and placed dbg.so in the...
25
by: Jeff | last post by:
Use the MS Script Editor included free with MS Office 2002 and above, for debugging Internet Explorer (IE). This subject is of great interest to many JS developers, as there is no obvious, low...
3
by: Stephen Kellett | last post by:
Hi Folks, With Mozilla there is a well documented Javascript debugging API that you can call from C/C++. I've been trying to identify if there is a documented API that you can use for the same...
2
by: John Gibson | last post by:
Hi, all. Re: version 7.2.2 I modified the postgresql.conf file as below and got "really neat" debugging turned on. :) pg_ctl reload -D <dir> Unfortunately after I was done, I wanted to...
0
by: Tom Pester | last post by:
This is the simplified structure of my website in IIS : c:\Website -------> Home (normal directory) -------> Engine (*virtual directory* but not an application!) I made the Engine (which...
5
by: Velvet | last post by:
Can someone tell me to what process I need to attach to be able to step through my classic ASP code in VS.net 2003. I'm working on an XP box with IIS installed. I also have VS.net 2005 (The...
12
by: pauldepstein | last post by:
I am debugging a program to price options which involves a recursive function: double node::get_equity(Parameter * const params_ptr, int x, int y, const int rights) This recursive function is...
0
by: Sericinus hunter | last post by:
This post is mostly for picking up by Google and information purposes. The problem itself is solved for me. Generally, debugging .Net COM dll should not pose any problems, but you will be...
1
by: Ole | last post by:
I have added a C++ dll to my solution where my main program (C#) is calling the dll using DllImports but I got the message ""The breakpoint will not currently be hit" when trying to debug my dll...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.