473,396 Members | 1,929 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,396 software developers and data experts.

GLOBAL OBJECT IN EXEC COMMAND CALL

Hey all, quick question to see if anyone has any ideas. I have an
object:

$special = new special;

Let's say I have a function:

class special {
function outputtext() {
return "test";
}
}

now let's say I want to use the exec command to output that text:

exec("/usr/local/bin/php -r 'echo
$special->outputtext();'",$returnarray,$returnvar);

I get an error call to a member function on a non-object.

Any ideas how to pass teh GLOBAL OBJECT var into the shell exec
command? I am haivng a terrible time figuring out what to do.

THanks for any responses!

JJ
Jul 17 '05 #1
1 2437
Jimmy Jim wrote:
Hey all, quick question to see if anyone has any ideas. I have an
object:

$special = new special;

Let's say I have a function:

class special {
function outputtext() {
return "test";
}
}

now let's say I want to use the exec command to output that text:

exec("/usr/local/bin/php -r 'echo
$special->outputtext();'",$returnarray,$returnvar);

I get an error call to a member function on a non-object.

Any ideas how to pass teh GLOBAL OBJECT var into the shell exec
command? I am haivng a terrible time figuring out what to do.

THanks for any responses!

JJ

It is redundant to call PHP from a "sub-process" to execute a PHP
function that will return avalue to the same PHP script. there is no
advantage to doing something like that. Your function must be local to
the executing script. Global Object does not mean system global, it
means script global. When you use exec or `` you are actually spawning a
sub-process and expecting a result. The function in the calling program
does not get transferred to the sub-process - unless the same PHP script
is being executed in the sub-process. It is like running a program in
windows that starts another program in DOS and expecting the routines in
your windows program to be available to your DOS program.
Michael Austin.
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andrew Crowe | last post by:
Hi guys, I'm having trouble executing commands using exec() or system() that need to write files. I've set the permissions on CMD.EXE but I can't use exec() to write any files, even if the...
5
by: JW | last post by:
Hi, I don't seem to get any results from the following use of Runtime.getRuntime().exec(cmd) using Java 1.4 on Redhat linux. Suppose that in the same directory as my java file below, I have...
6
by: Jerald | last post by:
Hi. Is it possible to exec() from within a function so the exec'd code affects global? For example def foo(): exec ('X=')
1
by: Andr? Roberge | last post by:
I have the following two files: #--testexec.py-- def exec_code(co): try: exec co except: print "error" #-- test.py--
59
by: seberino | last post by:
I've heard 2 people complain that word 'global' is confusing. Perhaps 'modulescope' or 'module' would be better? Am I the first peope to have thought of this and suggested it? Is this a...
35
by: whisper | last post by:
My question is whether it is better to use a global variable to hold a dynamically malloced multidim array or pass around pointers to it. The details are below (forgive the long winded explanation)...
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"...
26
by: warth33 | last post by:
Hello I have a php site. Some page needs to call an external program. The programs are home made c# applications. It uses to work without problem. For a while. Maybe it work for some hour....
4
by: Matt | last post by:
Hello all, I have just discovered (the long way) that using a RegExp object with the 'global' flag set produces inconsistent results when its test() method is executed. I realize that 'global'...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.