Home Backend Development PHP Problem What are the steps to install the php source code package?

What are the steps to install the php source code package?

Aug 30, 2019 am 09:30 AM
php Install step

What are the steps to install the php source code package?

Basic commands:

1. Step 1: tar command tar -zxvf source package (.tar.gz The path of the compressed package at the end), (jxvf at the end of .bzip2)

2. Step 2: Enter the decompression directory, cd command

3. Step 3: Configuration, ./configure --prefix=Specify the installation directory

4. Step 4: Compile, make

5. Step 5: Install, make install

Preparation:

First use winscp to connect to the server and place the package in the /php/tools directory.

Installation starts:

1. Install mysql, first install the dependencies required for mysql through yum

yum -y install gcc gcc-c++ cmake ncurses-devel
Copy after login

2. Enter the mysql source code package directory

cd /php/tools/mysql
Copy after login

3. Unzip

tar -zxvf mysql-5.6.35.tar.gz
Copy after login

4. Enter the unzipped directory

cd mysql-5.6.35
Copy after login

5. Configuration

cmake 
-DCMAKE_INSTALL_PREFIX=/php/server/mysql 
-DMYSQL_DATADIR=/php/server/data 
-DDEFAULT_CHARSET=utf8 
-DDEFAULT_COLLATION=utf8_general_ci
Copy after login

6. Compile and install

make && make install
Copy after login

Related recommendations: "PHP Getting Started Tutorial"

7. Configure mysql

1. Copy the MySQL configuration file in the installation directory to /etc/my.cnf.

\cp -r /php/tools/mysql/mysql-5.6.35/support-files/my-default.cnf /etc/my.cnf
Copy after login

2. Modify the MySQL configuration file (declare the MySQL data storage directory)

vi  /etc/my.cnf
Copy after login

Set this line under [mysqld]: datadir = /php/server/data

3. Create a MySQL user group and create a user to join the user group

groupadd mysql
useradd -g mysql -s /sbin/nologin mysql
Copy after login

4. Initialize the database (executing the following command will generate a default database such as mysql/test in the data directory)

/php/server/mysql/scripts/mysql_install_db \
--basedir=/php/server/mysql \
--datadir=/php/server/data \
--user=mysql
Copy after login

Error report:

What are the steps to install the php source code package?

Install autoconf to solve the problem, and execute the above command again

yum -y install autoconf
Copy after login

5. Start the MySQL service (Note: & means background startup)

/php/server/mysql/bin/mysqld_safe --user=mysql &
Copy after login
Copy after login

6. Verify whether the MySQL service starts successfully (equivalent to win to view the process)

ps -A | grep mysql
Copy after login

7. Initialize the database and set the password of the root account (the default password is empty)

/php/server/mysql/bin/mysql -uroot -p
#回车输入密码,然后执行下述SQL语句
Copy after login

Delete test Database&& Delete the empty password account of the local anonymous connection

drop database test;                 
delete from mysql.user where user='';
Copy after login

Change password

update mysql.user set password=password('admin888') where user='root';
flush privileges;
Copy after login

Forgot password, force password change

1. Open the mysql configuration file

vi /etc/my.cnf

2. Add skip-grant-tables in the next line of [mysqld]

3. Restart the mysql service

4. Log in to mysql again (Because of the above operation, the password is empty at this time)

5. Change the password

6. Delete the mysql configuration file: my.cnf: skip-grant-tables

7. Restart the msyql service.

Install apache

1. Install zlib

shell> cd /php/tools/apache #进入tools目录
shell> tar zxvf zlib-1.2.5.tar.gz #解压zlib安装包
shell> cd zlib-1.2.5 #进入解压目录
shell> ./configure #这个配置编译命令不要加目录参数
shell> make && make install
Copy after login

2. Install apache

shell> cd /php/tools/apache #进入tools目录
shell> tar -jxvf httpd-2.2.19.tar.bz2 #解压apache安装包
shell> cd httpd-2.2.19 #进入解压目录
shell> #配置
./configure --prefix=/php/server/apache 
--enable-modules=all 
--enable-mods-shared=all 
--enable-so
shell> make && make install
Copy after login

