How to install php5.6 on ubuntu: first install the ppa source; then update the source through the "apt update" command; then install php5.6 through the install command; and finally configure Nginx to support PHP extensions.
The operating environment of this article: ubuntu 16.04 system, PHP5.6 version, DELL G3 computer
Ubuntu installation php5.6
1.
apt install python-software-properties -y
2. Install ppa source
apt install software-properties-common python-software-properties
3.
LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
4. Update the source
apt update
5. Upgrade source
apt upgrade -y
6. Install php
apt install php5.6 php5.6-fpm php5.6-mysql php5.6-gd php5.6-mbstring php5.6-curl php5.6-soap php5.6-redis php5.6-xml php5.6-apcu php5.6-mcrypt -y
7. Configure Nginx to support PHP extension
vim /etc/nginx/fastcgi_params # 在文档最后添加一下代码: fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
8. Create site files and php test files
1 , mkdir -p /www/test
2. vim /www/test/info.php
Enter the content
<?php phpinfo();
9. Modify the site configuration file
vim /etc/nginx/conf.d/default.conf # 清空文档,把以下内容复制到文档中: server { listen 80; # server_name localhost; root /www/test; index index.php index.html index.htm; location ~ \.php$ { fastcgi_pass unix:/var/run/php/php5.6-fpm.sock; include fastcgi_params; } location ~ /\.ht { deny all; } } # 改完之后保存
10. File access permissions
vim /etc/nginx/nginx.conf
Modify a line [user nginx;] to [user www-data;]
11. Restart the Nginx service
/etc/init.d/nginx restart
12. External network access: http://host IP/info.php
13. If the phpinfo content is displayed, it will be successful, otherwise it will fail.
Recommended learning: " PHP video tutorial》
The above is the detailed content of How to install php5.6 on ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Linux new version
SublimeText3 Linux latest version

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.
