473,785 Members | 2,307 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tool to parse and validate PHP script?

Hello

Is there a tool on Linux/FreeBSD that can parse a PHP script to make
sure there's no compile-time issues?

I just noticed that I copy/pasted some code that had lines longer that
can fit in the SSH terminal window, and that caused a run-time error
as reported in the /var/log/httpd-error.log but not in the browser:

[error] PHP Notice: Undefined index: etablissemen\nt in
/usr/local/www/apache22/data/prospect.php on line 49, referer:
http://server/myscript.php

Thank you.
Jun 2 '08 #1
13 1860
Gilles Ganault wrote:
Is there a tool on Linux/FreeBSD that can parse a PHP script to make
sure there's no compile-time issues?

I just noticed that I copy/pasted some code that had lines longer that
can fit in the SSH terminal window, and that caused a run-time error
as reported in the /var/log/httpd-error.log but not in the browser:

[error] PHP Notice: Undefined index: etablissemen\nt in
/usr/local/www/apache22/data/prospect.php on line 49, referer:
http://server/myscript.php
You can run 'php -l thescript.php' to do a syntax check, however your
error would not be catched by that: this is a run time error, and only
catchable by actually running the script.

Of course, on live websites error should not be shown, but logged, as is
done her apparently.
--
Rik Wasmus
Jun 2 '08 #2
On May 8, 9:06 am, Rik Wasmus <luiheidsgoe... @hotmail.comwro te:
Gilles Ganault wrote:
Is there a tool on Linux/FreeBSD that can parse a PHP script to make
sure there's no compile-time issues?
I just noticed that I copy/pasted some code that had lines longer that
can fit in the SSH terminal window, and that caused a run-time error
as reported in the /var/log/httpd-error.log but not in the browser:
[error] PHP Notice: Undefined index: etablissemen\nt in
/usr/local/www/apache22/data/prospect.php on line 49, referer:
http://server/myscript.php

You can run 'php -l thescript.php' to do a syntax check, however your
error would not be catched by that: this is a run time error, and only
catchable by actually running the script.

Of course, on live websites error should not be shown, but logged, as is
done her apparently.
--
Rik Wasmus
Any chance to transfer your file by ftp or sftp?
Jun 2 '08 #3
On Thu, 8 May 2008 06:14:40 -0700 (PDT), ELINTPimp wrote:
>Gilles Ganault wrote:
Is there a tool on Linux/FreeBSD that can parse a PHP script to make
sure there's no compile-time issues?
I just noticed that I copy/pasted some code that had lines longer that
can fit in the SSH terminal window, and that caused a run-time error
as reported in the /var/log/httpd-error.log but not in the browser:
[error] PHP Notice: Undefined index: etablissemen\nt in
/usr/local/www/apache22/data/prospect.php on line 49, referer:
http://server/myscript.php

Any chance to transfer your file by ftp or sftp?
Or use a better configuration on the editor....

--
This was, apparently, beyond her ken. So far beyond her ken that she was
well into barbie territory.
-- J. D. Baldwin
Jun 2 '08 #4
ELINTPimp wrote:
On May 8, 9:06 am, Rik Wasmus <luiheidsgoe... @hotmail.comwro te:
>Gilles Ganault wrote:
>> Is there a tool on Linux/FreeBSD that can parse a PHP script to make
sure there's no compile-time issues?
I just noticed that I copy/pasted some code that had lines longer that
can fit in the SSH terminal window, and that caused a run-time error
as reported in the /var/log/httpd-error.log but not in the browser:
[error] PHP Notice: Undefined index: etablissemen\nt in
/usr/local/www/apache22/data/prospect.php on line 49, referer:
http://server/myscript.php
You can run 'php -l thescript.php' to do a syntax check, however your
error would not be catched by that: this is a run time error, and only
catchable by actually running the script.

Of course, on live websites error should not be shown, but logged, as is
done her apparently.

Any chance to transfer your file by ftp or sftp?
What do you mean? 'my file'?

--
Rik Wasmus
Jun 2 '08 #5
On Thu, 8 May 2008 06:14:40 -0700 (PDT), ELINTPimp <sm*****@gmail. com>
wrote:
>Any chance to transfer your file by ftp or sftp?
I could do that instead. I'll just have to remember to convert from
CRLF to CR.

Thanks for the "-l" switch.
Jun 2 '08 #6
On May 8, 9:59 am, Rik Wasmus <luiheidsgoe... @hotmail.comwro te:
ELINTPimp wrote:
On May 8, 9:06 am, Rik Wasmus <luiheidsgoe... @hotmail.comwro te:
Gilles Ganault wrote:
Is there a tool on Linux/FreeBSD that can parse a PHP script to make
sure there's no compile-time issues?
I just noticed that I copy/pasted some code that had lines longer that
can fit in the SSH terminal window, and that caused a run-time error
as reported in the /var/log/httpd-error.log but not in the browser:
[error] PHP Notice: Undefined index: etablissemen\nt in
/usr/local/www/apache22/data/prospect.php on line 49, referer:
http://server/myscript.php
You can run 'php -l thescript.php' to do a syntax check, however your
error would not be catched by that: this is a run time error, and only
catchable by actually running the script.
Of course, on live websites error should not be shown, but logged, as is
done her apparently.
Any chance to transfer your file by ftp or sftp?

