Skip to content

Commit 7c3ed8c

Browse files
authored
Remove mention of a router script, it's unnecessary
1 parent 39ca24a commit 7c3ed8c

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

README.md

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Ever wanted to run PHP websites in AWS Lambda? It's your lucky day! This Lambda Runtime Layer runs the [PHP 7.1 webserver](http://php.net/manual/en/features.commandline.webserver.php) in response to [AWS API Gateway](https://aws.amazon.com/api-gateway/) requests.
44

5+
And, if you're looking for a great way to build serverless apps of all kinds, be sure to check out [Stackery](https://stackery.io)!
6+
57
This is an early iteration of the PHP runtime Layer which is not yet ready for production. Please feel free to use this Layer to learn about the Lambda Layers feature and begin experimenting with PHP functions. We welcome feedback and stay tuned for the production-ready version coming soon.
68

79
## Current Layer Version ARN
@@ -17,7 +19,7 @@ The layer runs the PHP 7.1 [PHP webserver](http://php.net/manual/en/features.com
1719
$ php -S localhost:8000 '<handler>'
1820
```
1921

20-
The Lambda Function Handler property specifies the location of the of the webserver router script. This script must be provided.
22+
The Lambda Function Handler property specifies the location of the the script executed in response to an incoming API Gateway request.
2123

2224
##### Extensions
2325
Extensions can be built using the lambci/lambda:build-nodejs8.10 Docker image. It is recommended that extensions be built into a Lambda Layer in /lib/php/7.1/modules. Then, in a php.ini file in the Lambda Function root directory put:
@@ -84,7 +86,7 @@ Resources:
8486
Description: PHP Webserver
8587
CodeUri: src/server
8688
Runtime: provided
87-
Handler: router.php
89+
Handler: index.php
8890
MemorySize: 3008
8991
Timeout: 30
9092
Tracing: Active
@@ -98,21 +100,6 @@ Resources:
98100
Method: ANY
99101
```
100102
101-
Now create the PHP application in `src/server`. We're going to create a webserver router script first. Put the following in `router.php`:
102-
103-
```php
104-
<?php
105-
if (is_file($_SERVER['DOCUMENT_ROOT'].'/'.$_SERVER['SCRIPT_NAME'])) {
106-
// Serve static files directly
107-
return false;
108-
}
109-
110-
// Run index.php for all requests
111-
$_SERVER['SCRIPT_NAME'] = '/index.php';
112-
require 'index.php';
113-
?>
114-
```
115-
116103
Lastly, let's write our script. Put this in `index.php`:
117104

118105
```php
@@ -127,8 +114,7 @@ You should now have a directory structure like:
127114
├── template.yaml
128115
└── src
129116
└── php
130-
├── index.php
131-
└── router.php
117+
└── index.php
132118
```
133119

134120
We're ready to deploy! Run the following commands:

0 commit comments

Comments
 (0)