Skip to content

Commit 715b5be

Browse files
authored
Update PHP 72 error reporting (GoogleCloudPlatform#666)
1 parent 4b6eb2b commit 715b5be

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

appengine/php72/errorreporting/README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
# App Engine for PHP 7.2 Error Reporting samples
22

3-
This app demonstrates how to report errors on on App Engine for PHP 7.2.
3+
This app demonstrates how to report errors on App Engine for PHP 7.2 and shows how
4+
different PHP error types are handled.
5+
6+
To set up **error reporting** in your App Engine PHP 7.2 application, simply follow
7+
these two steps:
8+
9+
1. Install the Google Cloud Error Reporting client library
10+
```sh
11+
composer require google/cloud-error-reporting
12+
```
13+
2. Create a [`php.ini`](php.ini) file in the root of your project and set
14+
`auto_prepend_file` to the following:
15+
```ini
16+
; in php.ini
17+
auto_prepend_file=/srv/vendor/google/cloud-error-reporting/src/prepend.php
18+
```
19+
20+
The [`prepend.php`][prepend] file will be executed prior to each request, which
21+
registers the client library's error handler.
22+
23+
[prepend]: https://github.com/GoogleCloudPlatform/google-cloud-php-errorreporting/blob/master/src/prepend.php
424
525
## Setup
626

appengine/php72/errorreporting/index.php

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

33
# [START gae_erroreporting_register_handler]
44
# After running "composer require google/cloud-error-reporting", register the
5-
# error handler by including `prepend.php` in your application
6-
require __DIR__ . '/vendor/google/cloud-error-reporting/src/prepend.php';
5+
# error handler by including `prepend.php` in your application. This is most
6+
# easily done in `php.ini` using `auto_prepend_file`:
7+
#
8+
# ; in your application's php.ini:
9+
# auto_prepend_file=/srv/vendor/google/cloud-error-reporting/src/prepend.php
10+
#
711
# [END gae_erroreporting_register_handler]
812

913
// throw a test exception to trigger our exception handler
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
auto_prepend_file=/srv/vendor/google/cloud-error-reporting/src/prepend.php

0 commit comments

Comments
 (0)