Skip to content

Commit

Permalink
Added PHP configuration information
Browse files Browse the repository at this point in the history
  • Loading branch information
w-henderson committed Sep 21, 2021
1 parent 8358ab7 commit af3a9d2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<img src="assets/logo.png" width=250><br><br>
<img src="https://raw.githubusercontent.com/w-henderson/Humphrey/master/assets/logo.png" width=250><br><br>
<img src="https://img.shields.io/badge/language-rust-b07858?style=for-the-badge&logo=rust" style="margin-right:5px">
<img src="https://img.shields.io/github/workflow/status/w-henderson/Humphrey/CI?style=for-the-badge" style="margin-right:5px">
<img src="https://img.shields.io/crates/v/humphrey?style=for-the-badge" style="margin-right:5px">
Expand Down Expand Up @@ -77,5 +77,16 @@ targets = "conf/targets.txt" ; A text file containing one target on each line t
mode = "round-robin" ; The algorithm for load balancing, either "round-robin" (default) or "random"
```

## Using with PHP
To use Humphrey with PHP, compile the [PHP plugin in the plugins folder](https://github.com/w-henderson/Humphrey/tree/master/plugins/php) and add the path to the output file to your plugins list as specified in the static configuration. You'll need Humphrey installed with plugins enabled (using `cargo install humphrey_server --features plugins`) and you'll also need PHP-CGI or PHP-FPM. Start the PHP server first, and specify its address in the Humphrey configuration file as specified below. Ensure your PHP configuration allows for multithreading if you set more than one thread in the configuration. Finally, you can start Humphrey in the normal way and it will work with PHP.

```ini
; Additional PHP configuration
[php]
address = "127.0.0.1"
port = 9000
threads = 8
```

## Creating a Plugin
To create a plugin, take a look at the [plugin example](https://github.com/w-henderson/Humphrey/tree/master/examples/plugin). In short, you need to create a library crate with type `cdylib` to compile to a DLL, then implement the `humphrey_server::plugins::plugin::Plugin` trait for a struct and declare it with the `declare_plugin!` macro.

0 comments on commit af3a9d2

Please sign in to comment.