# I'm getting errors in chapter 7

**URL:** <https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872>\
**Category:** Push Notifications by Tutorials\
**Created:** [September 26, 2018, 9:00pm UTC](https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872 "2018-09-26T21:00:28Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dricard](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dricard/32/82341_2.png) [@dricard](https://forums.kodeco.com/u/dricard)\
**Post date:** [September 26, 2018, 9:00pm UTC](https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872/1 "2018-09-26T21:00:28Z")

</div>

When I test the php script I get no notifications on the phone, but get these errors in the Vapor project:

```auto
[ERROR] invalid HTTP method (/starter/.build/checkouts/vapor.git-4756611856651214512/Sources/Vapor/Logging/Logger+LogError.swift:32)
[DEBUG] Conform `HTTPParserError` to `Debuggable` for better debug info. (/starter/.build/checkouts/vapor.git-4756611856651214512/Sources/Vapor/Logging/Logger+LogError.swift:34)

```

I tried various things to find the cause. The php script goes into the `tokensToReceiveNotification` method, but it doesn’t seem to go into the foreach loop at all, which would mean $tokens is empty. Putting a stop in that method returns this:

```auto
Uncaught PDOException!
exception 'PDOException' with message 'could not find driver' in /push_script.php:16
Stack trace:
#0 /push_script.php(16): PDO->__construct('pgsql:host=loca...')
#1 {main}
Stack entered at 0x104b7da70 in /push_script.php on line 0

```

I’m not sure where to go from here so any help would be appreciated!

---

<div class="post-metadata">

**Author:** ![gargoyle](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gargoyle/32/107285_2.png) [@gargoyle](https://forums.kodeco.com/u/gargoyle)\
**Post date:** [September 27, 2018, 6:03pm UTC](https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872/2 "2018-09-27T18:03:00Z")

</div>

I’m so sorry you’re running into an issue! You’re getting the failure in the PHP script because the vapor service is failing, so don’t worry about the PHP issues right now. I know the Vapor team just did another release, I hope there were no breaking changes! I’ll test this tonight when I get home from work.

What stage are you at in the book? The things I could suggest trying:

1. Make sure you’ve fixed all the IP addresses appropriately.
2. Try using the final project from the sources to see if maybe there’s an issue with the added code.
3. Do an “rm -rf .build” at the toplevel of your project to remove all the Vapor stuff and then “vapor xcode -y” again to force it to redownload everything and rebuild. Note this will take a few minutes to complete.

---

<div class="post-metadata">

**Author:** ![gargoyle](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gargoyle/32/107285_2.png) [@gargoyle](https://forums.kodeco.com/u/gargoyle)\
**Post date:** [September 27, 2018, 6:21pm UTC](https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872/3 "2018-09-27T18:21:17Z")

</div>

Actually, looking at your PHP error…I think you’ve got a PHP which isn’t built with PostgreSQL support. You might need to build a new version of PHP that enables PostgreSQL.

---

<div class="post-metadata">

**Author:** ![gargoyle](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gargoyle/32/107285_2.png) [@gargoyle](https://forums.kodeco.com/u/gargoyle)\
**Post date:** [September 28, 2018, 5:24pm UTC](https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872/4 "2018-09-28T17:24:27Z")

</div>

@dricard I just ran though chapter 6 and 7 and I was able to successfully send myself a push. I did discover a critical error in one part of the code from chapter 6, so please see this topic:

[https://forums.kodeco.com/t/missing-line-in-chapter-6s-token-class/51103](https://forums.kodeco.com/t/missing-line-in-chapter-6s-token-class/51103)

Unfortunately that’s not the issue you’re seeing.

---

<div class="post-metadata">

**Author:** ![dricard](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/dricard/32/82341_2.png) [@dricard](https://forums.kodeco.com/u/dricard)\
**Post date:** [September 30, 2018, 6:44pm UTC](https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872/5 "2018-09-30T18:44:43Z")

</div>

Actually adding that missing line of code did the trick! I checked and my PHP is current (`PHP 7.1.19 (cli) (built: Aug 17 2018 18:03:17)`), and I only got the error in the script if I had breakpoints in there.

Anyhow, I just added your line of code (from the linked thread) above and now I’m receiving the push notifications.

Thanks for looking into this for me, I appreciate. I’m learning a lot, this book is a great resource, thanks!

---

<div class="post-metadata">

**Author:** ![gargoyle](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gargoyle/32/107285_2.png) [@gargoyle](https://forums.kodeco.com/u/gargoyle)\
**Post date:** [September 30, 2018, 10:41pm UTC](https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872/6 "2018-09-30T22:41:50Z")

</div>

Awesome! I’m glad things are working for you now, and that you’re finding value in the book!

---

<div class="post-metadata">

**Author:** ![yoele](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/yoele/32/83407_2.png) [@yoele](https://forums.kodeco.com/u/yoele)\
**Post date:** [October 16, 2018, 5:28am UTC](https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872/7 "2018-10-16T05:28:29Z")

</div>

Hi there guys, @dricard @gargoyle i had thw same issue where i was trying to run the php script, i added that line and all worked perfectly !

wil there be a way to send the push directly from the vapor server ? ( via post request)

Thank you

---

<div class="post-metadata">

**Author:** ![gargoyle](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/gargoyle/32/107285_2.png) [@gargoyle](https://forums.kodeco.com/u/gargoyle)\
**Post date:** [October 16, 2018, 3:46pm UTC](https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872/8 "2018-10-16T15:46:42Z")

</div>

Yes, eventually that will be possible. We are waiting for the Vapor team to finalize how the HTTP/2 stuff will be handled with Apple’s servers. Once that’s available, we’ll make an update for the book.

---

<div class="post-metadata">

**Author:** ![yoele](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/yoele/32/83407_2.png) [@yoele](https://forums.kodeco.com/u/yoele)\
**Post date:** [October 17, 2018, 7:36am UTC](https://forums.kodeco.com/t/im-getting-errors-in-chapter-7/50872/9 "2018-10-17T07:36:45Z")

</div>

@gargoyle Awosome cant wait (😉
