search
HomeBackend DevelopmentPHP Tutorialmacos - When developing PHP on Mac, do you use a virtual machine or build the environment directly under Mac?

As the title says, I want to do PHP development under mac. I want to see the real-time effect locally, and then deploy it to the server (CentOS) after development, or use SSH to directly connect to the server VIM for development, but I am a newbie in PHP, so I still want to Use PHPStrom (I just bought it a year ago, so there is no need to waste it, and the integrated development environment may be helpful for development).
The above is the background.
I would like to know what method PHP masters use to develop PHP under Mac, and what method is recommended for novices. If you set up the environment locally on Mac, transplant it to the server and need to reconfigure it, etc. It will be a hassle. There won't be too many differences and problems.
Also, does PHPStorm support remote editing of projects on the server? I know that TextMate and the like have related command line plug-ins. You can open remote files via SSH and bind them remotely after editing, but I don’t want to use tools like TextMate or Sublime this time

I hope everyone who sees the problem or seniors can discuss it with me and help me. I will always refresh the comments online.

-------Update---------

There is such a big difference in everyone’s answers

------Update again---------

In the end, my decision was consistent with the accepted answer, thank you all friends.

In addition, what I want to ask is, what's wrong with this question? Is there something wrong with being downvoted by -1?

Reply content:

As the title says, I want to do PHP development under mac. I want to see the real-time effect locally, and then deploy it to the server (CentOS) after development, or use SSH to directly connect to the server VIM for development, but I am a newbie in PHP, so I still want to Use PHPStrom (I just bought it a year ago, so there is no need to waste it, and the integrated development environment may be helpful for development).
The above is the background.
I would like to know what method PHP masters use to develop PHP under Mac, and what method is recommended for novices. If you set up the environment locally on Mac, transplant it to the server and need to reconfigure it, etc. It will be a hassle. There won't be too many differences and problems.
Also, does PHPStorm support remote editing of projects on the server? I know that TextMate and the like have related command line plug-ins. You can open remote files via ssh and bind them remotely after editing, but I don’t want to use tools like TextMate or Sublime this time

I hope everyone who sees the problem or seniors can discuss it with me and help me. I will always refresh the comments online.

-------Update---------

There is such a big difference in everyone’s answers

------Update again---------

In the end, my decision was consistent with the accepted answer, thank you all friends.

In addition, what I want to ask is, what's wrong with this question? Is there something wrong with being downvoted by -1?

As a newbie, you can consider my ideas. Use MAC for local development. Do not use vagrant, docker, or virtual machines. The reason is very simple. In the initial learning stage, the MAC environment is not much different from the server environment. The introduction of Docker and Vagrant will only affect the learning of PHP. It is better to focus on the real work than to spend time messing around with those things. There is no need to deploy the project to the server after development. As long as it can run under your MAC. RememberThe advantage of MAC development is that it is similar to the server environment, you are not using windows...

Install the development environment directly on mac

PHPStrom supports ftps synchronization code to the server, and can be set to automatically synchronize when pressing save

Or you can use samba or rsync
Mac’s server environment is similar to Linux

Are they all Unix? Just use it

No one recommends Vagrant, I’m not convinced

CentOS 7.0 + Docker

Two laptops.

Mac: mainly used to assist development
Ubuntu: main development machine

As for the development environment and server environment, I personally feel that if the code problem is not big, you will not encounter many problems when going online. Moreover, the two machines are great when developing some modules, such as WeChat and DingTalk.

What the poster said Using SSH to directly connect to the server for VIM development is not feasible in our company.

MAMP FREE VERSION

I directly set the SB editor as the default editor of sftp, edit directly, and directly throw a file manager into it for online web editing.

Win users come here and get the answer:
Linux virtual machine or independent Linux server.

Personally, I would never create a running environment on the local machine. There are too many uncertainties (Mac is okay, but Win is really bad). It is best for the running environment to be the same as the final production environment, with fewer problems.

PHPStorm and all editors have code synchronization functions, and even if they don’t, there is third-party code synchronization.

Your question: Is it troublesome to build the environment locally, migrate it to the server and need to reconfigure it, etc.? Will there be too many differences... This depends on the dependence of your project on the running environment. . For example, my own project A has almost no dependencies and can be used just by copying it; but project B needs to write files to the server (the absolute path in Linux is different from Win) and read the database (you need to install Mysql and redis on Win). You even have to run an exec shell script (Win is out of the question).

