You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: demo/runners/README.md
+16-17Lines changed: 16 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,13 +26,13 @@ The runner will check the queue for new jobs and work the jobs. After working on
26
26
1. Create a new PHP file named "SimpleRunner.php" (no naming convention here).
27
27
2. Include the config file:
28
28
29
-
```php
29
+
```php
30
30
require_once '/path/to/your/config.php';
31
31
```
32
32
33
33
3. Create a new Runner class (extending `PHPQueue\Runner`). The queue name can be defined in the `$queue_name` attribute.
34
34
35
-
```php
35
+
```php
36
36
class SampleRunner extends PHPQueue\Runner
37
37
{
38
38
public $queue_name = 'Sample';
@@ -41,14 +41,14 @@ class SampleRunner extends PHPQueue\Runner
41
41
42
42
4. Instantiate the class and call the `run()` method.
43
43
44
-
```php
44
+
```php
45
45
$runner = new SampleRunner();
46
46
$runner->run();
47
47
```
48
48
49
49
5. Run the Runner.
50
50
51
-
```
51
+
```
52
52
$ php SimpleRunner.php
53
53
```
54
54
@@ -92,8 +92,7 @@ $ php BeanstalkSampleStart.php
92
92
$ php BeanstalkSampleStop.php
93
93
```
94
94
95
-
***Note:***<br/>
96
-
On CentOS, you will need to install `php-process` package: `sudo yum install php-process`
95
+
*__Note:__ On CentOS, you will need to install `php-process` package: `sudo yum install php-process`*
97
96
98
97
### The Proper Way ###
99
98
@@ -109,7 +108,7 @@ You can make your PHP-Queue runner start the same way.
109
108
110
109
1. Combine the start and stop scripts into 1 file. And use PHP's `$argv` ([reference](http://www.php.net/manual/en/reserved.variables.argv.php)) to switch between executing `start` or `stop`:
111
110
112
-
```php
111
+
```php
113
112
require_once '/path/to/your/config.php';
114
113
$pid_file = '/path/to/process.pid';
115
114
if (empty($argv[1]))
@@ -145,36 +144,36 @@ switch($argv[1])
145
144
?>
146
145
```
147
146
148
-
*__Note:__ Some `echo` statements were added to provide some on-screen feedback.*
147
+
*__Note:__ Some `echo` statements were added to provide some on-screen feedback.*
149
148
150
149
2. Make your runner executable by adding this to the first line of the PHP script:
151
150
152
-
```
151
+
```
153
152
#!/usr/bin/php
154
153
```
155
154
and make the file executable under linux:
156
155
157
-
```
156
+
```
158
157
$ chmod a+x BeanstalkSampleDaemon.php
159
158
```
160
159
161
160
That way, you can call the script directly without involving PHP:
0 commit comments