PHPackages                             masakielastic/h2o - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. masakielastic/h2o

ActivePhp-ext[HTTP &amp; Networking](/categories/http)

masakielastic/h2o
=================

Minimal HTTP server PHP extension powered by h2o

0.1.0(4mo ago)01proprietaryCPHP &gt;=8.1

Since Feb 25Pushed 4mo agoCompare

[ Source](https://github.com/masakielastic/php-ext-h2o)[ Packagist](https://packagist.org/packages/masakielastic/h2o)[ RSS](/packages/masakielastic-h2o/feed)WikiDiscussions main Synced 4mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

php-ext-h2o
===========

[](#php-ext-h2o)

Minimal PHP extension that embeds an `h2o`-based HTTP server.

Current status
--------------

[](#current-status)

- Extension name: `h2o`
- Main API: `h2o_server_run(array $options = null): bool`
- Build path for PIE: `ext`

Requirements
------------

[](#requirements)

- PHP development tools (`phpize`, headers)
- `h2o` shared library installed under `$HOME/.local`
    - required: `$HOME/.local/include/h2o.h`
    - required: `$HOME/.local/lib/libh2o.so`
- libuv and OpenSSL from Debian packages
    - headers: `/usr/include/uv.h` (or `/usr/include/libuv.h`)
    - libs: `/usr/lib/x86_64-linux-gnu/libuv.so`, `libssl.so`, `libcrypto.so`

Build (manual)
--------------

[](#build-manual)

```
cd ext
phpize
./configure --enable-h2o --with-h2o-dir=$HOME/.local --with-libuv-dir=/usr --with-openssl-dir=/usr
make -j"$(nproc)"
```

Load extension
--------------

[](#load-extension)

```
php -n -d extension=$(pwd)/ext/modules/h2o.so -r 'var_dump(function_exists("h2o_server_run"));'
```

API
---

[](#api)

```
h2o_server_run(array $options = null): bool
```

Example
-------

[](#example)

Create `sample.php`:

```
