473,606 Members | 2,825 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

syntax check on the command line

Hi!
It would be great if anyone could help me with this problem:
I want to check the syntax of my php code. Therefore I use the command
line function PHP -l, the structure is similar to the following code
(example from the php Manual.) The Problem is: I read from the standard
output with
echo stream_get_cont ents($pipes[1]);
this function is available only from PHP version 5, but I must write
for version 4.3.0. Which way could it be solved? I don't want to use a
temporary file. Please give me a hint.
Tanks, Karina
<?php
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will
read from
1 => array("pipe", "w"), // stdout is a pipe that the child will
write to
2 => array("file", "/tmp/error-output.txt", "a") // stderr is a file
to write to
);

$cwd = '/tmp';
$env = array('some_opt ion' => 'aeiou');

$process = proc_open('php' , $descriptorspec , $pipes, $cwd, $env);

if (is_resource($p rocess)) {
// $pipes now looks like this:
// 0 => writeable handle connected to child stdin
// 1 => readable handle connected to child stdout
// Any error output will be appended to /tmp/error-output.txt

fwrite($pipes[0], '<?php print_r($_ENV); ?>');
fclose($pipes[0]);

echo stream_get_cont ents($pipes[1]);
fclose($pipes[1]);

// It is important that you close any pipes before calling
// proc_close in order to avoid a deadlock
$return_value = proc_close($pro cess);

echo "command returned $return_value\n ";
}

?>

Jul 17 '05 #1
0 1908

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

Similar topics

1
2131
by: leegold2 | last post by:
Newbie question: In Perl I could do #perl -c myscript.pl and with that "-c" it won't run, but will just "compile" it, so I get all my syntax errors. Is there a similar thing in PHP? A way to catch my syntax errors before I actually run my program. Thanks, Lee G.
0
1812
by: Thiko | last post by:
Hi According to the official mysql manual: http://www.mysql.com/doc/en/Charset-SHOW-CHARSET.html The syntax to show all available character sets is the SHOW CHARACTER SET command. It takes an optional LIKE clause that indicates which character set names to match.
8
2070
by: Rich Grise | last post by:
I think I've finally found a tutorial that can get me started: http://www.zib.de/Visual/people/mueller/Course/Tutorial/tutorial.html and I've been lurking for awhile as well. What happened is, I've been playing with Qt in KDE on a Slackware 10.0 system, and following their cookbook exercises, and everything's working, and I have no clue what the code is doing, i.e.. how do I connect my brain to the ascii in the files to the stuff on...
2
4594
by: Rick Brown | last post by:
I'm trying to run code behind a command button from a command button on another form but get an error on this line. I figure I've got the syntax wrong for calling this command button? Whats the right syntax and/or can I call it directly without using the function. Form1 has a command button that calls the function: Call Send_Report_to_RTF The offending line is: Form_ReportChoices.CmdSave_to_RTF_Click
15
2116
by: Steve Jorgensen | last post by:
I'm looking for coding style opinions. It looks to me like most VB/VBA coders use the command-style syntax for calling subs or functions being treated as subs in a particular context ... Foo "ABC", varDest Occasionally, I see code using the Call syntax instead. Call Foo("ABC", varDest)
5
4491
by: r.nikhilk | last post by:
Hi, Currently, we are porting C++ applications from 32 bit to 64 bit on AIX platform. (The current version of AIX is 5.3 and xlC verison is 8.0). We are able to compile the applications by including the -q64 option in xlC compiler. And we are able to link all these libraries to one of the main applications and generate an executable. SKLoader. But, when we try to run this main executable, we are getting the following errors:
4
2463
by: chaitu | last post by:
Hi guys, I've written a parallel build program (in Perl) that takes a pre-computed dependency tree of many projects in 2 visual studio .net 2003 solution (.sln) files here at my company, and builds projects at a same level of dependency parallelly. While doing this, sometimes I get "Microsoft Visual Studio experienced some errors and needs to close" pop-up (which was gone after I disabled error-reporting for programs from Control...
4
1505
by: slinky | last post by:
I'm making a OLE DB connection in code and was wondering if anyone could identify what the syntax errors I have. I've tried countless combinations and all give errors. New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data & _ Source=" & Server.MapPath("~/App_Data/Lowes.mdb") & ";" & _ "Initial Catalog=Assets;Integrated Security=SSPI") Thanks!!
1
6243
by: karenkksh | last post by:
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'user'. Source Error: Line 35: MyAdapter1 = new SqlDataAdapter(MyCommand1); Line 36: MyDataSet1 = new DataSet(); Line 37: ...
0
7981
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8127
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6803
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
5994
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
3952
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
4011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2458
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
1
1574
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1315
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.