You are here: Re: shell_exec and perl::Expect.pm « PHP Programming Language « IT news, forums, messages
Re: shell_exec and perl::Expect.pm

Posted by graphman on 12/08/06 16:44

graphman wrote:
> I have a perl script that I'm calling using php's shell_exec that uses
> an expect module to go to another system to pull tiff files. The php
> perl combination works great when I launch from the commandline:
>
> $php docpull.php
>
> I get the files I want. Everything is perfect.
>
> When I run docpull.php through the web server I get to the expect call
> in the perl script where the password is passed and the script fails. No
> error in any of the logs or return from either php or perl.
>
> I believe that its an environment issue regarding how php is run through
> the web server and what the expect module from perl needs for a pty. I
> think this is the case because I can see the scp command output that
> perl expect is generating gets to the password but after that there is
> no error. Expect needs to have a pty to work with and I think that when
> I run through the command line I have one but when I run through apache
> I lose access to ptys.
>
> Permissions don't seem to be a problem because I've set up all of the
> directories involved with uncomfortably open perms and I've run the
> command line version as the Apache user.
>
> I'm reaching at this point. Because of another server limitation I'm
> stuck with php 4 and Apache 1.3 for the time being. If anyone has any
> other suggestions for pulling files from a remote server I'd be happy to
> give them a try, however, the scp with expect will solve lots of other
> problems I'll have to deal with.
>
> I'm on slackware linux 10.2
>
> Apache/1.3.33 (Unix)
>
> PHP 4.4.1 (cli) (built: Dec 21 2005 03:44:49)
> Copyright (c) 1997-2004 The PHP Group
> Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
> with Xdebug v2.0.0beta5, Copyright (c) 2002, 2003, 2004, 2005, by
> Derick Rethans
>
> This is perl, v5.8.7 built for i486-linux
>
> The expect module I'm using is Expect-1.20

I figured out how to turn on debug and got this that I believe indicates
I'm on the right track:

Read handles:^M
Read handle: 'spawn id(3)'^M
Listen Handles: 'handle id(5)'.^M
Read handle: 'handle id(4)'^M
Listen Handles: 'spawn id(3)'.^M
Setting handle id(4) to tty mode '-g'^M
handle id(4) is not a tty. Not changing mode at
/usr/lib/perl5/site_perl/5.8.7/Expect.pm line 390.
Setting tty for handle id(4) to 'raw -echo'.^M
Setting handle id(4) to tty mode 'raw -echo'^M
handle id(4) is not a tty. Not changing mode at
/usr/lib/perl5/site_perl/5.8.7/Expect.pm line 390.
Attempting interconnection^M
Got EOF reading handle id(4)^M
Setting handle id(4) to tty mode ''^M
handle id(4) is not a tty. Not changing mode at
/usr/lib/perl5/site_perl/5.8.7/Expect.pm line 390.
Closing handle id(5).^M

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация