473,395 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

exec() a php file

162 100+
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
Expand|Select|Wrap|Line Numbers
  1. // set pathing
  2. $file = 'TEXT_small.m4v';
  3. $localfile = '/user/dac420/incoming/'.$file;
  4. $remotefolder = '/user/dac420/outgoing/';
  5.  
  6. // exec the file and pass vars. transfer.php for this example just echo's Hi to the motherboard.
  7. exec('php transfer.php '.$localfile.' '.$remotefolder.' > '.$file.' &', $output, $result);
  8. print_r($output);
  9. print_r($result);
  10.  
Running this code and few variations of it give me either empty $result and $output vars or this
Expand|Select|Wrap|Line Numbers
  1.     [0] => Status: 404
  2.     [1] => Content-type: text/html
  3.     [2] => X-Powered-By: PHP/4.3.9
  4.     [3] => 
  5.     [4] => No input file specified.
  6.  
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.
Mar 17 '09 #1
4 2935
TheServant
1,168 Expert 1GB
I think you want to use include() instead... This will include (or execute through your server) a php file where ever it is called in your code.
Mar 17 '09 #2
empiresolutions
162 100+
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.
Mar 18 '09 #3
TheServant
1,168 Expert 1GB
@empiresolutions
Apologies, I meant no disrespect. Will look into this more as I have never come across it, but could very well in the near future.
Mar 18 '09 #4
empiresolutions
162 100+
Apologies, I meant no disrespect.
None taken. Its seems i need the code to look like this, but its still doesn't work.
Expand|Select|Wrap|Line Numbers
  1. exec('/usr/bin/php -f /wv/cpd/html/tsse/tts/demoondemand/v4/temp_transfer.php arg1 arg2 > /dev/null &', $output, $result);
Mar 18 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Hal Vaughan | last post by:
I've been using Runtime.exec() like this: Runtime rt = Runtime.getRuntime(); try {Process p = rt.exec("MyCommand.bat");} catch (Exception e) {do stuff} When I start my Java classes, I start...
0
by: Mark Wright | last post by:
I have a script that I use to control our build process. It is a general purpose script that exec's other scripts that contain project specific python code. In one of those other,...
5
by: Nick Jacobson | last post by:
This works fine: x = 1 def execfunc(): print x execfunc() So why doesn't this? s = \
2
by: tedsuzman | last post by:
----- def f(): ret = 2 exec "ret += 10" return ret print f() ----- The above prints '12', as expected. However,
17
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"...
8
by: R. Bernstein | last post by:
In doing the extension to the python debugger which I have here: http://sourceforge.net/project/showfiles.php?group_id=61395&package_id=175827 I came across one little thing that it would be nice...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
21
by: comp.lang.tcl | last post by:
set php {<? print_r("Hello World"); ?>} puts $php; # PRINTS OUT <? print_r("Hello World"); ?> puts When I try this within TCL I get the following error:
4
by: carl.dhalluin | last post by:
Hello I am completely puzzled why the following exec code does not work: mycode = "import math\ndef f(y):\n print math.floor(y)\nf(3.14)" def execute(): exec mycode execute()
7
by: gregory.lielens | last post by:
Hi, I am using a small python file as an input file (defining constants, parameters, input data, ...) for a python application. The input file is simply read by an exec statement in a specific...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.