Haylie  Conn

Haylie Conn

1619610900

Using Fluent-Bit to forward Docker PHP-FPM and Nginx logs to Elasticsearch

In this example we are going to forward our PHP-FPM and Nginx logs to Elasticsearch. In order to do that we will be using Fluent-Bit. Our monitoring stack is EFK (Elasticsearch Fluent-Bit Kibana). The reason we are not using FileBeat and Logstash is because Fluent-Bit is very very light weight on system resources. We are talking about barely a few KB/MB compared to hundreds of MBs!!! It has build-in persistence mechanism as well such as memory and filesystem. FileBeat and Logstash solution will require something like Redis for persistence.

Flow

PHP-FPM and Nginx logs are being watched by Fluent-Bit then get forwarded to Elasticsearch. As simple as that!

#docker #elasticsearch #nginx #php-fpm

What is GEEK

Buddha Community

Using Fluent-Bit to forward Docker PHP-FPM and Nginx logs to Elasticsearch
Haylie  Conn

Haylie Conn

1619610900

Using Fluent-Bit to forward Docker PHP-FPM and Nginx logs to Elasticsearch

In this example we are going to forward our PHP-FPM and Nginx logs to Elasticsearch. In order to do that we will be using Fluent-Bit. Our monitoring stack is EFK (Elasticsearch Fluent-Bit Kibana). The reason we are not using FileBeat and Logstash is because Fluent-Bit is very very light weight on system resources. We are talking about barely a few KB/MB compared to hundreds of MBs!!! It has build-in persistence mechanism as well such as memory and filesystem. FileBeat and Logstash solution will require something like Redis for persistence.

Flow

PHP-FPM and Nginx logs are being watched by Fluent-Bit then get forwarded to Elasticsearch. As simple as that!

#docker #elasticsearch #nginx #php-fpm

Haylie  Conn

Haylie Conn

1619519520

Using Unix Socket for Php-fpm and Nginx Docker Setup

Follow example below to use a unix socket configuration in order for PHP-FPM and Nginx docker containers to talk to each other. Both containers are running as same user inanzzz.

Structure

When you run docker the php-fpm.sock will be created automatically.

.
├── docker
│   ├── docker-compose.yml
│   ├── nginx
│   │   ├── app.conf
│   │   ├── Dockerfile
│   │   └── nginx.conf
│   ├── php
│   │   ├── Dockerfile
│   │   └── www.conf
│   └── socket
│       └── php-fpm.sock
├── index.html
└── index.php

#docker #nginx #php-fpm

Christa  Stehr

Christa Stehr

1595288376

How to use highchart in php with example

Highchart provides feature to draw different type of charts in our web application. Here, in this example i will let you know that how to use highchart in php application.

In this example, we will create chart using php and mysql. Actually highchart provides javascript library to create charts. We will only need to implement that library in our application.

We will need some data to generate chart, so here we will use mysql database and database query to fetch data from database.

So basucally here we will leran to implement simple dynamic column chart using highcharts library in php and ofcourse will use mysql database.

For for that, first thing we will need to create a database and tables where we will put some data. So for full example let’s follow the steps as given below.

Step 1: Create Database

Here for example, i will create a database named shopping and under this database we will need to create some tables, here i will create only two table one is to stroe customers information and another to store orders.

So run the following query in your query window.

Create customers table

CREATE TABLE IF NOT EXISTS `customers` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `name` varchar(30) NOT NULL,

  `email` varchar(30) NOT NULL,

  `phone` varchar(15) NOT NULL,

  `created_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,

  PRIMARY KEY (`id`)

) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;

Now you will to put some data into these two tables. You can put any data accoring to the column and your need. After putting data we can be able to show the chart according the the data.

Step 2: Create database configuration

Now we will need to create configuration file. So let’s create a new db configuration file **db_config.php **and put the following code into this file.

db_config.php

<?php
  $dbHost = "localhost";
  $dbDatabase = "shopping";
  $dbUser = "root";
        $dbPassword = ""; 

  $mysqli = mysqli_connect($dbHost, $dbUser, $dbPasswrod, $dbDatabase);
?>

#php #create highchart in php #generate highchart in php #high chart using php and mysql example #highchart example #how to implement high chart in php #how to use highchart

Misael  Stark

Misael Stark

1619469240

PHP-FPM and Nginx access logs as standardised JSON string in Docker environment

If you want to change PHP-FPM and Nginx container log format to JSON while keeping same style, you can use example below.

Structure

.
├── docker
│   ├── docker-compose.yml
│   ├── Makefile
│   ├── nginx
│   │   ├── app.conf
│   │   ├── Dockerfile
│   │   └── nginx.conf
│   └── php
│       ├── Dockerfile
│       ├── php.ini
│       └── www.conf
└── index.php

#docker #php #nginx

I am Developer

1597487472

Country State City Dropdown list in PHP MySQL PHP

Here, i will show you how to populate country state city in dropdown list in php mysql using ajax.

Country State City Dropdown List in PHP using Ajax

You can use the below given steps to retrieve and display country, state and city in dropdown list in PHP MySQL database using jQuery ajax onchange:

  • Step 1: Create Country State City Table
  • Step 2: Insert Data Into Country State City Table
  • Step 3: Create DB Connection PHP File
  • Step 4: Create Html Form For Display Country, State and City Dropdown
  • Step 5: Get States by Selected Country from MySQL Database in Dropdown List using PHP script
  • Step 6: Get Cities by Selected State from MySQL Database in DropDown List using PHP script

https://www.tutsmake.com/country-state-city-database-in-mysql-php-ajax/

#country state city drop down list in php mysql #country state city database in mysql php #country state city drop down list using ajax in php #country state city drop down list using ajax in php demo #country state city drop down list using ajax php example #country state city drop down list in php mysql ajax