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
use PHPFastCGI\FastCGIDaemon\Command\DaemonRunCommand;
30
+
use PHPFastCGI\FastCGIDaemon\DaemonFactory;
31
+
use Psr\Http\Message\ServerRequestInterface;
32
+
use Symfony\Component\Console\Application;
33
+
use Zend\Diactoros\Response\HtmlResponse;
34
+
35
+
// Create the dependencies for the DaemonRunCommand
36
+
37
+
// Dependency 1: The daemon factory
38
+
$daemonFactory = new DaemonFactory();
39
+
40
+
// Dependency 2: A simple kernel. This is the core of your application
41
+
$kernel = function (ServerRequestInterface $request) {
42
+
return new HtmlResponse('<h1>Hello, World!</h1>');
43
+
};
44
+
45
+
// Create an instance of DaemonRunCommand using the daemon factory and the kernel
46
+
$command = new DaemonRunCommand('run', 'Run a FastCGI daemon', $daemonFactory, $kernel);
47
+
48
+
// Create a symfony console application and add the command
49
+
$consoleApplication = new Application();
50
+
$consoleApplication->add($command);
51
+
52
+
// Run the symfony console application
53
+
$consoleApplication->run();
54
+
```
55
+
56
+
If you wish to configure your FastCGI application to work with the apache web server, you can use the apache FastCGI module to process manage your application.
57
+
58
+
This can be done by creating an FCGI script that launches your application and inserting a FastCgiServer directive into your virtual host configuration.
59
+
60
+
```sh
61
+
#!/bin/bash
62
+
php /path/to/application.php run
63
+
```
64
+
65
+
```
66
+
FastCgiServer /path/to/web/root/index.fcgi
67
+
```
68
+
69
+
If you are using a web server such as nginx, you will need to use a process manager to monitor and run your application.
70
+
19
71
## Current Status
20
72
21
73
This daemon is currently in early development stages and not considered stable. A stable release is expected by September 2015.
0 commit comments