search
HomeBackend DevelopmentPHP ProblemSteps to install PHP environment on Apple computers

Steps to install PHP environment on Apple computers

Oct 21, 2019 am 11:28 AM
phpInstallApple Computer

Steps to install PHP environment on Apple computers

Steps to install PHP environment on Apple computers:

1. First we need to install Homebrew

2. Enter the command in the terminal

// 创建目录,如果你没有创建过该目录
sudo mkdir /usr/local/var
sudo chmod 777 /usr/local/var
//修改成你自己的用户名和组,如果你没有创建过该目录
sudo mkdir /usr/local/sbin/
sudo chown -R <username>:<group> /usr/local/sbin//由于我本身一直在使用5.6版本,故上述步骤省略,下面进入正题
//添加PHP库
brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
//关闭老版本的PHP56或55或更早版本 进程
brew unlink php56
//开始安装PHP7
brew install php70
//开启PHP70进程
brew link php70
//输入命令,查看是否成功
php -v
//成功后显示下面信息
PHP 7.0.8 (cli) (built: Jul 13 2016 15:19:21) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

3. Modify the apache configuration file

sudo vim /etc/apache2/httpd.conf
//找到大约168行,该语句,屏蔽后,根据自己的路径,添加php7的.so文件
#LoadModule php5_module libexec/apache2/libphp5.so
LoadModule php7_module /usr/libexec/apache2/libphp7.so

4. Restart apache

sudo apachectl restart

Recommended tutorial: PHP video tutorial

The above is the detailed content of Steps to install PHP environment on Apple computers. For more information, please follow other related articles on the PHP Chinese website!

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

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

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!