how to passing variable in zend job queue?

Posted on 2009-04-29
Last Modified: 2012-05-06
Daer all,

i try use zend job queue, i have problem:
i have script A  that do insert job that excute script B to job queue. and it run well. but when i try send varibles from  script A to script B. how to access variable in script B that defined in script A?

i have try use setUserVars in script A.
i try use get_defined_vars. and i see my variable in $_server [JQ_USER_VARS_DATA] .

but how to access the varible i dont know.

script A


$_REQUEST[msisdn] 	= 62817;

$_REQUEST[keyword] 	= "message";

$_REQUEST[oprId] 	= 1;

$_REQUEST[trxId] 	= 1;

$_REQUEST[Channel] 	= 3;

$_REQUEST[sdcId] 	= 2;

$executeFile = "scriptB.php";

$queue = new ZendApi_Queue(ZEND_PLATFORM_IP_PORT);


$checkoutJob = new ZendApi_Job($executeFile);

$checkoutJob -> setUserVariables(array('var'=>$_REQUEST));

$id = $queue->addJob($checkoutJob);

in Script B


output script B:



    [ZendEnablerConfig] => /usr/local/Zend/Platform/etc/fastcgi-jobq.conf



    [PHPRC] => /usr/local/Zend/Platform/etc/fastcgi

    [LD_LIBRARY_PATH] => /usr/local/Zend/Platform/lib



    [PATH_TRANSLATED] => /usr/local/Zend/Platform/JobQueue/M-ASP/cli/GetVar2.php

    [JQ_USER_VARS_SIZE] => 264

    [JQ_USER_VARS_DATA] => a%3A1%3A%7Bs%3A3%3A%22var%22%3Ba%3A6%3A%7Bs%3A6%3A%22msisdn%22%3Bd%3A62817%3Bs%3A7%3A%22keyword%22%3Bs%3A10%3A%22message%22%3Bs%3A5%3A%22oprId%22%3Bi%3A1%3Bs%3A5%3A%22trxId%22%3Bi%3A1%3Bs%3A7%3A%22Channel%22%3Bi%3A3%3Bs%3A5%3A%22sdcId%22%3Bi%3A2%3B%7D%7D

    [JQ_GLOBALS_SIZE] => 76

    [JQ_GLOBALS_DATA] => a%3A1%3A%7Bs%3A5%3A%22_POST%22%3Bs%3A14%3A%22a%253A0%253A%257B%257D%22%3B%7D

    [REQUEST_URI] => /usr/local/Zend/Platform/JobQueue/M-ASP/cli/GetVar2.php

    [SCRIPT_FILENAME] => /usr/local/Zend/Platform/JobQueue/M-ASP/cli/GetVar2.php

    [PHP_SELF] => 

    [REQUEST_TIME] => 1240923545

    [argv] => Array



    [argc] => 0


Open in new window

Question by:herbetfy
    LVL 40

    Expert Comment

    The easiest way is to use a session.

    In both files add the line (near/at the top) ...


    Now you can use the $_SESSION super global.

    If you ...

    $_SESSION['Name'] = 'Richard';

    in script A, you can ...

    echo $_SESSION['Name'];

    in script B.

    More details can be read at

    Accepted Solution

    i have find the problem. i use wrong php.ini in fastcgi.
    after i change php.ini to default  everything run well.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
    Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now