1. Install MySQL
At present, few web servers run static pages. If you want to run a dynamic website, of course you cannot do without a database. Although I have written about how to install MySQL in previous articles, it feels like it has been a long time. MySQL is not installed, so I will just post the steps without explaining too much
#useradd mysql
#tar zxvf mysql-5.0.40.tar.gz
#cd mysql-5.0.40
# ./configure --prefix=/usr/local/mysql
#make && make install
#/usr/local/mysql/bin/mysql_install_db --user=mysql //Initialize MySQL database
#chown -R mysql /usr/local/mysql/var
#/usr/local/mysql/bin/mysqld_safe & //Start MySQL
#/usr/local/mysql/bin/mysqladmin -u root password 123456 //Set the MySQL password
#cp support-files/my-medium.cnf /etc/my.cnf
#echo "/usr/local/mysql/bin/mysqld_safe &" >>/etc/rc.local
2. Install PCRE
PCRE is a regular expression used by perl. The purpose is to make the installed software support regular expressions. By default, Nginx only processes static web page requests, that is, html. If it comes from a dynamic web page request, such as *.php, then Nginx will query the path based on the regular expression, and then hand over *.PHP to PHP for processing
#rpm -qa | grep pcre /Before deleting the PCRE that comes with the system, you must first back up the libpcre.so.0 file. Because the RPM package is too closely related, if there is no libpcre.so.0 file after deletion, we will not be able to install PCRE.
#rpm -e --nodeps pcre-6.6-1.1 //Delete the PCRE that comes with the system
# tar zxvf pcre-8.00.tar.gz
#cd pcre-8.00
#cp /libpcre.so .0/lib // copy the libpcre.so.0 before the PCRE that we comes with the PCRE that comes with the PCRE to/lib directory
#./Configure // Configure PCRE, because PCRE is a library, not like Pache Pache , php, postfix and other such programs, so we can just choose the default path when installing. This will avoid some unnecessary trouble when installing other things later. After executing this, the following picture will be displayed. The above shows our PCRE configuration
#make && make install
On the Internet, I saw that many people are very troublesome when installing Nginx. They use a lot of options during configuration. Can you really implement it? So many functions? It made me more and more depressed. If you follow the author’s steps to install Nginx this time, you only need to specify the installation path of Nginx when installing Nginx
#tar zxvf nginx-0.8.24.tar.gz
#cd nginx-0.8 .24
#./configure --prefix=/usr/local/nginx //You only need to specify a path in this link
#make && make install
#/usr/local/nginx/sbin/nginx //Start Nginx
#echo "/usr/local/nginx/sbin/nginx" >>/etc/rc.local
There are two processes after Nginx starts, master is the main process and worker is the working process. As shown in the picture below
After starting NGINX, we can enter http://localhost in the browser to view it, as shown in the picture below
Since PHP is installed, then GD is It is essential and the installation of GD will not be described here.
1. Install libpng
#tar xvf libpng-1.2.10.tar.tar
#cd libpng-1.2.10
#./configure -- prefix=/usr/local/png
#make;make install
#ln -s /usr/local/png/lib/* /usr/lib/
2. Install jpeg
#mkdir /usr/local /jpeg
#mkdir /usr/local/jpeg/bin
#mkdir /usr/local/jpeg/lib
#mkdir /usr/local/jpeg/include
#mkdir /usr/local/jpeg/man
#mkdir /usr/local/jpeg/man/man1
#tar xvf jpegsrc.v7.tar.tar
#cd jpeg-7
#./configure --prefix=/usr/local/jpeg - -enable-shared --enable-static
#make;make install
#ln -s /usr/local/jpeg/lib/* /usr/lib/
3. Install freetype
#tar xvf freetype- 2.3.9.tar.tar
#cd freetype-2.3.9
#./configure --prefix=/usr/local/freetype
#make;make install
4. Install fontconfig
#tar zxvf fontconfig-2.4.2.tar.gz
#cd fontconfig-2.4.2
#./configure --prefix=/usr/local/fontconfig --with-freetype-c/local/freetype/bin/freetype-config
#make;make install
5. Install GD
#tar zxvf gd-2.0.32.tar.gz
#cd gd-2.0.32
#./configure --prefix=/usr/local/gd --with-png=/usr/local/png --with- jpeg=/usr/local/jpeg --with- freetype=/usr/local/freetype --with-fontc/local/fontconfig
#cp /usr/local/png/include/png.h ./
# cp /usr/local/png/include/pngconf.h ./
#make;make install
6. Install PHP
This place is the most important place, because by default, there is a gap between Nginx and PHP There is no feeling at all. In the past, many friends have built Apache+PHP. Apache+PHP generates module files after compilation, while Nginx+PHP requires PHP to generate executable files, so fastcgi technology must be used to realize the integration of Nginx and PHP. This only requires us to install and enable FastCGI. This time we installed PHP not only using FastCGI, but also using something like PHP-FPM. To put it bluntly, PHP-FPM is a manager for managing FastCGI. It is purely a plug-in for PHP. If you want to use it when installing PHP When using PHP-FPM, you need to install PHP-FPM into PHP in the form of a patch, and PHP must be consistent with the PHP-FPM version. This is a must, remember!
First we downloaded PHP and PHP-FPM to the same directory. This time we used php-5.3.0.tar.bz2 and php-5.3.0-fpm-0.5.12.diff.gz. They were downloaded. In the same directory #tar xvf php-5.3.0.tar.bz2#gzip -cd php-5.3.0-fpm-0.5.12.diff.gz | patch -d php-5.3.0 -p1 / /Add php-5.3.0-fpm-0.5.12.diff.gz to php-5.3.0 as a patch#cd php-5.3.0#./configure --prefix=/usr/ local/php --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/png --with-freetype-dir =/usr/local/freetype --with-mysql=/usr/local/mysql --enable-fastcgi --enable-fpmNote: Nginx+PHP integration, --enable-fastcgi and - must be enabled during installation -enable-fpm, what these two options do is already described above. After execution, the system will prompt that --enable-fastcgi is an unknown option, we don’t need to ignore it
5. Integrate Nginx and PHP
As mentioned above, Nginx does not handle it itself Dynamic web page requests, and Nginx will transfer the dynamic requests to PHP. Let’s open the Nginx configuration file and take a look#vi /usr/local/nginx/conf/nginx.conf //The target part is what we will modify laterNote: The above /usr/local/nginx/html is the path where our PHP website is placed
Then only Nginx itself knows how to find PHP. No, you still need PHP to know how to find Nginx. PS: Have you ever seen JJMM on the street know each other when dating, or do you not know how to connect with each other? We don’t need to worry about this. PHP-FPM has already defined in the configuration file where to accept PHP requests. We can open the configuration file and take a look#vi /usr/local/php/etc/php-fpm.conf6. Test
We have defined the storage path of the PHP website in the nginx configuration file. The path is /usr/local/nginx/htmlNext, we will create a new PHP page test page in this directory. The file name is test.php and the content is as follows
After restarting PHP and nginx (you can kill the process to close it and then start it up) we are browsing Enter http://localhost/test.php in the server, and the following interface appears, which is considered successful
The above introduces the detailed configuration diagram of CentOS+Nginx+PHP+MySQL, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

