回复内容:
装个homestead是最简单的Laravel Homestead
homestead是laravel提供给开发者的一个vagrant环境,当然用来做其他php框架或者原生php代码的服务器都很适合,与本机环境无关,可以和virtualhost 共享目录,包括nginx,redis,mysql,memcache等服务都帮你装好了。
以目前来看,还是用vagrant或者docker之类的架设服务最好,在mac上虽然自带apache和php,但每次mac osx升级都会自动升级php和apache,听起来很好是不是,但实际上每次都是噩梦,我在本机php安装了一些额外模块,升级的时候全给抹了,php.ini里的设置全都还原了(当然升级操作系统前的php.ini系统帮你改名备份了),apache的设置也还原了,于是又要把所有的用到的php扩展安装一次。
而且在本机上自己配环境不利于团队开发,每个人的开发环境php、mysql等版本都有细微差别,包括操作系统linux下和windows下的mysql版本不同处理的结果也有细微不同,我就遇到过很多次这样的坑,所以还是采用vagrant的虚拟host吧,只要配置好一份环境,可以把vhost当成vagrant的box导出,分发给团队里的其他人,这样所有人都保持在一个环境下工作,无论他本机是mac还是windows。这样甚至好过在公司里架设一个开发服务器,每个人互不影响,每个环境都是一致而且独立的,不在办公室办公的时候也不依赖于内网的开发服务器才能干活(当然,我反对任何形式的加班) http://dancewithnet.com/2010/05/09/run-apache-php-mysql-in-mac-os-x/,这个上面写的挺不错的,我已经搞定了 mac上面其实比windows做开发省心很多了,其实只需要下个mysql就行了,最重要的是mac上面的linux命令用起来比window那些蹩脚的命令爽太多 如果你是新手,入门 php 开发的话,建议采用 homebrew 安装
这样可以减少很多编译引发的问题,减少配置环境的流程,可以最大程度的避免自己因配置环境不成功而失去开发热情以及对学习的懈怠
中文参考文档:[php] 在mac下使用 Homebrew 配置 Nginx、php、Mysql 开发环境
英文参考文档:Install Nginx, PHP-FPM, MySQL and phpMyAdmin on OS X Mavericks or Yosemite 来吧,今天刚好自己要试试,就觉得自己写一下。
之前用nginx+liunx多一些,所以mac自带的apache基本上对我没什么用,所以果断打算装虚拟机跑liunx然后在安装环境。
你需要:
VirtualBox+Vagrant+centos(或者别的liunx镜像)+PHP环境安装的东西
基本上就是这样,virtualbox是号称最好的免费虚拟机,vagrant是用来安装部署虚拟开发环境的。别的不用说了。
为毛用这个呢,因为这个简直是开发神器啊!!
通过Vagrant封装一个Linux的开发环境分发给团队成员。成员可以在自己喜欢的桌面系统(Mac/Windows/Linux)上开发程序,代码却能统一在封装好的环境里运行,非常霸气。
来吧,下载virtualbox:
Downloads – Oracle VM VirtualBox

下载vagrant
Download - Vagrant by HashiCorp

A list of base boxes for Vagrant

安装什么的就一步一步来就好了


安装好了之后再终端添加centos的镜像
假设你下载的box的目录是 ~/centos.box
在终端输入 $ vagrant box add centos65 ~/centos65.box
add后面的centos65是你的命名的box的名字

初始化开发环境
创建一个开发目录(比如:~/workspace),你也可以使用已有的目录,切换到开发目录里,用 centos65 镜像初始化当前目录的环境:
$ cd ~/workspace # 切换目录
$ vagrant init centos65 # 初始化
$ vagrant up # 启动环境
brew install php7atom 编写代码
开始学习时,只需要命令行运行php hello.php
或用php 自带web server
php -S 0.0.0.0:8090
或
php -S 127.0.0.1:8090 vagrant+virtualBox+centos Mac 下快速搭建php环境之集成软件推荐 可以去看看这篇文章,我个人建议最好不用系统自带的php环境。我使用了XMAPP 、AMPPS 、MAMP PRO(收费,可以团购),做了对比,还是MAMP PRO最方便,最好操作.定制性也最好.
=========
update:2015-11-18 21:56:58
自动发现了vagrant+box 这个神奇的组合之后,果断推荐Mac的童鞋使用
使用教程:
Go-in-Action/01.2.md at master · astaxie/Go-in-Action · GitHub 吐血回答这个问题。个人感觉自己弄真的非常麻烦,从刚开始学的时候配iis到后来配apache,到后来开始用集成环境,真心觉得,如果是学习和测试,那么集成环境无疑在开始的时候方便太多太多了。
php环境,windows上推荐wamp,好用,用了3年,后来换了mac,一开始用了xampp,这个真心蛋疼,一开始还好,用了半个月,但是某次重启后,报一个 must be a document (具体不记得了)真心操蛋,有说是selinux问题的,反正无论如何无法解决。 后来换mamp了,使用还可以。 VirtualBox + Vagrant
利用虚拟机,安装一个linux 系统,环境搭建在 Linux 系统中。
安装手册:VirtualBox + Vagrant

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

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.

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

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

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