Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The process of building a local development environment for PHP

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article focuses on "the process of building a local development environment for PHP". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "the process of building a PHP local development environment".

Terminal tools and Shell

In the Mac environment, it is recommended to use iTerm2 to replace the command line tool Terminal that comes with Mac:

Iterm2

And installing Oh My ZSH uses zsh to replace the default bash as Shell,Oh My ZSH provides a complete plug-in system (installed plug-ins are located in the ~ / .oh-my-zsh/plugins directory): https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins

Oh-my-zsh-plugins

You can install as needed to create your own efficient Shell platform. If you are not familiar with these two tools, you can refer to this tutorial: the programmer internals series-iTerm and Zsh (https://xiaozhou.net/learn-the-command-line-iterm-and-zsh-2017-06-23.html).

PHP integrated development environment

Since we will develop the project based on Laravel as the development framework, it is recommended to install Laradock in the Mac environment as the local development environment. For specific installation steps, please refer to this tutorial:

Using Laradock to build Docker-based Laravel Development Environment (https://xueyuanjun.com/post/9608) in Mac/Windows system

Note: as long as docker-compose up-d nginx mysql runs successfully, subsequent Laravel application access tests can be skipped temporarily.

Laravel-docker

Of course, you can also choose Valet, Homestead, XAMPP (Mac, Windows, Linux platforms are supported)

Xampp

And MAMP (supports Mac and Windows platforms)

Mamp

You can complete the construction of the local PHP integrated development environment through the tutorials pointed to by the corresponding links or searching on your own. However, subsequent practical projects will be demonstrated based on Laradock as the default development environment.

Install the software through Homebrew

Using Laradock as the development environment, Laradock has built-in Nginx, MySQL, PHP and other essential components for Web development, but usually we still install PHP dependencies locally through Composer and JavaScript dependencies through NPM, because this is faster, so we need to install PHP, Composer and NPM on the local command line.

On Mac systems, it is recommended to use Homebrew to install software on the command line (comparable to the apt tool in Ubuntu or the yum tool in CentOS):

Homebrew

The installation instructions for Homebrew have already appeared in the screenshot above. Just copy them to the local terminal window for execution. After the installation is completed, you can configure domestic images to accelerate the download speed of Homebrew installation software (there are many related tutorials online, so we will not demonstrate the specific process).

After the above configuration is completed, you can install PHP, Composer and NPM through the brew install instruction:

Brew install php

Brew install composer

Brew link composer

Brew install npm

The above instructions can be executed separately to install. After the installation is completed, you can check the software version locally to verify whether the installation is successful:

At this point, I believe that everyone has a deeper understanding of the "PHP local development environment building process", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report