Issue in Integrating Perl with PHP for Windows
Posted: Wed Sep 15, 2010 2:19 am
Dear friends,
I am trying to Integrate the Perl (v5.8.6) code with PHP (5.3.0) for Windows.
Objective: I have developed a perl tool to validate a CD/DVD files and would like to present this tool to the user through our interanet webserver (PHP).
Issue: Perl couldn't take the PHP argument as input!
Details:
I have placed the lnk.exe (perl tool) in localhost and triggering this exe through the below <?php?> code:
and i have passing the CD/DVD path as input argument to the Perl tool.
---PHP code---
<?php
if(isset($_POST['flcheck'])){
$path = $_POST['filepath'];
$npath = substr($path, 0, (strlen ($path)) - (strlen (strrchr($path,'\\'))));
echo "<br/>";
echo "Removed file from path path -- ".$npath;
echo "<br/>";
$result = shell_exec("lnk.exe $npath");
echo ($result);
}
?>
<html>
<head>
<title>PHP with Perl</title>
</head>
<body>
<form name="val" method="post" onSubmit="">
<table width="100%" border="0">
<tr>
<td width="17%">Browse the input path:</td>
<td width="19%"><input name="filepath" type="file" class="grid" id="filepath" maxlength="1000" /></td>
<td width="64%"><input name="flcheck" type="submit" class="grid" id="flcheck" value="File check" /></td>
</tr>
</table>
</form>
</body>
</html>
I believe the lnk.exe has been triggered and the perl can not accepting the PHP argument as input. (refer the below output from perl—when am ran the lnk.exe manually its working fine)
---PHP output---
Removed file from path path -- E:\EBook+\Development\Pearson_ebook_CD\Observatoire_4e
Error in input argument: E:\EBook+\Development\Pearson_ebook_CD\Observatoire_4e
Please try with correct input!
Any help appreciated!
Thanks in Advance,
Thirilog
I am trying to Integrate the Perl (v5.8.6) code with PHP (5.3.0) for Windows.
Objective: I have developed a perl tool to validate a CD/DVD files and would like to present this tool to the user through our interanet webserver (PHP).
Issue: Perl couldn't take the PHP argument as input!
Details:
I have placed the lnk.exe (perl tool) in localhost and triggering this exe through the below <?php?> code:
and i have passing the CD/DVD path as input argument to the Perl tool.
---PHP code---
<?php
if(isset($_POST['flcheck'])){
$path = $_POST['filepath'];
$npath = substr($path, 0, (strlen ($path)) - (strlen (strrchr($path,'\\'))));
echo "<br/>";
echo "Removed file from path path -- ".$npath;
echo "<br/>";
$result = shell_exec("lnk.exe $npath");
echo ($result);
}
?>
<html>
<head>
<title>PHP with Perl</title>
</head>
<body>
<form name="val" method="post" onSubmit="">
<table width="100%" border="0">
<tr>
<td width="17%">Browse the input path:</td>
<td width="19%"><input name="filepath" type="file" class="grid" id="filepath" maxlength="1000" /></td>
<td width="64%"><input name="flcheck" type="submit" class="grid" id="flcheck" value="File check" /></td>
</tr>
</table>
</form>
</body>
</html>
I believe the lnk.exe has been triggered and the perl can not accepting the PHP argument as input. (refer the below output from perl—when am ran the lnk.exe manually its working fine)
---PHP output---
Removed file from path path -- E:\EBook+\Development\Pearson_ebook_CD\Observatoire_4e
Error in input argument: E:\EBook+\Development\Pearson_ebook_CD\Observatoire_4e
Please try with correct input!
Any help appreciated!
Thanks in Advance,
Thirilog