Re: [PHP] Re: Problems with exec() on windows

2009-03-20 Thread Shawn McKenzie
Kyohere Luke wrote:
> You might have something there - never really thought about how windows
> forms the 8.3 names... & not many resources online about it ...
> 
> The actual path is "c:\Program File\Gammu 1.23.91\bin\gammu.exe"
> I'd used "c:\Progra~1\Gammu~1\bin\gammu.exe"

You take the first 6 characters (ignoring spaces) and then add a tilde ~
and a number.  The number will increment for another directory
alphabetically after the one with the 1 if it reduces to the same 6
characters and so on.

Yours would most likely be: c:\Progra~1\Gammu1~1\bin\gammu.exe


Unless some other directory is alphabetically before one of those and
reduces to the same 6 characters.  For example if you have a c:\Program
or a c:\Program File\Gammu 1.111

I'm pretty sure the dir command will show you the 8.3 name.

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Re: Problems with exec() on windows

2009-03-20 Thread bruce
when dealing with windows.. or any file/pathname.. you can't simply
quote/double quote the name using the "~" symbol as well..

haven't done it for awhile.. but i believe you need to explode/derive the
complete path/filename and then quote/double quote it for use by the app...



-Original Message-
From: l...@beyonic.com [mailto:l...@beyonic.com]on Behalf Of Kyohere
Luke
Sent: Thursday, March 19, 2009 11:48 PM
To: Shawn McKenzie
Cc: php-general@lists.php.net
Subject: Re: [PHP] Re: Problems with exec() on windows


You might have something there - never really thought about how windows
forms the 8.3 names... & not many resources online about it ...

The actual path is "c:\Program File\Gammu 1.23.91\bin\gammu.exe"
I'd used "c:\Progra~1\Gammu~1\bin\gammu.exe"

Luke

On Thu, Mar 19, 2009 at 8:57 PM, Shawn McKenzie wrote:

> Kyohere Luke wrote:
> > Hi,
> >
> > Tried all that - it'd work well until one of the arguments also had
> spaces
> > and thus had "" or '' encapsulating it - this weirdness is the reason
for
> > this post.
> > Shawn, even the good old "C:\pathwi~1\gammu.exe" failed :-(
>
> Well, you didn't do it properly then.  What is the actual path?
>
> >
> > The only way I've gotten it to work was to get rid of the spaces in the
> > path/to/exe.
> >
> > Luke.
> >
> > On Thu, Mar 19, 2009 at 8:24 PM, bruce  wrote:
> >
> >> hey...
> >>
> >> if you're going to deal with file/pathnames in windows/linux.. you're
> going
> >> to have to encapsulate them with "" or with '' ie double/single
> quotes...
> >>
> >>
> >>
> >> -Original Message-
> >> From: Kyohere Luke [mailto:l...@beyonic.com]
> >> Sent: Thursday, March 19, 2009 10:18 AM
> >> To: Bastien Koert
> >> Cc: Shawn McKenzie; php-general@lists.php.net
> >> Subject: Re: [PHP] Re: Problems with exec() on windows
> >>
> >>
> >> Eventually settled for getting rid of the spaces in the path. That
> worked.
> >> Thanks.
> >> Luke
> >>
> >> On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert 
> wrote:
> >>
> >>>
> >>> On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke 
> wrote:
> >>>
> >>>> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe
> has
> >>>> spaces in it
> >>>> Haliphax, thanks for your comments. I tried escapeshellarg() to no
> end.
> >>>>
> >>>> I'm exploring your reply regarding proc_open, but how exactly does
> >>>> proc_open
> >>>> separate the arguments from the command?
> >>>>
> >>>> Unless i'm mistaken, data written to the process's stdin (for the
> other
> >>>> process) is not treated like an argument.
> >>>>
> >>>> If I add the arguments to the process name/path? I'm back to square
> one.
> >>>>
> >>>> Luke.
> >>>>
> >>>> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie  >>>>> wrote:
> >>>>> Kyohere Luke wrote:
> >>>>>> Hi,
> >>>>>> I'm trying to use exec to call gammu.exe and send sms on windows
XP.
> >>>>>>
> >>>>>> This works from commandline:
> >>>>>>
> >>>>>> C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
> >>>>>>
> >>>>>> But if I run it through php like this:
> >>>>>>
> >>>>>> $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text
\"test1
> >>>>>> test2\"".;
> >>>>>> @exec($command, $response, $retval);
> >>>>>>
> >>>>>> This always fails, returns 1 and the response is empty.
> >>>>>>
> >>>>>> If the last argument is a string with no spaces, and the double
> >> quotes
> >>>>> were
> >>>>>> omitted, it works perfectly.
> >>>>>>
> >>>>>> If the double quotes are added around the string with no spaces, it
> >>>> fails
> >>>>>> again, which makes me believe that the problem is with the double
> >>>> quotes.
> >>>>>> I've used procmon and it shows that when the double quotes are
added
> >>>>> around
> >>>>>> the last argument, gammu.exe is not even called at all.
> >>>>>>
> >>>>>> Problem is that the double quotes are required by gammu to send an
> >> sms
> >>>>> with
> >>>>>> spaces in it.
> >>>>>>
> >>>>>> Any ideas? :-(
> >>>>>>
> >>>>>> Luke
> >>>>>>
> >>>>> Why not try:
> >>>>>
> >>>>> $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1
> >> test2"';
> >>>>> --
> >>>>> Thanks!
> >>>>> -Shawn
> >>>>> http://www.spidean.com
> >>>>>
> >>>>> --
> >>>>> PHP General Mailing List (http://www.php.net/)
> >>>>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>>>
> >>>>>
> >>> try double slashes for the path and wrap the pathin quotes if there
are
> >>> spaces in it. Or if possible get rid of the spaces in the folder names
> >>>
> >>> --
> >>>
> >>> Bastien
> >>>
> >>> Cat, the other other white meat
> >>>
> >>
> >
>
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Problems with exec() on windows

2009-03-20 Thread George Larson
I've skimmed some of thread, but I have not been following closely so please
disregard if I'm just rambling.  However, I've worked with lots of software
on DOS boxen that couldn't handle long file names.  If they also choke on
the tildes then I usually just write a batch file that calls the full path
and file with whatever command line parameters I pass to the batch.

For example:
---

@echo off
C:\"Program Files\Mozilla Firefox\firefox.exe" %1 %2 %3

---
HTH,
G

On Fri, Mar 20, 2009 at 9:26 AM, haliphax  wrote:

> On Fri, Mar 20, 2009 at 1:47 AM, Kyohere Luke  wrote:
> > You might have something there - never really thought about how windows
> > forms the 8.3 names... & not many resources online about it ...
> >
> > The actual path is "c:\Program File\Gammu 1.23.91\bin\gammu.exe"
> > I'd used "c:\Progra~1\Gammu~1\bin\gammu.exe"
>
> You should be able to view these truncated path names via the "dir"
> command in a CMD.EXE command line. I say this because "Program Files"
> and "Programs" would collide with each other (just as an example); one
> would be Progra~1 and one would be Progra~2.
>
>
> --
> // Todd
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Re: Problems with exec() on windows

2009-03-20 Thread haliphax
On Fri, Mar 20, 2009 at 1:47 AM, Kyohere Luke  wrote:
> You might have something there - never really thought about how windows
> forms the 8.3 names... & not many resources online about it ...
>
> The actual path is "c:\Program File\Gammu 1.23.91\bin\gammu.exe"
> I'd used "c:\Progra~1\Gammu~1\bin\gammu.exe"

You should be able to view these truncated path names via the "dir"
command in a CMD.EXE command line. I say this because "Program Files"
and "Programs" would collide with each other (just as an example); one
would be Progra~1 and one would be Progra~2.


-- 
// Todd

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
You might have something there - never really thought about how windows
forms the 8.3 names... & not many resources online about it ...

The actual path is "c:\Program File\Gammu 1.23.91\bin\gammu.exe"
I'd used "c:\Progra~1\Gammu~1\bin\gammu.exe"

Luke

On Thu, Mar 19, 2009 at 8:57 PM, Shawn McKenzie wrote:

> Kyohere Luke wrote:
> > Hi,
> >
> > Tried all that - it'd work well until one of the arguments also had
> spaces
> > and thus had "" or '' encapsulating it - this weirdness is the reason for
> > this post.
> > Shawn, even the good old "C:\pathwi~1\gammu.exe" failed :-(
>
> Well, you didn't do it properly then.  What is the actual path?
>
> >
> > The only way I've gotten it to work was to get rid of the spaces in the
> > path/to/exe.
> >
> > Luke.
> >
> > On Thu, Mar 19, 2009 at 8:24 PM, bruce  wrote:
> >
> >> hey...
> >>
> >> if you're going to deal with file/pathnames in windows/linux.. you're
> going
> >> to have to encapsulate them with "" or with '' ie double/single
> quotes...
> >>
> >>
> >>
> >> -Original Message-
> >> From: Kyohere Luke [mailto:l...@beyonic.com]
> >> Sent: Thursday, March 19, 2009 10:18 AM
> >> To: Bastien Koert
> >> Cc: Shawn McKenzie; php-general@lists.php.net
> >> Subject: Re: [PHP] Re: Problems with exec() on windows
> >>
> >>
> >> Eventually settled for getting rid of the spaces in the path. That
> worked.
> >> Thanks.
> >> Luke
> >>
> >> On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert 
> wrote:
> >>
> >>>
> >>> On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke 
> wrote:
> >>>
> >>>> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe
> has
> >>>> spaces in it
> >>>> Haliphax, thanks for your comments. I tried escapeshellarg() to no
> end.
> >>>>
> >>>> I'm exploring your reply regarding proc_open, but how exactly does
> >>>> proc_open
> >>>> separate the arguments from the command?
> >>>>
> >>>> Unless i'm mistaken, data written to the process's stdin (for the
> other
> >>>> process) is not treated like an argument.
> >>>>
> >>>> If I add the arguments to the process name/path? I'm back to square
> one.
> >>>>
> >>>> Luke.
> >>>>
> >>>> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie  >>>>> wrote:
> >>>>> Kyohere Luke wrote:
> >>>>>> Hi,
> >>>>>> I'm trying to use exec to call gammu.exe and send sms on windows XP.
> >>>>>>
> >>>>>> This works from commandline:
> >>>>>>
> >>>>>> C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
> >>>>>>
> >>>>>> But if I run it through php like this:
> >>>>>>
> >>>>>> $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
> >>>>>> test2\"".;
> >>>>>> @exec($command, $response, $retval);
> >>>>>>
> >>>>>> This always fails, returns 1 and the response is empty.
> >>>>>>
> >>>>>> If the last argument is a string with no spaces, and the double
> >> quotes
> >>>>> were
> >>>>>> omitted, it works perfectly.
> >>>>>>
> >>>>>> If the double quotes are added around the string with no spaces, it
> >>>> fails
> >>>>>> again, which makes me believe that the problem is with the double
> >>>> quotes.
> >>>>>> I've used procmon and it shows that when the double quotes are added
> >>>>> around
> >>>>>> the last argument, gammu.exe is not even called at all.
> >>>>>>
> >>>>>> Problem is that the double quotes are required by gammu to send an
> >> sms
> >>>>> with
> >>>>>> spaces in it.
> >>>>>>
> >>>>>> Any ideas? :-(
> >>>>>>
> >>>>>> Luke
> >>>>>>
> >>>>> Why not try:
> >>>>>
> >>>>> $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1
> >> test2"';
> >>>>> --
> >>>>> Thanks!
> >>>>> -Shawn
> >>>>> http://www.spidean.com
> >>>>>
> >>>>> --
> >>>>> PHP General Mailing List (http://www.php.net/)
> >>>>> To unsubscribe, visit: http://www.php.net/unsub.php
> >>>>>
> >>>>>
> >>> try double slashes for the path and wrap the pathin quotes if there are
> >>> spaces in it. Or if possible get rid of the spaces in the folder names
> >>>
> >>> --
> >>>
> >>> Bastien
> >>>
> >>> Cat, the other other white meat
> >>>
> >>
> >
>
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Frank Stanovcak

"Kyohere Luke"  wrote in message 
news:9bc423c50903191018k3c783213l4929cf2878e98...@mail.gmail.com...
> Eventually settled for getting rid of the spaces in the path. That worked.
> Thanks.
> Luke
>
> On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert  wrote:
>
>>
>>
>> On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke  wrote:
>>
>>> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
>>> spaces in it
>>> Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
>>>
>>> I'm exploring your reply regarding proc_open, but how exactly does
>>> proc_open
>>> separate the arguments from the command?
>>>
>>> Unless i'm mistaken, data written to the process's stdin (for the other
>>> process) is not treated like an argument.
>>>
>>> If I add the arguments to the process name/path? I'm back to square one.
>>>
>>> Luke.
>>>
>>> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie >> >wrote:
>>>
>>> > Kyohere Luke wrote:
>>> > > Hi,
>>> > > I'm trying to use exec to call gammu.exe and send sms on windows XP.
>>> > >
>>> > > This works from commandline:
>>> > >
>>> > > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
>>> > >
>>> > > But if I run it through php like this:
>>> > >
>>> > > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
>>> > > test2\"".;
>>> > > @exec($command, $response, $retval);
>>> > >
>>> > > This always fails, returns 1 and the response is empty.
>>> > >
>>> > > If the last argument is a string with no spaces, and the double 
>>> > > quotes
>>> > were
>>> > > omitted, it works perfectly.
>>> > >
>>> > > If the double quotes are added around the string with no spaces, it
>>> fails
>>> > > again, which makes me believe that the problem is with the double
>>> quotes.
>>> > >
>>> > > I've used procmon and it shows that when the double quotes are added
>>> > around
>>> > > the last argument, gammu.exe is not even called at all.
>>> > >
>>> > > Problem is that the double quotes are required by gammu to send an 
>>> > > sms
>>> > with
>>> > > spaces in it.
>>> > >
>>> > > Any ideas? :-(
>>> > >
>>> > > Luke
>>> > >
>>> >
>>> > Why not try:
>>> >
>>> > $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1 
>>> > test2"';
>>> >
>>> > --
>>> > Thanks!
>>> > -Shawn
>>> > http://www.spidean.com
>>> >
>>> > --
>>> > PHP General Mailing List (http://www.php.net/)
>>> > To unsubscribe, visit: http://www.php.net/unsub.php
>>> >
>>> >
>>>
>>
>> try double slashes for the path and wrap the pathin quotes if there are
>> spaces in it. Or if possible get rid of the spaces in the folder names
>>
>> --
>>
>> Bastien
>>
>> Cat, the other other white meat
>>
>

Rule of thumb.  Since PHP is for web access try to avoid spaces in any 
folder names you will be making accessable through either the site or php 
references.  It makes life much much easier.


Frank.  Back from his binge drinking, and School applications after his 
layoff. 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Shawn McKenzie
Kyohere Luke wrote:
> Hi,
> 
> Tried all that - it'd work well until one of the arguments also had spaces
> and thus had "" or '' encapsulating it - this weirdness is the reason for
> this post.
> Shawn, even the good old "C:\pathwi~1\gammu.exe" failed :-(

Well, you didn't do it properly then.  What is the actual path?

> 
> The only way I've gotten it to work was to get rid of the spaces in the
> path/to/exe.
> 
> Luke.
> 
> On Thu, Mar 19, 2009 at 8:24 PM, bruce  wrote:
> 
>> hey...
>>
>> if you're going to deal with file/pathnames in windows/linux.. you're going
>> to have to encapsulate them with "" or with '' ie double/single quotes...
>>
>>
>>
>> -Original Message-
>> From: Kyohere Luke [mailto:l...@beyonic.com]
>> Sent: Thursday, March 19, 2009 10:18 AM
>> To: Bastien Koert
>> Cc: Shawn McKenzie; php-general@lists.php.net
>> Subject: Re: [PHP] Re: Problems with exec() on windows
>>
>>
>> Eventually settled for getting rid of the spaces in the path. That worked.
>> Thanks.
>> Luke
>>
>> On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert  wrote:
>>
>>>
>>> On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke  wrote:
>>>
>>>> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
>>>> spaces in it
>>>> Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
>>>>
>>>> I'm exploring your reply regarding proc_open, but how exactly does
>>>> proc_open
>>>> separate the arguments from the command?
>>>>
>>>> Unless i'm mistaken, data written to the process's stdin (for the other
>>>> process) is not treated like an argument.
>>>>
>>>> If I add the arguments to the process name/path? I'm back to square one.
>>>>
>>>> Luke.
>>>>
>>>> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie >>>> wrote:
>>>>> Kyohere Luke wrote:
>>>>>> Hi,
>>>>>> I'm trying to use exec to call gammu.exe and send sms on windows XP.
>>>>>>
>>>>>> This works from commandline:
>>>>>>
>>>>>> C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
>>>>>>
>>>>>> But if I run it through php like this:
>>>>>>
>>>>>> $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
>>>>>> test2\"".;
>>>>>> @exec($command, $response, $retval);
>>>>>>
>>>>>> This always fails, returns 1 and the response is empty.
>>>>>>
>>>>>> If the last argument is a string with no spaces, and the double
>> quotes
>>>>> were
>>>>>> omitted, it works perfectly.
>>>>>>
>>>>>> If the double quotes are added around the string with no spaces, it
>>>> fails
>>>>>> again, which makes me believe that the problem is with the double
>>>> quotes.
>>>>>> I've used procmon and it shows that when the double quotes are added
>>>>> around
>>>>>> the last argument, gammu.exe is not even called at all.
>>>>>>
>>>>>> Problem is that the double quotes are required by gammu to send an
>> sms
>>>>> with
>>>>>> spaces in it.
>>>>>>
>>>>>> Any ideas? :-(
>>>>>>
>>>>>> Luke
>>>>>>
>>>>> Why not try:
>>>>>
>>>>> $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1
>> test2"';
>>>>> --
>>>>> Thanks!
>>>>> -Shawn
>>>>> http://www.spidean.com
>>>>>
>>>>> --
>>>>> PHP General Mailing List (http://www.php.net/)
>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>
>>>>>
>>> try double slashes for the path and wrap the pathin quotes if there are
>>> spaces in it. Or if possible get rid of the spaces in the folder names
>>>
>>> --
>>>
>>> Bastien
>>>
>>> Cat, the other other white meat
>>>
>>
> 


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Hi,

Tried all that - it'd work well until one of the arguments also had spaces
and thus had "" or '' encapsulating it - this weirdness is the reason for
this post.
Shawn, even the good old "C:\pathwi~1\gammu.exe" failed :-(

The only way I've gotten it to work was to get rid of the spaces in the
path/to/exe.

Luke

On Thu, Mar 19, 2009 at 8:24 PM, bruce  wrote:

> hey...
>
> if you're going to deal with file/pathnames in windows/linux.. you're going
> to have to encapsulate them with "" or with '' ie double/single quotes...
>
>
>
> -Original Message-
> From: Kyohere Luke [mailto:l...@beyonic.com]
> Sent: Thursday, March 19, 2009 10:18 AM
> To: Bastien Koert
> Cc: Shawn McKenzie; php-general@lists.php.net
> Subject: Re: [PHP] Re: Problems with exec() on windows
>
>
> Eventually settled for getting rid of the spaces in the path. That worked.
> Thanks.
> Luke
>
> On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert  wrote:
>
> >
> >
> > On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke  wrote:
> >
> >> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
> >> spaces in it
> >> Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
> >>
> >> I'm exploring your reply regarding proc_open, but how exactly does
> >> proc_open
> >> separate the arguments from the command?
> >>
> >> Unless i'm mistaken, data written to the process's stdin (for the other
> >> process) is not treated like an argument.
> >>
> >> If I add the arguments to the process name/path? I'm back to square one.
> >>
> >> Luke.
> >>
> >> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie  >> >wrote:
> >>
> >> > Kyohere Luke wrote:
> >> > > Hi,
> >> > > I'm trying to use exec to call gammu.exe and send sms on windows XP.
> >> > >
> >> > > This works from commandline:
> >> > >
> >> > > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
> >> > >
> >> > > But if I run it through php like this:
> >> > >
> >> > > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
> >> > > test2\"".;
> >> > > @exec($command, $response, $retval);
> >> > >
> >> > > This always fails, returns 1 and the response is empty.
> >> > >
> >> > > If the last argument is a string with no spaces, and the double
> quotes
> >> > were
> >> > > omitted, it works perfectly.
> >> > >
> >> > > If the double quotes are added around the string with no spaces, it
> >> fails
> >> > > again, which makes me believe that the problem is with the double
> >> quotes.
> >> > >
> >> > > I've used procmon and it shows that when the double quotes are added
> >> > around
> >> > > the last argument, gammu.exe is not even called at all.
> >> > >
> >> > > Problem is that the double quotes are required by gammu to send an
> sms
> >> > with
> >> > > spaces in it.
> >> > >
> >> > > Any ideas? :-(
> >> > >
> >> > > Luke
> >> > >
> >> >
> >> > Why not try:
> >> >
> >> > $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1
> test2"';
> >> >
> >> > --
> >> > Thanks!
> >> > -Shawn
> >> > http://www.spidean.com
> >> >
> >> > --
> >> > PHP General Mailing List (http://www.php.net/)
> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >
> >> >
> >>
> >
> > try double slashes for the path and wrap the pathin quotes if there are
> > spaces in it. Or if possible get rid of the spaces in the folder names
> >
> > --
> >
> > Bastien
> >
> > Cat, the other other white meat
> >
>
>


Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Hi,

Tried all that - it'd work well until one of the arguments also had spaces
and thus had "" or '' encapsulating it - this weirdness is the reason for
this post.
Shawn, even the good old "C:\pathwi~1\gammu.exe" failed :-(

The only way I've gotten it to work was to get rid of the spaces in the
path/to/exe.

Luke.

On Thu, Mar 19, 2009 at 8:24 PM, bruce  wrote:

> hey...
>
> if you're going to deal with file/pathnames in windows/linux.. you're going
> to have to encapsulate them with "" or with '' ie double/single quotes...
>
>
>
> -Original Message-
> From: Kyohere Luke [mailto:l...@beyonic.com]
> Sent: Thursday, March 19, 2009 10:18 AM
> To: Bastien Koert
> Cc: Shawn McKenzie; php-general@lists.php.net
> Subject: Re: [PHP] Re: Problems with exec() on windows
>
>
> Eventually settled for getting rid of the spaces in the path. That worked.
> Thanks.
> Luke
>
> On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert  wrote:
>
> >
> >
> > On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke  wrote:
> >
> >> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
> >> spaces in it
> >> Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
> >>
> >> I'm exploring your reply regarding proc_open, but how exactly does
> >> proc_open
> >> separate the arguments from the command?
> >>
> >> Unless i'm mistaken, data written to the process's stdin (for the other
> >> process) is not treated like an argument.
> >>
> >> If I add the arguments to the process name/path? I'm back to square one.
> >>
> >> Luke.
> >>
> >> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie  >> >wrote:
> >>
> >> > Kyohere Luke wrote:
> >> > > Hi,
> >> > > I'm trying to use exec to call gammu.exe and send sms on windows XP.
> >> > >
> >> > > This works from commandline:
> >> > >
> >> > > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
> >> > >
> >> > > But if I run it through php like this:
> >> > >
> >> > > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
> >> > > test2\"".;
> >> > > @exec($command, $response, $retval);
> >> > >
> >> > > This always fails, returns 1 and the response is empty.
> >> > >
> >> > > If the last argument is a string with no spaces, and the double
> quotes
> >> > were
> >> > > omitted, it works perfectly.
> >> > >
> >> > > If the double quotes are added around the string with no spaces, it
> >> fails
> >> > > again, which makes me believe that the problem is with the double
> >> quotes.
> >> > >
> >> > > I've used procmon and it shows that when the double quotes are added
> >> > around
> >> > > the last argument, gammu.exe is not even called at all.
> >> > >
> >> > > Problem is that the double quotes are required by gammu to send an
> sms
> >> > with
> >> > > spaces in it.
> >> > >
> >> > > Any ideas? :-(
> >> > >
> >> > > Luke
> >> > >
> >> >
> >> > Why not try:
> >> >
> >> > $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1
> test2"';
> >> >
> >> > --
> >> > Thanks!
> >> > -Shawn
> >> > http://www.spidean.com
> >> >
> >> > --
> >> > PHP General Mailing List (http://www.php.net/)
> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >
> >> >
> >>
> >
> > try double slashes for the path and wrap the pathin quotes if there are
> > spaces in it. Or if possible get rid of the spaces in the folder names
> >
> > --
> >
> > Bastien
> >
> > Cat, the other other white meat
> >
>
>


RE: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread bruce
hey...

if you're going to deal with file/pathnames in windows/linux.. you're going
to have to encapsulate them with "" or with '' ie double/single quotes...



-Original Message-
From: Kyohere Luke [mailto:l...@beyonic.com]
Sent: Thursday, March 19, 2009 10:18 AM
To: Bastien Koert
Cc: Shawn McKenzie; php-general@lists.php.net
Subject: Re: [PHP] Re: Problems with exec() on windows


Eventually settled for getting rid of the spaces in the path. That worked.
Thanks.
Luke

On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert  wrote:

>
>
> On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke  wrote:
>
>> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
>> spaces in it
>> Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
>>
>> I'm exploring your reply regarding proc_open, but how exactly does
>> proc_open
>> separate the arguments from the command?
>>
>> Unless i'm mistaken, data written to the process's stdin (for the other
>> process) is not treated like an argument.
>>
>> If I add the arguments to the process name/path? I'm back to square one.
>>
>> Luke.
>>
>> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie > >wrote:
>>
>> > Kyohere Luke wrote:
>> > > Hi,
>> > > I'm trying to use exec to call gammu.exe and send sms on windows XP.
>> > >
>> > > This works from commandline:
>> > >
>> > > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
>> > >
>> > > But if I run it through php like this:
>> > >
>> > > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
>> > > test2\"".;
>> > > @exec($command, $response, $retval);
>> > >
>> > > This always fails, returns 1 and the response is empty.
>> > >
>> > > If the last argument is a string with no spaces, and the double
quotes
>> > were
>> > > omitted, it works perfectly.
>> > >
>> > > If the double quotes are added around the string with no spaces, it
>> fails
>> > > again, which makes me believe that the problem is with the double
>> quotes.
>> > >
>> > > I've used procmon and it shows that when the double quotes are added
>> > around
>> > > the last argument, gammu.exe is not even called at all.
>> > >
>> > > Problem is that the double quotes are required by gammu to send an
sms
>> > with
>> > > spaces in it.
>> > >
>> > > Any ideas? :-(
>> > >
>> > > Luke
>> > >
>> >
>> > Why not try:
>> >
>> > $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1
test2"';
>> >
>> > --
>> > Thanks!
>> > -Shawn
>> > http://www.spidean.com
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>
> try double slashes for the path and wrap the pathin quotes if there are
> spaces in it. Or if possible get rid of the spaces in the folder names
>
> --
>
> Bastien
>
> Cat, the other other white meat
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Eventually settled for getting rid of the spaces in the path. That worked.
Thanks.
Luke

On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert  wrote:

>
>
> On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke  wrote:
>
>> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
>> spaces in it
>> Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
>>
>> I'm exploring your reply regarding proc_open, but how exactly does
>> proc_open
>> separate the arguments from the command?
>>
>> Unless i'm mistaken, data written to the process's stdin (for the other
>> process) is not treated like an argument.
>>
>> If I add the arguments to the process name/path? I'm back to square one.
>>
>> Luke.
>>
>> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie > >wrote:
>>
>> > Kyohere Luke wrote:
>> > > Hi,
>> > > I'm trying to use exec to call gammu.exe and send sms on windows XP.
>> > >
>> > > This works from commandline:
>> > >
>> > > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
>> > >
>> > > But if I run it through php like this:
>> > >
>> > > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
>> > > test2\"".;
>> > > @exec($command, $response, $retval);
>> > >
>> > > This always fails, returns 1 and the response is empty.
>> > >
>> > > If the last argument is a string with no spaces, and the double quotes
>> > were
>> > > omitted, it works perfectly.
>> > >
>> > > If the double quotes are added around the string with no spaces, it
>> fails
>> > > again, which makes me believe that the problem is with the double
>> quotes.
>> > >
>> > > I've used procmon and it shows that when the double quotes are added
>> > around
>> > > the last argument, gammu.exe is not even called at all.
>> > >
>> > > Problem is that the double quotes are required by gammu to send an sms
>> > with
>> > > spaces in it.
>> > >
>> > > Any ideas? :-(
>> > >
>> > > Luke
>> > >
>> >
>> > Why not try:
>> >
>> > $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1 test2"';
>> >
>> > --
>> > Thanks!
>> > -Shawn
>> > http://www.spidean.com
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>
> try double slashes for the path and wrap the pathin quotes if there are
> spaces in it. Or if possible get rid of the spaces in the folder names
>
> --
>
> Bastien
>
> Cat, the other other white meat
>


Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Shawn McKenzie
Kyohere Luke wrote:
> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
> spaces in it
> Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
> 
> I'm exploring your reply regarding proc_open, but how exactly does proc_open
> separate the arguments from the command?
> 
> Unless i'm mistaken, data written to the process's stdin (for the other
> process) is not treated like an argument.
> 
> If I add the arguments to the process name/path? I'm back to square one.
> 
> Luke
> 
Well, I don't think you stated that at first, on the text message had
spaces.  Try:

$command = '"C:\path with spaces\gammu.exe" --sendsms EMS 200 -text
"test1 test2"';

If not, you can use the good old:

$command = 'C:\pathwi~1\gammu.exe --sendsms EMS 200 -text "test1 test2"';


-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Eventually settled for getting rid of the spaces in the path. That worked.
Thanks.
Luke

On Thu, Mar 19, 2009 at 8:06 PM, Bastien Koert  wrote:

>
>
> On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke  wrote:
>
>> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
>> spaces in it
>> Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
>>
>> I'm exploring your reply regarding proc_open, but how exactly does
>> proc_open
>> separate the arguments from the command?
>>
>> Unless i'm mistaken, data written to the process's stdin (for the other
>> process) is not treated like an argument.
>>
>> If I add the arguments to the process name/path? I'm back to square one.
>>
>> Luke.
>>
>> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie > >wrote:
>>
>> > Kyohere Luke wrote:
>> > > Hi,
>> > > I'm trying to use exec to call gammu.exe and send sms on windows XP.
>> > >
>> > > This works from commandline:
>> > >
>> > > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
>> > >
>> > > But if I run it through php like this:
>> > >
>> > > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
>> > > test2\"".;
>> > > @exec($command, $response, $retval);
>> > >
>> > > This always fails, returns 1 and the response is empty.
>> > >
>> > > If the last argument is a string with no spaces, and the double quotes
>> > were
>> > > omitted, it works perfectly.
>> > >
>> > > If the double quotes are added around the string with no spaces, it
>> fails
>> > > again, which makes me believe that the problem is with the double
>> quotes.
>> > >
>> > > I've used procmon and it shows that when the double quotes are added
>> > around
>> > > the last argument, gammu.exe is not even called at all.
>> > >
>> > > Problem is that the double quotes are required by gammu to send an sms
>> > with
>> > > spaces in it.
>> > >
>> > > Any ideas? :-(
>> > >
>> > > Luke
>> > >
>> >
>> > Why not try:
>> >
>> > $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1 test2"';
>> >
>> > --
>> > Thanks!
>> > -Shawn
>> > http://www.spidean.com
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>
> try double slashes for the path and wrap the pathin quotes if there are
> spaces in it. Or if possible get rid of the spaces in the folder names
>
> --
>
> Bastien
>
> Cat, the other other white meat
>


Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Bastien Koert
On Thu, Mar 19, 2009 at 12:48 PM, Kyohere Luke  wrote:

> Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
> spaces in it
> Haliphax, thanks for your comments. I tried escapeshellarg() to no end.
>
> I'm exploring your reply regarding proc_open, but how exactly does
> proc_open
> separate the arguments from the command?
>
> Unless i'm mistaken, data written to the process's stdin (for the other
> process) is not treated like an argument.
>
> If I add the arguments to the process name/path? I'm back to square one.
>
> Luke.
>
> On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie  >wrote:
>
> > Kyohere Luke wrote:
> > > Hi,
> > > I'm trying to use exec to call gammu.exe and send sms on windows XP.
> > >
> > > This works from commandline:
> > >
> > > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
> > >
> > > But if I run it through php like this:
> > >
> > > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
> > > test2\"".;
> > > @exec($command, $response, $retval);
> > >
> > > This always fails, returns 1 and the response is empty.
> > >
> > > If the last argument is a string with no spaces, and the double quotes
> > were
> > > omitted, it works perfectly.
> > >
> > > If the double quotes are added around the string with no spaces, it
> fails
> > > again, which makes me believe that the problem is with the double
> quotes.
> > >
> > > I've used procmon and it shows that when the double quotes are added
> > around
> > > the last argument, gammu.exe is not even called at all.
> > >
> > > Problem is that the double quotes are required by gammu to send an sms
> > with
> > > spaces in it.
> > >
> > > Any ideas? :-(
> > >
> > > Luke
> > >
> >
> > Why not try:
> >
> > $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1 test2"';
> >
> > --
> > Thanks!
> > -Shawn
> > http://www.spidean.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

try double slashes for the path and wrap the pathin quotes if there are
spaces in it. Or if possible get rid of the spaces in the folder names

-- 

Bastien

Cat, the other other white meat


Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
spaces in it
Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

I'm exploring your reply regarding proc_open, but how exactly does proc_open
separate the arguments from the command?

Unless i'm mistaken, data written to the process's stdin (for the other
process) is not treated like an argument.

If I add the arguments to the process name/path? I'm back to square one.

Luke

On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie wrote:

> Kyohere Luke wrote:
> > Hi,
> > I'm trying to use exec to call gammu.exe and send sms on windows XP.
> >
> > This works from commandline:
> >
> > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
> >
> > But if I run it through php like this:
> >
> > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
> > test2\"".;
> > @exec($command, $response, $retval);
> >
> > This always fails, returns 1 and the response is empty.
> >
> > If the last argument is a string with no spaces, and the double quotes
> were
> > omitted, it works perfectly.
> >
> > If the double quotes are added around the string with no spaces, it fails
> > again, which makes me believe that the problem is with the double quotes.
> >
> > I've used procmon and it shows that when the double quotes are added
> around
> > the last argument, gammu.exe is not even called at all.
> >
> > Problem is that the double quotes are required by gammu to send an sms
> with
> > spaces in it.
> >
> > Any ideas? :-(
> >
> > Luke
> >
>
> Why not try:
>
> $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1 test2"';
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Re: Problems with exec() on windows

2009-03-19 Thread Kyohere Luke
Thanks, but I tried this. Doesn't work because the path\to\gammu.exe has
spaces in it
Haliphax, thanks for your comments. I tried escapeshellarg() to no end.

I'm exploring your reply regarding proc_open, but how exactly does proc_open
separate the arguments from the command?

Unless i'm mistaken, data written to the process's stdin (for the other
process) is not treated like an argument.

If I add the arguments to the process name/path? I'm back to square one.

Luke.

On Thu, Mar 19, 2009 at 6:25 PM, Shawn McKenzie wrote:

> Kyohere Luke wrote:
> > Hi,
> > I'm trying to use exec to call gammu.exe and send sms on windows XP.
> >
> > This works from commandline:
> >
> > C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
> >
> > But if I run it through php like this:
> >
> > $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
> > test2\"".;
> > @exec($command, $response, $retval);
> >
> > This always fails, returns 1 and the response is empty.
> >
> > If the last argument is a string with no spaces, and the double quotes
> were
> > omitted, it works perfectly.
> >
> > If the double quotes are added around the string with no spaces, it fails
> > again, which makes me believe that the problem is with the double quotes.
> >
> > I've used procmon and it shows that when the double quotes are added
> around
> > the last argument, gammu.exe is not even called at all.
> >
> > Problem is that the double quotes are required by gammu to send an sms
> with
> > spaces in it.
> >
> > Any ideas? :-(
> >
> > Luke
> >
>
> Why not try:
>
> $command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1 test2"';
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] Re: Problems with exec() on windows

2009-03-19 Thread Shawn McKenzie
Kyohere Luke wrote:
> Hi,
> I'm trying to use exec to call gammu.exe and send sms on windows XP.
> 
> This works from commandline:
> 
> C:\path\to\gammu.exe 1 --sendsms EMS 200 -text "test1 test2"
> 
> But if I run it through php like this:
> 
> $command = "\"C:\path\to\gammu.exe\" --sendsms EMS 200 -text \"test1
> test2\"".;
> @exec($command, $response, $retval);
> 
> This always fails, returns 1 and the response is empty.
> 
> If the last argument is a string with no spaces, and the double quotes were
> omitted, it works perfectly.
> 
> If the double quotes are added around the string with no spaces, it fails
> again, which makes me believe that the problem is with the double quotes.
> 
> I've used procmon and it shows that when the double quotes are added around
> the last argument, gammu.exe is not even called at all.
> 
> Problem is that the double quotes are required by gammu to send an sms with
> spaces in it.
> 
> Any ideas? :-(
> 
> Luke
> 

Why not try:

$command = 'C:\path\to\gammu.exe --sendsms EMS 200 -text "test1 test2"';

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php