If the decompression error is as follows, you need to install bzip2

tar (child): lbzip2: Cannot exec: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
Copy after login

Installation command

yum -y install bzip2
Copy after login

Test

Modify the configuration file

vi /php/server/apache/conf/httpd.conf
Copy after login

Start service

/php/server/apache/bin/apachectl start/stop/restart
Copy after login

View

ps -A | grep httpd
Copy after login

Install PHP

shell> cd /php/tools/php
shell> tar -jxvf php-7.2.6.tar.bz2
shell> cd php-7.2.6
shell> #配置
./configure --prefix=/php/server/php 
--with-apxs2=/php/server/apache/bin/apxs 
--with-pdo-mysql=mysqlnd 
--with-mysqli=mysqlnd 
--with-zlib --enable-mbstring=all 
--enable-mbregex 
--enable-shared
shell>make && make install
Copy after login

Configuration if libxml2 error is reported

yum -y install libxml2 libxml2-devel
Copy after login

Configuration Apache supports PHP

1. Copy the php.ini configuration file to the specified directory

shell>  \cp -r /php/tools/php/php-7.2.6/php.ini-development /php/server/php/lib/php.ini
Copy after login

2. Modify the Apache configuration file (detect files ending in .php and hand them over to the php module for processing )

shell>  vi /php/server/apache/conf/httpd.conf
Copy after login

Add in httpd.conf (Apache main configuration file): AddType application/x-httpd-php .php

3, restart apache

/php/server/apache/bin/apachectl stop
/php/server/apache/bin/apachectl start
Copy after login

4, View the effect

shell>  echo &#39;<?php phpinfo();&#39; > /php/server/apache/htdocs/test.php
Copy after login

Management

1. mysql

[mysql configuration file]

/etc/my.cnf
Copy after login

[Enable mysql service]

/php/server/mysql/bin/mysqld_safe --user=mysql &amp;
Copy after login
Copy after login

【Close mysql service】

ps -A | grep mysql # 查看mysql进程
killall 服务名 #结束进程 关闭mysql服务
Copy after login

【Log in to MySQL database】

/php/server/mysql/bin/mysql -uroot -p
Copy after login

2. apache

/php/server/apache/bin/apachectl start
/php/server/apache/bin/apachectl stop
/php/server/apache/bin/apachectl restart
Copy after login

Configuration file: /php/server/apache/conf /httpd.conf

Optimization: Add apache and mysql as system services

1. Add apache service script

\cp -r /php/server/apache/bin/apachectl /etc/rc.d/init.d/httpd
ln -s /etc/rc.d/init.d/httpd /etc/rc.d/rc3.d/S61httpd
Copy after login

2. Edit httpd Script, add the following comment information in the second line

vi /etc/rc.d/init.d/httpd
Copy after login

Comments to support chkconfig on RedHat Linux

chkconfig: 2345 90 90

description:http server

! Note the # comment

3. Modify the script to support chkconfig

chkconfig --add httpd
chkconfig --level 2345 httpd on
Copy after login

4. Restart the service

service httpd restart
Copy after login

Add MySQL to the service under CentOS

1. Copy the mysql.server file to the /etc/init.d/ directory and rename it to mysql

\cp -r /php/tools/mysql/mysql-5.6.35/support-files/mysql.server /etc/init.d/mysql
Copy after login

2. Give the mysql file "execution" permission&& Add to Run automatically at boot

chmod 755 /etc/init.d/mysql 
chkconfig --add mysql
Copy after login

3. Restart the service

service mysql restart
Copy after login

The above is the detailed content of What are the steps to install the php source code package?. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Quick Guide CakePHP Quick Guide Sep 10, 2024 pm 05:27 PM

CakePHP is an open source MVC framework. It makes developing, deploying and maintaining applications much easier. CakePHP has a number of libraries to reduce the overload of most common tasks.

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

7 PHP Functions I Regret I Didn't Know Before 7 PHP Functions I Regret I Didn't Know Before Nov 13, 2024 am 09:42 AM

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

See all articles