Table of Contents
Website Development Series 1 - Server Environment Setup, Website Development Setup
Home Backend Development PHP Tutorial Website Development Series 1 - Server Environment Setup, Website Development Setup_PHP Tutorial

Website Development Series 1 - Server Environment Setup, Website Development Setup_PHP Tutorial

Jul 12, 2016 am 09:03 AM
lamp

Website Development Series 1 - Server Environment Setup, Website Development Setup

First of all, the audience of this series of articles is those who have just graduated and want to do website development, or want to know about other development positions. This introductory tutorial for website development assumes that the reader has a computer-related professional foundation and will skip many basics. The detailed principles can be explained by Baidu yourself or I will add them later. The characteristics of the programming language itself will not be involved in many.

Well, let me briefly introduce myself. I am a male science and engineering graduate from South China Agricultural University, majoring in software engineering. I worked in a startup company called Kailangao in Guangzhou for more than two years from 2012 to 2014, mainly responsible for Nodejs server development. and technical team management. In August 2014, I tried to start a business for three months but ended in failure. In December 2014, I worked as a front-end developer for Southern Weekend New Media for more than half a year and started to get involved in PHP development. I resigned in August 2015 and have been working in a company since. I am the technical director of a b2b start-up company in a traditional industry. I am still relatively inexperienced, and it is impossible for me to know and understand all programming languages ​​and software thoroughly. Please point out any mistakes I make.

Learning objectives:

Learning process

  • First let’s start with the goal. Our goal is to create a website, a website that others can access through the website address (URL), so the website must run on a server to provide services for visiting users, then provide this service The machine is also called a web server. How to understand the server? Compared with another noun PC (personal computer), a simple understanding is that a server is a powerful computer used to provide some services, and the software running on this physical machine varies according to the services provided. We are also divided into web servers, database servers, mail servers, cache servers, proxy servers, etc. At this time, the names of web servers also refer to software such as nginx and apache.

  • Web server, also known as website server, as the name suggests, provides website access services. So What software can function as a web server? When learning JAVA, we need to install tomcat, when learning .NET, we need to install iis, when learning PHP, we need to install apache or nginx, by the way, tomcat, iis, apache or nginx is one of the web servers we call. So, what functions do they provide as web servers?

tomcat

iis

apache

Website Development Series 1 - Server Environment Setup, Website Development Setup_PHP Tutorialnginx

Website Development Series 1 - Server Environment Setup, Website Development Setup_PHP TutorialIn order to explain the role of the web server, we should first choose one of the programming languages, configure the operating environment, and be able to access and return data , and then talk about the web server play a role. Here, I choose a typical lamp website technology combination to illustrate, and at the same time explain other types of web servers by analogy.

First of all, the simplest hello world website does not actually require a mysql database, so start with the simplest configuration. You can use wamp directly under windows (http://www.wampserver.com/ ) integration, for this tutorial, I spent 666 oceans to buy Alibaba Cloud’s Linux server, cenos7.0 64-bit .

 1. Download apache, http://httpd.apache.org/, you can download the 2.4.18 version, please refer to the installation process for details Attachment:

After apache is installed, it is installed in /usr/local/apache2 by default, so in order to start it globally, a hard link to httpd is created, ln /usr/local/apache2/bin/httpd /usr/local/bin/ .

 2. The programming language is php, first download php from http://php.net/, the latest version is 7.0.0, but here we take 5.6.16 as an example , Windows has thread-safe and non-thread-safe versions. Download the thread-safe version for now. The specific differences will not be explained for the time being.

After installing php, start php-fpm, temporarily use the default configuration, and use TCP to connect to port 9000. For details, please refer to the attachment.

 3. Then I hope that when accessing the localhost address or 127.0.0.1, the web page returns the hello world string and displays it to the browser, so I write a file named index.php

vim /var/www/test/index.php (the directory does not exist and needs to be created first)

<span>1</span> <?<span>php</span>
2 <span>echo</span> "hello world";
Copy after login

  • Okay, at this point, how to connect these three to achieve web page access?

xxx.xxx.xxx.xxx - - [16/Dec/2015:15:57:51 0800] "GET / HTTP/1.1" 200 26 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit /537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"

4. The output content is the php file code we wrote, not the execution result. Why? Because php is a scripting language, it requires the previously installed php to interpret the execution output. Therefore, the next step is to add php to the apache configuration. There is more than one mode for apache to run php. The fastcgi mode is used here, and the others will be explained later. Pattern practices and principles. Remove the comments of the following two modules, add the module configuration, and restart the apache server.

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so


 ProxyPass "/" "fcgi://127.0.0.1:9000/var/www/test/index.php" enablereuse=on

Summary:

Of course, there are still many small problems to be solved in the entire configuration process. While solving these problems, it also forces me to learn and improve myself. If you have any questions, leave a comment and I will try my best to answer them. But in the next issue, I will make a big reversal. 1. I will use Nginx as the reverse proxy server to replace apache and adopt the LNMP architecture; 2. I will configure the Laravel PHP framework and be able to access Laravel's hello world home page, Larevel is also a framework used for website development, rather than building a website from scratch.

Attachment: LAMP environment setup

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1081087.htmlTechArticleWebsite Development Series 1 - Server Environment Setup, Website Development Setup First of all, the audience of this series of articles is fresh graduates Want to do website development, or want to learn about website development in other development positions...
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)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months 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)

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,

Explain the concept of late static binding in PHP. Explain the concept of late static binding in PHP. Mar 21, 2025 pm 01:33 PM

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

Framework Security Features: Protecting against vulnerabilities. Framework Security Features: Protecting against vulnerabilities. Mar 28, 2025 pm 05:11 PM

Article discusses essential security features in frameworks to protect against vulnerabilities, including input validation, authentication, and regular updates.

Customizing/Extending Frameworks: How to add custom functionality. Customizing/Extending Frameworks: How to add custom functionality. Mar 28, 2025 pm 05:12 PM

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.

How to send a POST request containing JSON data using PHP's cURL library? How to send a POST request containing JSON data using PHP's cURL library? Apr 01, 2025 pm 03:12 PM

Sending JSON data using PHP's cURL library In PHP development, it is often necessary to interact with external APIs. One of the common ways is to use cURL library to send POST�...

Describe the SOLID principles and how they apply to PHP development. Describe the SOLID principles and how they apply to PHP development. Apr 03, 2025 am 12:04 AM

The application of SOLID principle in PHP development includes: 1. Single responsibility principle (SRP): Each class is responsible for only one function. 2. Open and close principle (OCP): Changes are achieved through extension rather than modification. 3. Lisch's Substitution Principle (LSP): Subclasses can replace base classes without affecting program accuracy. 4. Interface isolation principle (ISP): Use fine-grained interfaces to avoid dependencies and unused methods. 5. Dependency inversion principle (DIP): High and low-level modules rely on abstraction and are implemented through dependency injection.

What exactly is the non-blocking feature of ReactPHP? How to handle its blocking I/O operations? What exactly is the non-blocking feature of ReactPHP? How to handle its blocking I/O operations? Apr 01, 2025 pm 03:09 PM

An official introduction to the non-blocking feature of ReactPHP in-depth interpretation of ReactPHP's non-blocking feature has aroused many developers' questions: "ReactPHPisnon-blockingbydefault...

See all articles