What do you mean? 'my file'?

--
Rik Wasmus
Sorry, Rik, I replied to the wrong comment. I was referring to the
posters copy/paste method being the problem and skip the need for
checking this post-transfer altogether by transferring the file they
created (and presumably tested) instead of copy/paste over ssh.
Jun 2 '08 #7
Gilles Ganault wrote:
On Thu, 8 May 2008 06:14:40 -0700 (PDT), ELINTPimp <sm*****@gmail. com>
wrote:
>Any chance to transfer your file by ftp or sftp?

I could do that instead. I'll just have to remember to convert from
CRLF to CR.
I often work under Windows, however, even under Windows my editor is set
up to \n instead of \r\n all the time. Saves a lot of headaches.

--
Rik Wasmus
Jun 2 '08 #8
Rik Wasmus wrote:
Gilles Ganault wrote:
>On Thu, 8 May 2008 06:14:40 -0700 (PDT), ELINTPimp <sm*****@gmail. com>
wrote:
>>Any chance to transfer your file by ftp or sftp?

I could do that instead. I'll just have to remember to convert from
CRLF to CR.

I often work under Windows, however, even under Windows my editor is set
up to \n instead of \r\n all the time. Saves a lot of headaches.
A text mode transfer will automatically strip or add \r as necessary.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jun 2 '08 #9
Gilles Ganault wrote:
Hello

Is there a tool on Linux/FreeBSD that can parse a PHP script to make
sure there's no compile-time issues?
You will never have a compile-time error with PHP since PHP is a script
and, hence, doesn't compile. Perhaps you mean run-time issues?
Jun 2 '08 #10

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

Similar topics

8
7425
by: Spartanicus | last post by:
The document at http://homepage.ntlworld.com/spartanicus/custom_dtd.htm uses a custom DTD, the w3c validator validates it but with this warning: "Unknown Parse Mode! The MIME Media Type (text/html) for this document is used to serve both SGML and XML based documents, and it is not possible to disambiguate it based on the DOCTYPE Declaration in your document. Parsing will continue in SGML mode."...
7
2324
by: ab3331 | last post by:
I need a tool that acts like a browser, but instead of actually rendering a page, it explains in English exactly what rules it's interpreting. This would make it simple to see which rules are applied, which are ignored, which are inherited or not, which are superceded, etc. This would be a huge aid in debugging pages. (I currently have a page that is included by another page - it's actually a menu - but it's rendered differently...
1
2576
by: vbnewb | last post by:
Hey All, I am new to the forums. Have been reading a bit here on some very useful tips and tutorials here. I am familiar with the basics of Access (tables , queries, forms,) but am such a newb at macros and the VB side of the application. I have been put to the task of building a tool in which will validate when one user has transferred an clients casefile to another user. as this is a windows NT environment i am using the NT usernames...
26
25619
by: webrod | last post by:
Hi, I have some php pages with a lot of HTML code. I am looking for a HTML validator tool (like TIDY). TIDY is not good enough with PHP tags (it removes a lot of php code). Do you have any idea? Thanks you very much
1
4007
by: SkipNRun | last post by:
I am a novice when comes to JavaScript, AJAX. I am working on a form, which will allow users to update their contact information. In order to make the form flexible, I need to use pull down list. Depends on the pull down list selection, I use script.aculo.us to validate the user input before submit and pass the necessary data, such as contact type, contact information and ranking to a php program for updating. This form should allow multiple...
1
6469
by: FightClubDiego | last post by:
Hey.. I've been working on these sign up / log in forms for my new Game Site, and everything else in the game works but the registration!! I keep ketting the unexpected $end and Im tired of it! Here is the code... SOMEBODY PLEASE HELP ME!! I'm going crazy! haha <?php //This contains user stuffs switch($_GET) { case 'newuser': new_user_form(); break; case 'newusersub': new_user_submit(); break; case 'edituser': edit_user_begin(); break;...
68
11187
mideastgirl
by: mideastgirl | last post by:
I keep getting this error and I cannot figure it out. My curly brackets are closed, and I am using the correct tags for <?php to open and ?> to close my code. Can someone please help me! Here is my code: <?php //Connect To Database $hostname='mideasthonors2.db.4381361.hostedresource.com'; $username='**************'; $password='***********'; $dbname='mideasthonors2';
4
1884
by: kanishka1213 | last post by:
i am trying to make a script that recognizes all unparsed stream files from folder and runs an external tool in windows system to parse them. so far i am able to call that tool for all unparsed files. but after that we need to clcik "analyse" button in that tool. and after it analyse whole file for about 1 minute we need to click on "save " button i want to automate this .. means make a script that does click buttons on an external software...
3
5068
by: broll911 | last post by:
I am gettin a error message on this script can someone help me. I am a complete newbie on this stuff. Thanks in advance for any help you can give me. here is the error. Parse error: syntax error, unexpected T_VARIABLE in /home/content/m/i/x/mixxsalon/html/FormToEmail.php on line 1 here is the code. <?php $my_email = "user@example.com"; /*
0
10357
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
10162
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
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7509
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
5396
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
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2893
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.