Linux system source code installation PHP

Time:2022-11-25

PHP is an open source software project with many developers. It was originally an abbreviation of Personal Home Page and has been officially renamed “PHP: Hypertext Preprocessor”. PHP was created by Rasmus Lerdorf in 1994. It was originally just a simple program written in Perl language to count the number of visitors to his own website. Later, it was rewritten in C language, and at the same time, it could access the database. In 1995, PHP (Personal Home Page Tools) published the first version of PHP1. Since then, more and more websites have begun to use PHP, and there is a strong demand to add some features, such as loop statements and array variables, etc. PHP2 released in 1995 added support for mySQL.

first need aVPS serverThe environment, my version is centos7,

1. Download the installation package
http://www.php.net/downloads.php
Linux system source code installation PHP

2. yum installation environment

yum -y install \
libjpeg \
libjpeg-devel \
libpng libpng-devel \
freetype freetype-devel \
libxml2 \
libxml2-devel \
zlib zlib-devel \
curl curl-devel \
openssl openssl-devel

Linux system source code installation PHP

3. Unzip the installation package
tar xjvf php-7.1.10.tar.bz2

Linux system source code installation PHP

4. Compile the file

cd php-7.1.10

./configure \
--prefix=/usr/local/php \
--with-apxs2=/usr/local/httpd/bin/apxs \
--with-mysql-sock=/usr/local/mysql/mysql.sock \
--with-mysqli \
--with-zlib \
--with-curl \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-openssl \
--enable-mbstring \
--enable-xml \
--enable-session \
--enable-ftp \
--enable-pdo \
--enable-tokenizer \
--enable-zip

Linux system source code installation PHP

Linux system source code installation PHP

make && make install

Linux system source code installation PHP

5. Copy the configuration file and modify it

cp php.ini-development /usr/local/php/lib/php.ini

Linux system source code installation PHP

vi /usr/local/php/lib/php.ini
mysqli.default_socket = /usr/local/mysql/mysql.sock
date.timezone = Asia/Shanghai

Linux system source code installation PHP
Linux system source code installation PHP
Linux system source code installation PHP

/usr/local/php/bin/php -m //Verify installed modules

Linux system source code installation PHP

vi /etc/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Add support for file types:
DirectoryIndex index.php index.html

Linux system source code installation PHP
Linux system source code installation PHP
Linux system source code installation PHP

vi /usr/local/httpd/htdocs/index.php
<?php
phpinfo();
?>

Linux system source code installation PHP

6. Go to the browser to access your own ip
Linux system source code installation PHP

Recommended Today

How does PHP realize the flexible application of Aliyun SMS SDK in the project

install first composer require alibabacloud/sdk Then look at the alibabacloud official website documentation https://packagist.org/package… example My_composer_aliyunsms.php <?php // use Swoft\Task\Bean\Annotation\Task; // use AlibabaCloud\Client\AlibabaCloud; // use AlibabaCloud\Client\Exception\ClientException; // use AlibabaCloud\Client\Exception\ServerException; use AlibabaCloud\Client\AlibabaCloud; use AlibabaCloud\Client\Exception\ClientException; use AlibabaCloud\Client\Exception\ServerException; use AlibabaCloud\Ecs\Ecs; /** * Ali information sending class * @Task(“ali”) */ class My_composer_aliyunsms { /** * Send SMS verification code […]