PHP code example of laynefyc / php-monitor
1. Go to this page and download the library: Download laynefyc/php-monitor library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
laynefyc / php-monitor example snippets
// 'save' => [
// 'driver' => 'mysql',
// 'host' => '127.0.0.1:3306',
// 'database' => 'php_monitor',
// 'username' => '',
// 'password' => 'abcd1234',
// 'charset' => 'utf8mb4'
// ],
// 'save' => [
// 'driver' => 'mongodb',
// 'host' => '127.0.0.1:27017',
// 'database' => 'php_monitor',
// 'username' => '',
// 'password' => ''
// ],
'save' => [
'driver' => 'sqlite',
'database' => dirname(__DIR__).'/db/php_monitor.sqlite3'
],
use pm\common\Router;
//The core code is here
/config/config.php');
(new Router($config))->run();
public function onReceive(\swoole_server $serv, $fd, $from_id, $dataSrc)
{
oute'],$serv->getClientInfo($fd,$from_id)['remote_ip'],'TCP');
}
`bash
> php --ri tideways
tideways
tideways => 4.1.7
`bash
composer create-project --prefer-dist --ignore-platform-reqs laynefyc/php-monitor php-monitor && cd php-monitor/public && php -S 127.0.0.1:8066
`bash
composer create-project --prefer-dist --ignore-platform-reqs laynefyc/php-monitor php-monitor
`bash
git clone https://github.com/laynefyc/php-monitor.git
cd php-monitor
composer update --ignore-platform-reqs
`bash
show dbs
use php_monitor //Please select your own database
db.php_monitor.createIndex({"url":1})
db.php_monitor.createIndex({"ip":1})
`
cd php-monitor/public
php -S 127.0.0.1:8066
`nginx
server {
listen 8066;
server_name localhost;
root /home/www/cai/php-monitor/public;
index index.php index.html;
location / {
root /home/www/cai/php-monitor/public;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
`
'user' => [
//login account and password
['account'=>'php','password'=>'php'],
['account'=>'admin','password'=>'abcd']
]
`nginx
fastcgi_param PHP_VALUE "auto_prepend_file={php-monitor-path}/src/autoPrepend.php";
`nginx
server {
listen 80;
server_name www.site.com;
root your/webroot/;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
";
}
}