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.

PHP Forum


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



Freelance Jobs

Reply
Old 03-17-2009, 10:09 AM exec() a php file
Extreme Talker

Posts: 196
Trades: 0
I'm trying to call a PHP page to run when called from another page. To do this it seems i have to use the exec() function. The code would go something like
Code:
// set pathing
$file = 'TEXT_small.m4v';
$localfile = '/user/dac420/incoming/'.$file;
$remotefolder = '/user/dac420/outgoing/';

// exec the file and pass vars. transfer.php for this example just echo's Hi to the motherboard.
exec('php transfer.php '.$localfile.' '.$remotefolder.' > '.$file.' &', $output, $result);
print_r($output);
print_r($result);
Running this code and few variations of it give me either empty $result and $output vars or this
Code:
    [0] => Status: 404
    [1] => Content-type: text/html
    [2] => X-Powered-By: PHP/4.3.9
    [3] => 
    [4] => No input file specified.
I have Googled "php exec" (and others) but I have come up with few reference. If someone can shed some light on this function or tell me where im wrong in my code i would appreciate it. Thanks.
empiresolutions is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-17-2009, 01:25 PM Re: exec() a php file
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Why not just use the include ( http://uk2.php.net/manual/en/function.include.php ) function?

Also, the problem here is the file your looking for is not there, hence the 404 error.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 03-18-2009, 09:36 AM Re: exec() a php file
Extreme Talker

Posts: 196
Trades: 0
Include/Require will not work. I should have explained better. The page im calling via exec() is transferring 1G file between two servers. If this file is include()'d, the page will hang white until the transfer is complete. Therefor i need to create a separate php process to run in the background. This way once the transfer is started, the user can continue with their browsing without waiting.

The way to do this is with exec(). I just need to know how i went wrong. I think its pathing. Fu*^ing pathing every time! But maybe someone can help. Thanks.
empiresolutions is offline
Reply With Quote
View Public Profile
 
Old 03-18-2009, 01:16 PM Re: exec() a php file
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
http://www.google.co.uk/search?q=run...ground+process

I'm sure somebody posted that "PHP isn't man enough" in another thread!!
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-18-2009, 05:52 PM Re: exec() a php file
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
http://nsaunders.wordpress.com/2007/...rocess-in-php/ < Could be what your looking for.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 03-19-2009, 09:38 AM Re: exec() a php file
Skilled Talker

Posts: 84
Trades: 0
I am not sure whether its a path issue as you mentioned but I think you can try some thing like

php -q transfer.php

inside the exec()
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
- 1-888-869-HOST(4678)
Award winning Managed Hosting -
Please login or register to view this content. Registration is FREE

Managed Dedicated Servers. Reseller Discounts. 24/7 Impressive Tech Support
HivelocityDD is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to exec() a php file
 

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.23700 seconds with 12 queries