Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Perlscript wont run correctly if exec'd by php.
Old 10-26-2010, 03:05 AM Perlscript wont run correctly if exec'd by php.
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Hi guys,
I have a perl script that connects to cisco routers using the net::appliance::session module.

It takes 3 arguments ( host , dbid, username )

It then connects to the host
Reads the config from the DB based on the ID
Adds the config to the router.

This works FINE! if i call it from the cli however if i call it from php it just fails to connect to the device.

I assume this is some kind of permission issue or something else odd going on.

Ive tried calling it like:
$output = `perl /var/www/cgi-bin/config/apply.pl $host $idref lynxus`;


echo exec("cd /var/www/cgi-bin/config/; ./apply.pl $host $idref lynxus");


BOTH work and call it ( i start to get output ) but the connect part of the perl script fails.

Any thoughs what could be wrong?

Scr: /var/www/html/configure # ll /var/www/cgi-bin/config/apply.pl
-rwxrwxr-x 1 root root 1948 Oct 26 07:54 /var/www/cgi-bin/config/apply.pl
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
 
Register now for full access!
Old 10-26-2010, 04:20 AM Re: Perlscript wont run correctly if exec'd by php.
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
My first guess would be that the user the web server is running as does not have the appropriate permissions.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 10-26-2010, 06:09 AM Re: Perlscript wont run correctly if exec'd by php.
lynxus's Avatar
Awesomeo-Maximo

Posts: 1,618
Location: UK
Trades: 1
Quote:
Originally Posted by NullPointer View Post
My first guess would be that the user the web server is running as does not have the appropriate permissions.

Yeah i thought that same, All appeared as ok.

I have however JUST figured it out..
Phew.

Turns out that the apache user didnt have write access to its ssh directory.
when it connected to a device, It needed to save the hostkey.
It couldnt do this.

Now its all sorted

Its silly things like this that add stupid delays to projects.
Things that would take a few days to get working propely and securely can end up taking a week.
Grrr


Thanks
G
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE



Last edited by lynxus; 10-26-2010 at 06:10 AM..
lynxus is offline
Reply With Quote
View Public Profile Visit lynxus's homepage!
 
Reply     « Reply to Perlscript wont run correctly if exec'd by php.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.54902 seconds with 12 queries