Hi,
I succeeded in finding a workaround for the quotation bug in exec that
caused an error in the apache error logs. here it is:
exec('start "zip" /B "'.$winzip_path .'\wzzip" -m -s'.$password.'
"'.$tmp_new_nam e.'" "'.$tmp_old_nam e.'"');
But unfortunately, the /B switch doesn't do it's job, I still see the dos
box. Is there a way to suppress it?
I found the script that is posted below, but that doesn't wait for winzip to
finish. Is there any solution that I can run winzip without a dos box and
that php waits for winzip to finish?
Thank you, best regards,
-Hendri.
function windExec($cmd,$ mode=''){
// runs a command line and returns
// the output even for Wind XP SP2
// example: $cmd = "fullpath.e xe -arg1 -arg2"
// $outputString = windExec($cmd, "FG");
// OR windExec($cmd);
// (no output since it runs in BG by default)
// for output requires that EXEC_TMP_DIR be defined
// Setup the command to run from "run"
$cmdline = "cmd /C $cmd";
// set-up the output and mode
if ($mode=='FG'){
$outputfile = EXEC_TMP_DIR . "\\" . time() . ".txt";
$cmdline .= " $outputfile";
$m = true;
}
else $m = false;
// Make a new instance of the COM object
$WshShell = new COM("WScript.Sh ell");
// Make the command window but dont show it.
$oExec = $WshShell->Run($cmdline , 0, $m);
if ($outputfile){
// Read the tmp file.
$retStr = file_get_conten ts($outputfile) ;
// Delete the temp_file.
#unlink($output file);
}
else $retStr = "";
return $retStr;
} 2 5465
Hendri Adriaens wrote:
Hi,
I succeeded in finding a workaround for the quotation bug in exec that
caused an error in the apache error logs. here it is:
exec('start "zip" /B "'.$winzip_path .'\wzzip" -m -s'.$password.'
"'.$tmp_new_nam e.'" "'.$tmp_old_nam e.'"');
But unfortunately, the /B switch doesn't do it's job, I still see the dos
box. Is there a way to suppress it?
I found the script that is posted below, but that doesn't wait for winzip to
finish. Is there any solution that I can run winzip without a dos box and
that php waits for winzip to finish?
Thank you, best regards,
-Hendri.
function windExec($cmd,$ mode=''){
// runs a command line and returns
// the output even for Wind XP SP2
// example: $cmd = "fullpath.e xe -arg1 -arg2"
// $outputString = windExec($cmd, "FG");
// OR windExec($cmd);
// (no output since it runs in BG by default)
// for output requires that EXEC_TMP_DIR be defined
// Setup the command to run from "run"
$cmdline = "cmd /C $cmd";
// set-up the output and mode
if ($mode=='FG'){
$outputfile = EXEC_TMP_DIR . "\\" . time() . ".txt";
$cmdline .= " $outputfile";
$m = true;
}
else $m = false;
// Make a new instance of the COM object
$WshShell = new COM("WScript.Sh ell");
// Make the command window but dont show it.
$oExec = $WshShell->Run($cmdline , 0, $m);
if ($outputfile){
// Read the tmp file.
$retStr = file_get_conten ts($outputfile) ;
// Delete the temp_file.
#unlink($output file);
}
else $retStr = "";
return $retStr;
}
It's opening a command line prompt because you can't run a command line
program in a windowed session - at least not without some workarounds.
What you're running into is Windows limitations, not PHP. I'd recommend
you ask in a Windows newsgroup. Maybe they have some ideas - i.e. other
COM objects you could use.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
It's opening a command line prompt because you can't run a command line
program in a windowed session - at least not without some workarounds.
What you're running into is Windows limitations, not PHP. I'd recommend
you ask in a Windows newsgroup. Maybe they have some ideas - i.e. other
COM objects you could use.
Ok, thank you for the answer.
Best regards,
-Hendri. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andr? Roberge |
last post by:
I have the following two files:
#--testexec.py--
def exec_code(co):
try:
exec co
except:
print "error"
#-- test.py--
|
by: Jan |
last post by:
I store sql-commands in a database table. In the first step I get the
sql command out of the database table with embedded sql. In the second
step I try to execute the command, which i got from the database
table, using dynamic sql.
Executing 'EXEC SQL DESCRIBE SELECT LIST FOR S INTO select_dp;' the
error code -2149 is returned That means "Specified partition does not
exist".
Does anybody know if it is a database problem or a problem of
|
by: comp.lang.tcl |
last post by:
The TCL command I am using will do a command-line action on a PHP
script:
set cannotRunPHP
I have to do it this way as both the TCL script and the PHP script run
as CLI. However, "info.php" requires user input to run; this causes
the TCL script calling the PHP script to hose up and die.
Is there a way I can do this so that the TCL script can call the PHP
|
by: TPJ |
last post by:
I have the following code:
-----------------------------------
def f():
def g():
a = 'a' # marked line 1
exec 'a = "b"' in globals(), locals()
print "g: a =", a
|
by: xml0x1a |
last post by:
How do I use exec?
Python 2.4.3
----
from math import *
G = 1
def d():
L = 1
exec "def f(x): return L + log(G) " in globals(), locals()
f(1)
| |
by: JahMic |
last post by:
I'm having a problem with exec on my hosting server. Unfortunately,
the hosting support seems to be anything but helpful.
The following works fine on my localhost:
<?php
$MaskData = "mask.exe -e \"TestString\"";
$Result = exec($MaskData, $Output, $ReturnValue);
echo("Result: ".$Result);
|
by: Maarten |
last post by:
Howdy,
Recently I switched from a Windows PC to Mac OS-X 10.5 (php v5.2.6) and
I have a little problem with one function within my cd-management script.
For extracting a bit of info from my cd's I have an executable which I
execute with exec():
$discOutput = exec('./discid /dev/rdisk2');
|
by: Stef Mientki |
last post by:
hello,
I've syntax error which I totally don't understand:
########## mainfile :
import test_upframe2
if __name__ == '__main__':
var1 = 33
code = 'print var1 + 3 \n'
|
by: Terry Reedy |
last post by:
Stef Mientki wrote:
Indendation is screwed. Is the above all do_more body?
Which locals does this get you? __init__'s? (locals()?)
Isn't this just the same as globals()?
|
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...
|
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,...
| |
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...
|
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,...
|
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...
|
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...
|
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...
|
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();...
| |
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...
| |