473,406 Members | 2,467 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,406 software developers and data experts.

run php file in another php file using predis

i have two fils named `index.php` and cron.php. i have written some logic of sending mail in cron.php. when i call index.php then i want that cron.php should run in bacground. how can i do that
This is my `index.php`
Expand|Select|Wrap|Line Numbers
  1.  
  2. $x=array('to'=>'ucerturohit@gmail.com','name'=>'Rohitashv singhal');
  3.  
  4.           $client = new \Predis\Client();
  5.           $client->select(4);
  6.           $client->lpush('xxxx',$x['to']);
  7.  
  8.  
  9. //         $command = "/usr/bin/php5 -f /var/www/Symfony/src/Ens/NewBundle/Controller/test.php";
  10.  
  11.                $arrOutput=shell_exec('php test.php');
  12.                 print_r($arrOutput);
  13.  
  14.         //      echo shell_exec('php test.php');
  15.            return $this->render('EnsNewBundle:Email:header.html.twig');
  16.     }
  17.  
and this is my test.php
Expand|Select|Wrap|Line Numbers
  1. require '/var/www/predis/autoload.php';
  2.         \Predis\Autoloader::register();
  3.  
  4. echo "hi";
  5.  
  6. require_once('Services/Notification.php');
  7.  
  8. $client = new \Predis\Client();
  9.           $client->select(4);
  10.  
  11. $u=$client->blpop('xxxx',0);
  12.  
  13. var_dump($u);
  14.  
  15. notification_on_signup($u[1]);
  16.  
Aug 23 '12 #1
1 2153
johny10151981
1,059 1GB
1. You can simply include the corn.php

it wont help with the issue of running in background.

2. You can simply send an http request to your own browser and ignore the reply.
it wont help with the issue of running in background either.

3. If you have system permission then you can execute your php file with php
it wont also help with the issue of running in background.

and also you can look at this answer
Aug 29 '12 #2

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

Similar topics

1
by: Andrew V. Romero | last post by:
I am using javascript to parse a form and it uses the information on that form to display some calculations (yes using PHP or something would be easier, but not feasible for this project). So I...
2
by: Quick Function | last post by:
For the <input type="file">, can I select directory? Multiple directories? Thanks, qq
1
by: DjordjeD | last post by:
I need to call(reference) class member "PrintDestination.PrintDestinationPrinter" from another file. How do I do it, I tried "ReportRenderer.PrintDestination.PrintDestinationPrinter" but it...
4
by: David Buchan | last post by:
Hello, I wonder if anyone could help me. I'm using vb.NET and I'd like to read a binary file, byte by byte, and then write to another file (making a duplicate, identical file). I'd then...
8
by: Jared Wiltshire | last post by:
Hi, I've written the following code to copy one files contents line by line into another file. However I'm a bit dubious about using the infinite loop to do this. ifstream infile("File1.txt");...
4
by: system55 | last post by:
I need some help.... How can i create a program wherein it can copy a file about 2MB in size, into another file using the extended memory allocation??? Do i need to use some interrupt calls in dos??
17
by: Eric_Dexter | last post by:
def simplecsdtoorc(filename): file = open(filename,"r") alllines = file.read_until("</CsInstruments>") pattern1 = re.compile("</") orcfilename = filename + "orc" for line in alllines: if not...
9
by: Sonnich | last post by:
Hi! I want to have a number of strings in another file, which I can include everywhere... but I cannot make them reachable from the top file. I have looked at var and global to to this but...
17
by: sagar | last post by:
Hi, I have a C file(add.c) in which i have a function called add.now i want to call the same add function from another file sub.c .Can any1 tell how to do that... Thanks in advance Mark
2
by: nma | last post by:
Hi Again, Can someone give ideas on how should I do this task? I've made a simple timeline using <td> and when I mouseover the cell I want it to link to another list of something and it will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.