Huffman Tree && Huffman Code (Affordable Source Code)

2023-01-06   ES  

Center 6.2 linux installation PHP5.6.6 source code

PHP has incorporated PHP-FPM into the core code of PHP after 5.3.3. So PHP-FPM does not need to be downloaded and installed separately.
To support PHP-FPM, you only need to bring-ENable-FPM when compiling the PHP source code

1: YUM installation of PHP dependency library

yum install -y make cmake gcc gcc-c++ autoconf automake libpng-devel libjpeg-devel zlib libxml2-devel ncurses-devel bison libtool-ltdl-devel libiconv libmcrypt mhash mcrypt pcre-devel openssl-devel freetype-devel libcurl-devel

2: Download PHP5.6 source code

wget http://cn2.php.net/distributions/php-5.6.6.tar.gz

tar -zxvf php-5.6.6.tar.gz
cd ./php-5.6.6/

three: PHP configuration installation

# Configure PHP compilation parameters
./configure –prefix=/usr/local/php –with-mysql –with-mysqli –with-pdo_mysql –with-iconv-dir –with-zlib –with-libxml-dir –enable-xml –with-curl –enable-fpm –enable-mbstring –with-gd –with-openssl –with-mhash –enable-sockets –with-xmlrpc –enable-zip –enable-soap –with-freetype-dir=/usr/lib64

# start to compile and install
make
make install

and then install it in/usr/local/php directory

4: Configure PHP-FPM

php-fpm configuration

First start PHP-FPM:

/usr/local/php/sbin/php-fpm


[19-Apr-2018 16:02:08] ERROR: failed to open configuration file ‘/usr/local/php/etc/php-fpm.conf’: No such file or directory (2)
[19-Apr-2018 16:02:08] ERROR: failed to load configuration file ‘/usr/local/php/etc/php-fpm.conf’
[19-Apr-2018 16:02:08] ERROR: FPM initialization failed

error message says that you can’t find php-fpm.conf

to the configuration directory from PHP
cd /usr/local/php/etc
There is a pHP-fpm.conf.default file, CP copy
cp php-fpm.conf.default php-fpm.conf

Edit PHP-FPM.CONF
Find the following configuration items, the configuration is as follows

pid = run/php-fpm.pid

Run again
/usr/local/php/sbin/php-fpm
Error:
[19-Apr-2018 16:07:17] ERROR: [pool www] cannot get uid for user ‘nginx’
[19-Apr-2018 16:07:17] ERROR: FPM initialization failed

Nginx users do not exist, so build Nginx users

useradd nginx

Start again

/usr/local/php/sbin/php-fpm

There is no error, indicating that the operation is successful

Verify whether it is successful

ps aux|grep php-fpm

PHP-FPM process appeared:
root 15448 0.0 0.2 210972 4856 ? Ss 16:10 0:00 php-fpm: master process (/usr/local/php/etc/php-fpm.conf)
www 15449 0.0 0.2 213056 4768 ? S 16:10 0:00 php-fpm: pool www
www 15450 0.0 0.2 213056 4768 ? S 16:10 0:00 php-fpm: pool www
root 15492 0.0 0.0 112648 964 pts/0 R+ 16:11 0:00 grep –color=auto php-fpm

5: Add to boot and start

The configuration file startup is: /etc/rc.local
# vi /etc/rc.local

/USR/LOCAL/PHP/SBIN/PHP-FPM # Add in

6: Some commands of PHP-FPM

After the new installation expansion, we need to re-pHP-FPM, which has enhanced the expansion.
The simplest and rude way to re-pHP-FPM is:
Find the process number of PHP-FPM first, kill, and then start with/usr/local/php/sbin/php-fpm.
In fact, there are more mild methods, which is to use signals.
int, term immediately terminate
Quit smoothly terminate
USR1 Re -open the log file
USR2 smoothly loads all workers processes and reloads the configuration and binary module

Example:

php-FPM Turn off: 
 kill-INT `cat /usr/local/php/var/run/php-fpm.pid`

php-FPM restart: 
 kill-USR2 `cat /usr/local/php/var/run/php-fpm.pid`

7: Nginx configuration parsing PHP

nginx configuration installation is referred to the previous article:http://www.cnblogs.com/starlion/p/8875982.html

1. Enter the Nginx directory
cd /usr/local/nginx

2, edit configuration file
vi ./conf/nginx.conf

Find it under the server

location / {
    root html;
    index index.html index.htm index.php; #Add index.php
}

Remove the previous comment #

location ~ \.php$ {
    root /usr/local/nginx/html; #Absolute path configuration under HTML
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # Analysis of PHP errors during verification,/scripts needs to be replaced with $ document_root, there is an explanation below
include fastcgi_params;
}

3. Then restart Nginx smoothly
./sbin/nginx -s reload
There is no error, indicating that the restart is successful

8: Verify whether the PHP is configured successfully

Edit vi index.php in/usr/local/nginx/html directory

<?php
echo phpinfo();
?>

Enter http: // ip: 80/index.php on the browser and then make an error
File not found

View the log of nginx, the configuration log is in the ./logs directory
First check the access.log log, there is the following error message
FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream, client: ***.107.***.138, server: localhost, request: “GET / HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “1**.24.**.115”

The following information appeared at the Error. Log log information
[error] 16403#0: *42 FastCGI sent in stderr: “Primary script unknown” while reading response header from upstream, client: ***.107.***.138, server: localhost, request: “GET /index.php HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “1**.24.**.115”

According to the above FastCGI SENT in Stderr: “Primary Script Unknown”
This is an error in configuring the PHP script when configuring the nginx analysis of the PHP script

fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

Modify to the following ways ($ document_root):

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

$ document_root represents the value specified in the current request in the root instruction:

After modification, restart nginx
./sbin/nginx -s reload
Re -refresh the browser and appear as shown in the figure below, indicating that the configuration is successful

Reprinted from https://www.cnblogs.com/starLion/p/8884465.html

source

Related Posts

CentOS7 (new system) Install Elasticsearch6.3.2 command

Multi-thread programming-1 1/condition variable/level use example

User group management

From entry to the soil: procedures based on Python use the TCP protocol to implement communication functions

Huffman Tree && Huffman Code (Affordable Source Code)

Random Posts

Eclipse CDT Introduce the C/C ++ project built by Makefile

Leetcode Question: Tencent Selection Exercise 50 Questions 231.2 Power

Multi-thread programming-1 1/condition variable/level use example

Set up DVWA penetration test target

node version control n’s use