473,625 Members | 3,329 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Picking Up Parsing etc. Errors in PHP

I'm using Kate in Linux (and UltraEdit when I have to drop back into
Windows) for writing my PHP code. As a independent, self-employed
developer, I cannot afford a commercial IDE for PHP such as is provided
by Zend.

I'm running PHP (with Apache) on my own machine for my development work.

Is there some way ("strict" settings in the php.ini file, or whatever)
by which I can cut down the time I'm wasting searching for, and
recovering from, silly syntax errors in the code I write?

I've just spend a day, for example, finding a complex two-condition 'if'
statement where I'd simply forgotten to supply the outermost pair of
brackets. The only symptom I was getting was a total absence of HTML
output to the page, and my only debugging "tool" was the provision of
'echo' statements at various places down the PHP code, coupled with the
total commenting out of all PHP code beyond the one currently being tried.

If anybody knows of a free- or shareware PHP syntax checking tool for
Linux, I'd be grateful if they could let me know.
Feb 8 '08 #1
3 1383
*** Anonymous escribió/wrote (Fri, 08 Feb 2008 19:38:54 +0100):
Check your php.ini for the following:

error_reporting = E_ALL
Or even better (for PHP 5):

error_reporting = E_ALL | E_STRICT
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor austrohúngaro: http://www.demogracia.com
--
Feb 8 '08 #2
On Fri, 08 Feb 2008 18:58:27 +0100, Alan M Dunsmuir
<al**@moonrake. demon.co.ukwrot e:
I'm using Kate in Linux (and UltraEdit when I have to drop back into
Windows) for writing my PHP code. As a independent, self-employed
developer, I cannot afford a commercial IDE for PHP such as is provided
by Zend.

I'm running PHP (with Apache) on my own machine for my development work.

Is there some way ("strict" settings in the php.ini file, or whatever)
by which I can cut down the time I'm wasting searching for, and
recovering from, silly syntax errors in the code I write?

I've just spend a day, for example, finding a complex two-condition 'if'
statement where I'd simply forgotten to supply the outermost pair of
brackets. The only symptom I was getting was a total absence of HTML
output to the page, and my only debugging "tool" was the provision of
'echo' statements at various places down the PHP code, coupled with the
total commenting out of all PHP code beyond the one currently being
tried.

If anybody knows of a free- or shareware PHP syntax checking tool for
Linux, I'd be grateful if they could let me know.
Aside from the allready mentioned method to just run PHP and check the
errors, here's one that I use with my favourite editor: php -l
/path/to/file/name.php will ONLY do a syntax check, and report the result.
No more having to go through the webserver, run the entire code, perhaps
endlessly type urls/refresh windows. Just a simple key combination in the
editor here does it.
--
Rik Wasmus
Feb 8 '08 #3
In article <op************ ***@metallium.l an>,
Rik Wasmus <lu************ @hotmail.comwro te:
><al**@moonrake .demon.co.ukwro te:
>Is there some way ("strict" settings in the php.ini file, or whatever)
by which I can cut down the time I'm wasting searching for, and
recovering from, silly syntax errors in the code I write?

Aside from the allready mentioned method to just run PHP and check the
errors, here's one that I use with my favourite editor: php -l
/path/to/file/name.php will ONLY do a syntax check, and report the result.
That's a good suggestion. It should also catch instances where you use
a variable before it's initialized.

To debug online, I have an initialization script that is included
at the top of every single script I have. Among other things, the
initialization has the following lines:

if (SHOW_WARN) { // This is set in my config.php script
$errlog = "/home/my_account/some_path/error.log"; // error log file
if (file_exists($e rrlog)) unlink($errlog) ; // remove prev. error log
ini_set('displa y_errors', false); // prevent pre-header abort
ini_set('log_er rors', true); // enable error logging
ini_set('error_ log', $errlog); // set error log file
error_reporting (E_ALL); // report all errors
}

....and then at the bottom of my master page template I simply
display the error log if it exists, within <pre>...</pretags.

This method is necessary when one can't use php -l. One can't use
php -l when the execution of your script depends on cookies, login
data and other session-related data, responses from FORM submissions,
etc.

-A

-A
Feb 8 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
9434
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $ Last-Modified: $Date: 2003/10/28 19:48:44 $ Author: A.M. Kuchling <amk@amk.ca> Status: Draft Type: Standards Track
0
1765
by: Ewan B | last post by:
Hi, I'm using Xerces to parse XML files using SAX2, and am wondering if there is any information as to what exceptions are being thrown when certain validation errors occur. Taking a simple example schema <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" ...>
2
3946
by: Cigdem | last post by:
Hello, I am trying to parse the XML files that the user selects(XML files are on anoher OS400 system called "wkdis3"). But i am permenantly getting that error: Directory0: \\wkdis3\ROOT\home Canonicalpath-Directory4: \\wkdis3\ROOT\home\bwe\ You selected the file named AAA.XML getXmlAlgorithmDocument(): IOException Not logged in
16
2877
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed loaded into cache, the slideshow doesn't look very nice. I am not sure how/when to call the slideshow() function to make sure it starts after the preload has been completed.
2
1862
by: Chris | last post by:
I've added a configuration file similar to Web.config but that does not invoke a restart when changed, just a cache dependency. At various times I'm getting a seeingly random one of the following errors: This is an unexpected token. The expected token is 'NAME'. Line 6, position 3 An unexpected end of file parsing NAME has occurred. Line 6, position 3
0
1818
by: gallagherg | last post by:
I recieve a Parsing returned error message 0x800700003 along with Actve x/com errors how can i stop this?
24
2482
by: Marc Dubois | last post by:
hi, is it possible to parse an XML file in C so that i can fulfill these requirements : 1) replace all "<" and ">" signs inside the body of tag by a space, e.g. : Example 1: <fooblabla < bla </foo> becomes <fooblabla bla </foo>
26
3291
by: Ramon F Herrera | last post by:
http://groups.google.com/group/comp.lang.c/browse_frm/thread/86a3ddf0724d9630/4e38340aa824bee0?lnk=gst&q=how+to+best+parse+a+CSV&rnum=1#4e38340aa824bee0 http://tinyurl.com/29q4kf Michael & Paul (or anyone who can help): I have been looking for a solid implementation of CSV parsing and found the thread above, which includes pointers to programs written by both of you. In my first attempt at building them, I failed miserably, and I
3
4504
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude error-trapping (if it finds an error in one of the xml files, the script stops). Recently, the script has stopped working because one of the xml files is badly formed. So I decided to rewrite the script with better error trapping; the script should...
0
8256
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7184
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6118
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1500
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.