What’s still popular is the ease of use, flexibility and a strong ecosystem. 1) Ease of use and simple syntax make it the first choice for beginners. 2) Closely integrated with web development, excellent interaction with HTTP requests and database. 3) The huge ecosystem provides a wealth of tools and libraries. 4) Active community and open source nature adapts them to new needs and technology trends.

PHP and Python are both high-level programming languages that are widely used in web development, data processing and automation tasks. 1.PHP is often used to build dynamic websites and content management systems, while Python is often used to build web frameworks and data science. 2.PHP uses echo to output content, Python uses print. 3. Both support object-oriented programming, but the syntax and keywords are different. 4. PHP supports weak type conversion, while Python is more stringent. 5. PHP performance optimization includes using OPcache and asynchronous programming, while Python uses cProfile and asynchronous programming.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP remains important in the modernization process because it supports a large number of websites and applications and adapts to development needs through frameworks. 1.PHP7 improves performance and introduces new features. 2. Modern frameworks such as Laravel, Symfony and CodeIgniter simplify development and improve code quality. 3. Performance optimization and best practices further improve application efficiency.

PHPhassignificantlyimpactedwebdevelopmentandextendsbeyondit.1)ItpowersmajorplatformslikeWordPressandexcelsindatabaseinteractions.2)PHP'sadaptabilityallowsittoscaleforlargeapplicationsusingframeworkslikeLaravel.3)Beyondweb,PHPisusedincommand-linescrip

PHP type prompts to improve code quality and readability. 1) Scalar type tips: Since PHP7.0, basic data types are allowed to be specified in function parameters, such as int, float, etc. 2) Return type prompt: Ensure the consistency of the function return value type. 3) Union type prompt: Since PHP8.0, multiple types are allowed to be specified in function parameters or return values. 4) Nullable type prompt: Allows to include null values and handle functions that may return null values.


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

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

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