I don’t use a Mac, but it is recommended to set up an environment, or directly use one-click installation package (inherit the development environment). A virtual machine is not necessary

<code>IF ENV=Dev 
    Vagrant
    
    
IF ENV=Product
    Docker     </code>

Thanks for the invitation.

Local development:

<code>XAMPP
</code>

IDE:

<code>PHPStorm
</code>

There must be a deviation between the server environment and the local environment, and you need to deal with it yourself.

But in recent years, there has been a very cool thing called Docker

<code>一个服务器环境的虚拟机,现在和将来都会是主流。</code>

Our company uses VirtualBox+vagrant

Nginx+php-fpm built locally. I used vagrant before, but the speed was a bit slow. Comparing various aspects, I think it is better to build the native one locally.

If you are a newbie, you don’t need to think so much. First, set it up locally and fiddle around for a while. If you encounter many problems and the system jumps a few times, you will get Docker:)

Recommend Vagrant: the configuration is simple, if you are not familiar with Linux, it will be enough for you, and you can restore it at any time if the configuration is broken. If you don’t want to mess around, there are many ready-made environment packages that others have prepared. You can download them and use them directly. This way you can spend more time learning PHP knowledge instead of messing with the environment. In addition, unless you are very familiar with Vim, otherwise Don't assume that it can bring you the same work efficiency as phpstorm. It's okay to write a helloworld, but forget it if you're working on a project.

Recommend Vagrant

Cultivate the collaboration ability of DevOps development and operation and maintenance,
Ubuntu Desktop + Ubuntu Server is the best and most productive combination.
I use Ubuntu desktop to develop PHP, the editor is Geany, and the IDE occasionally uses Netbeans.
Among them, Netbeans Supports remote sftp project development, that is, the project is built on the development machine, but the running environment is a remote Linux server.
If you use a Mac, you can use VirtualBox to virtualize a CentOS to run it, but it is not recommended because virtualization takes up a lot of resources and has poor performance. In case of loss, it is better to build a PHP environment locally on Mac.

Use brew to directly install the required components, which is very flexible, but using a virtual machine is slower. I also wrote an article saying that it is not recommended for people using Unix-like systems to use virtual machines for web development.

macOS+vagrant

Why use a virtual machine when you have a Mac? UNIX itself is not much different from Linux in terms of instructions

No need, I use xampp, but I do the front-end. . Just concentrate on writing code and understand a little bit about the server environment

You can try Docker virtual containers. Now the official Docker image is available in China, and the partner is Alibaba Cloud

There is an integrated environment for beginners: xampp
Learn more: build your own environment

I also develop on Mac, but I am not a professional PHP developer. I just wrote a few projects. Using Mamp to build an environment is very, very easy to use. One-click basic settings and subsequent configuration modifications are also very convenient. It is recommended for novices to use this.
The software developed is zendStudio, which is quite comfortable to use and has complete functions. It's just that this software is not free. I used the cracked version when I was a student party.

Statement
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
The Continued Use of PHP: Reasons for Its EnduranceThe Continued Use of PHP: Reasons for Its EnduranceApr 19, 2025 am 12:23 AM

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: Exploring Their Similarities and DifferencesPHP and Python: Exploring Their Similarities and DifferencesApr 19, 2025 am 12:21 AM

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 and Python: Different Paradigms ExplainedPHP and Python: Different Paradigms ExplainedApr 18, 2025 am 12:26 AM

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 and Python: A Deep Dive into Their HistoryPHP and Python: A Deep Dive into Their HistoryApr 18, 2025 am 12:25 AM

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.

Choosing Between PHP and Python: A GuideChoosing Between PHP and Python: A GuideApr 18, 2025 am 12:24 AM

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 and Frameworks: Modernizing the LanguagePHP and Frameworks: Modernizing the LanguageApr 18, 2025 am 12:14 AM

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.

PHP's Impact: Web Development and BeyondPHP's Impact: Web Development and BeyondApr 18, 2025 am 12:10 AM

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

How does PHP type hinting work, including scalar types, return types, union types, and nullable types?How does PHP type hinting work, including scalar types, return types, union types, and nullable types?Apr 17, 2025 am 12:25 AM

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.

See all articles

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

Video Face Swap

Video Face Swap

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

Hot Tools

MantisBT

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.

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools