1. Conditions and environment preparation
First of all, you need to figure out what hardware conditions are required, what basic elements are needed to build a website locally, and the various The role of elements. The editor has compiled the following common software that is necessary for quickly building a website.
1. Php: Chinese name, hypertext preprocessor, relying on the web server, used to parse web pages written in php language, so that web pages are presented as html pages that we come into contact with daily;
2. Apache server: A very powerful web server, similar to the IIS server in the windows environment. It is like a container. After the web application is placed in it, the user can access the website in the specified directory through the browser. Interact with it;
3. Mysql database: Not much to say, everyone basically knows that it is used to store website data;
4. phpMyAdmin: a database management software, generally used for Backend management is mainly used to facilitate the operation of mysql;
5. WordPress program: a simple website program that is suitable for all novice webmasters.
2. Setting up the Apache server
1. First unzip the installed Apache software. Generally, the downloaded programs are compiled programs, so you only need to perform the necessary steps. Configure and install successfully.
2. Open the console as an administrator and use the command to install the program.
Then enter the services.msc command in the console, enter the service desk, and check whether apache is installed successfully.
Related recommendations: "PHP Tutorial"
After the above configuration, you can find that there is an extra apache in the service console name. If there is this service before the Apache server is installed, it means that this computer has been installed before. You can configure it directly. If you want to reinstall, you need to delete the service first, otherwise you will need to delete it during the installation process. You will encounter a lot of troublesome problems. Delete the command: sc delete apache. You can also delete it by opening the console with administrator permissions and entering this command.
3. Start the Apache server
Enter the decompressed folder of Apache, enter the bin directory, find the ApacheMonitor.exe file, and click it.
# Then a window will pop up, click Start to start the Apache service.
The establishment of Apache is so simple. Here I would like to remind webmaster friends that when downloading Apache from the official website, you must clearly check the compatible VC environment and install the matching Install Apache after using VC, otherwise you will get an error during the installation process.
3. PHP environment configuration
1. Similarly, the PHP module selection is also an installation-free version. You can directly unzip it to the folder you are accustomed to and configure it. Please remind the webmaster. When downloading from the official website, you should also pay attention to system and VC environment support. The decompression path is as follows:
Enter the decompression directory of php, find either php.ini-production or php.ini-development, and rename it to php.ini; then change D:\php\ext and D:\ php\Add to the environment variable PATH of the system variables
2. Configure php.ini
The configuration mentioned here is mainly to enable several common php extensions Projects can be opened as needed. Open the php.ini file with Notepad and configure it as follows:
(1), find; extension_dir = "ext", remove the semicolon in front
(2), find; extension=php_mbstring .dll, remove the semicolon in front
(3), find; extension=php_mysqli.dll, remove the semicolon in front
(4), find; extension=php_pdo_mysql.dll, remove The preceding semicolon
php environment means that the configuration is completed. We will mention loading the php module in the Apache configuration file later.
4. Mysql configuration and installation
1. The Mysql I want to talk about here is also an installation-free version. You can directly unzip it to the folder configuration you are accustomed to naming. The decompression path As shown below:
2. Configure my-default.ini
Enter this path and find my-default.ini, open it with Notepad, and modify the file The values of basedir and datadir in the content are mainly to fill in the installation path and the path where data is saved. Correctly fill in the following figure:
3. Configure environment variables
Copy the bin directory path decompressed by Mysql to the system environment, separated by semicolons, as shown below:
4. Install Mysql service
Open the console with administrator rights, find the bin directory where Mysql is installed, and then use the mysqld –install command to install it. The installation is successful as shown below:
Then use the command net start mysql to start the database. The configuration and installation of the Mysql database ends here.
5. Configure the Apache server
After configuring the php environment and installing Mysql, you need to make changes to the Apache configuration file to facilitate the next step. Analysis of php website.
Use Notepad to open the file D:\Apache24\conf\httpd.conf. Since the latest version of Apache's ServerRoot is enabled by default, and the relative path is used based on the root path after decompression, it is basically not needed. Changes, here we only talk about the attributes and modules that need to be changed.
1. Find DirectoryIndex. Since it is a website program developed by PHP, add index.php;
2. Add the PHP module to let apache support PHP. Since the editor uses PHP7, so in At the end of the configuration file, add the following code:
LoadModule php7_module "D:/php/php7apache2_4.dll"
AddType application/x-httpd-php .php
PHPIniDir " D:/php" *Inform Apache of the location of php.ini*
The specific screenshot is as follows:
At this point, the basic configuration of httpd.conf is completed. Save httpd.conf. If you want to add some modules or enable some module functions to the subsequent website, you will basically make changes in this configuration file.
6. WordPress website configuration
Just download it from the official website of WordPress, then copy the compressed package to the path D:\Apache24\htdocs and decompress it. Since Apache's DocumentRoot path has been defined as the htdocs directory, you can directly jump to the WordPress configuration interface by accessing http://localhost locally. As shown below:
The above is the detailed content of What are the steps to build a php website?. For more information, please follow other related articles on the PHP Chinese website!

php把负数转为正整数的方法:1、使用abs()函数将负数转为正数,使用intval()函数对正数取整,转为正整数,语法“intval(abs($number))”;2、利用“~”位运算符将负数取反加一,语法“~$number + 1”。

实现方法:1、使用“sleep(延迟秒数)”语句,可延迟执行函数若干秒;2、使用“time_nanosleep(延迟秒数,延迟纳秒数)”语句,可延迟执行函数若干秒和纳秒;3、使用“time_sleep_until(time()+7)”语句。

php除以100保留两位小数的方法:1、利用“/”运算符进行除法运算,语法“数值 / 100”;2、使用“number_format(除法结果, 2)”或“sprintf("%.2f",除法结果)”语句进行四舍五入的处理值,并保留两位小数。

判断方法:1、使用“strtotime("年-月-日")”语句将给定的年月日转换为时间戳格式;2、用“date("z",时间戳)+1”语句计算指定时间戳是一年的第几天。date()返回的天数是从0开始计算的,因此真实天数需要在此基础上加1。

php字符串有下标。在PHP中,下标不仅可以应用于数组和对象,还可应用于字符串,利用字符串的下标和中括号“[]”可以访问指定索引位置的字符,并对该字符进行读写,语法“字符串名[下标值]”;字符串的下标值(索引值)只能是整数类型,起始值为0。

方法:1、用“str_replace(" ","其他字符",$str)”语句,可将nbsp符替换为其他字符;2、用“preg_replace("/(\s|\ \;||\xc2\xa0)/","其他字符",$str)”语句。

php判断有没有小数点的方法:1、使用“strpos(数字字符串,'.')”语法,如果返回小数点在字符串中第一次出现的位置,则有小数点;2、使用“strrpos(数字字符串,'.')”语句,如果返回小数点在字符串中最后一次出现的位置,则有。

在php中,可以使用substr()函数来读取字符串后几个字符,只需要将该函数的第二个参数设置为负值,第三个参数省略即可;语法为“substr(字符串,-n)”,表示读取从字符串结尾处向前数第n个字符开始,直到字符串结尾的全部字符。


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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

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

Dreamweaver Mac version
Visual web development tools

Notepad++7.3.1
Easy-to-use and free code editor

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft
