Home Backend Development PHP7 How to install php7 on macbook pro

How to install php7 on macbook pro

Sep 18, 2021 am 10:43 AM
macbook php7

How to install php7 on macbook pro: 1. Install Homebrew; 2. Install PHP7 through brew and execute commands such as "$ brew install php70"; 3. Configure Apache; 4. Restart Apache.

How to install php7 on macbook pro

The operating environment of this article: macOS10.15 system, php7 version, macbook pro 2020 computer

How to install php7 on macbook pro?

Mac installation PHP7:

After a long wait, after our PHP5.6 was released, our latest PHP7 was finally released (waiting Wait, where is our 6?), according to the official statement, the current PHP7 is twice as fast as PHP5.6, so if we want to try it out, how can we experience it?

In fact, we have several ways to install it.

First, we can go to the official website and download the source code to compile it, so I won’t go into details about this.

Second, we can use our third-party package to install, such as homebrew. This article will describe how to install using this method.

Installation method

First we need to install Homebrew

Install through brew:

$ brew tap homebrew/dupes  
$ brew tap homebrew/versions  
$ brew tap homebrew/homebrew-php  
   
// 创建目录 
sudo mkdir /usr/local/var
sudo chmod 777 /usr/local/var 
//修改成你自己的用户名和组
sudo chown -R <username>:<group> /usr/local/sbin   
sudo mkdir /usr/local/sbin/
//安装PHP7  
$ brew install php70  
//删掉以前安装的PHP5.6  
//你可以根据自己的情况来修改  
$ brew unlink php56
$ brew link php70
//大功告成
$ php -v
PHP 7.0.0 (cli) (built: Dec  2 2015 13:06:23) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
Copy after login

Configure Apache

$ sudo vim /etc/apache2/httpd.conf
Copy after login

Find this line and comment it out (about line 168)

#Comment out the PHP5 module   
#LoadModule php5_module libexec/apache2/libphp5.so
#Enable PHP 7 module  
LoadModule php7_module /usr/local/opt/php70/libexec/apache2/libphp7.so  <FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Copy after login

Restart Apache

sudo apachectl restart
Copy after login

Go to your Apache’s default directory/Library/WebServer/Documents and add an info.php document.

<?php    
phpinfo();    
?>
Copy after login

Finally go to your http://localhost/info.php to see the test below. If you see relevant information, it means it has been installed.

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to install php7 on macbook pro. For more information, please follow other related articles on the PHP Chinese website!

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

Video Face Swap

Video Face Swap

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

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)

How to Fix 'Encryption Credentials Expired” When Printing on Apple Mac How to Fix 'Encryption Credentials Expired” When Printing on Apple Mac Feb 05, 2024 pm 06:42 PM

Have you ever encountered the "Printer encryption credentials have expired" error message on your Apple Mac computer when trying to print a document? Don't worry! In this tutorial, I will share how to fix expired printer encryption credentials on Apple computers. Let’s get started without further ado. Have you ever encountered the "Printer encryption credentials have expired" error message on your Mac when trying to print a document? Don't worry! In this tutorial, I will share how to fix expired printer encryption credentials on Mac. Let’s get started without further ado. What does it mean if printer encryption credentials expired on Mac? How to Fix Expired Printer Encryption Credentials on Mac Additional Tips and Precautions What Does Expired Printer Encryption Credentials on Mac Mean? Printer encryption credentials on Mac

How to set the screen of an Apple computer to always be on, and how to make the Mac never sleep How to set the screen of an Apple computer to always be on, and how to make the Mac never sleep Feb 05, 2024 pm 05:33 PM

Want to stop your Apple Macbook from going to sleep? These are all your options. Apple designed macOS for maximum energy efficiency. Therefore, by default, Apple Mac computers will try to save power as much as possible to extend battery life. Therefore, when you stop using your Mac temporarily, it automatically goes to sleep to save energy. You probably don't want your Mac to go to sleep when you're working on an important task. This guide will show you how to prevent your Mac from going to sleep and keep it awake. How to turn off sleep mode on your Mac macOS lets you control how and when your Mac goes to sleep. However, with the arrival of system settings in macOS Ventura, you may be saving energy

How to check the battery level of a connected Bluetooth device on your Mac How to check the battery level of a connected Bluetooth device on your Mac Feb 05, 2024 pm 01:45 PM

Bluetooth accessories such as mice and keyboards are very convenient for your Apple Mac computer. However, these devices have a limited battery life, so checking their battery life regularly ensures you're not caught off guard by sudden disconnections. Who wouldn’t want to check the battery level of a Bluetooth accessory with just a few clicks? Fortunately, your Mac offers several easy ways to check the battery level of Bluetooth devices connected to your Apple Mac computer. Let’s explore these simple options. 1. Check from the Menu Bar on Mac In a Mac, the menu bar is one of the easiest areas to view. Just swipe your cursor to display the menu bar. And, you can make the menu bar always visible in full-screen mode. If you don't see the Bluetooth icon in the menu bar, you need to manually

How to adjust sleep time on your Mac (set up hibernation) How to adjust sleep time on your Mac (set up hibernation) Feb 05, 2024 pm 02:10 PM

Do you find that when you don't use your Mac for more than a minute, you constantly need to wake it up? Or do you have the opposite problem, where you leave your Mac alone for a few hours, only to find that when you return it's still awake with the screen on? On your Mac, you can control exactly how long you spend inactive before your display and other components go to sleep. Here's how to adjust your Mac's sleep time. How to set sleep time on Mac In Mac system settings, you can choose how long the display waits before going to sleep. You can choose anywhere from one minute to three hours, or you can choose to have the display never sleep unless you manually put it to sleep. The steps are slightly different depending on which version of macOS you are running.

2 Ways to Lock Photos on Mac 2 Ways to Lock Photos on Mac Mar 22, 2024 am 09:06 AM

When you store photos on your Mac, you sometimes include some private photos. To ensure their privacy, you may consider locking them. This prevents others from viewing the photos without permission. This article will explain how to lock photos on Mac to ensure that only you can access them when you need them. How to Lock Photos on Mac [2 Methods] You can lock photos on Mac in two ways – using the Photos app or the Disk Utility app. Method 1: Use the Photos app You can use the Photos app to lock your photos if they are stored in the app. If your photos are stored elsewhere, you'll need to lock them by moving them to the Photos app. Step 1: Add the picture

How to move files and folders on Mac computer? 4 ways to explain! How to move files and folders on Mac computer? 4 ways to explain! Feb 05, 2024 pm 06:48 PM

If you want to organize the files and folders on your Apple Mac computer, you may consider moving some content. By moving items, you can create a more organized file structure to work more efficiently or find what you need faster. We'll show you how to move files and folders on macOS using drag and drop, shortcuts or right-click menus, Terminal, and more so you can use the method that makes more sense or that you're most comfortable with. Method 1: Use Drag and Drop on Mac The easiest way to move files and folders on Apple Mac computers is through drag and drop. Whether you're rearranging icons, widgets, and shortcuts on your desktop, or moving items to other locations on macOS, this method is very convenient and easy to use. 1.Open in two

(Fixed) apt-get command not found on Mac – full tutorial (Fixed) apt-get command not found on Mac – full tutorial Feb 05, 2024 am 11:51 AM

If you have ever used a Linux system, you may be familiar with the Apt-get command. It is a command used to install applications or software packages on Linux systems. Although macOS and Linux have some similarities, only a very small number of Linux packages can be installed on macOS. Especially older versions of macOS are more likely to be unable to run Linux applications. Can't find apt-get command? When users try to install Linux applications on macOS, they may receive an "Apt-get command not found" message. Actually, there is nothing wrong with the Apt-get command itself, but it doesn't work on macOS. This is because macOS doesn't have a built-in

How to Right-Click on a Mac: 5 Quick Methods Explained! How to Right-Click on a Mac: 5 Quick Methods Explained! Feb 05, 2024 pm 04:12 PM

If you recently switched to macOS, you might want to know how to right-click on Mac. On macOS, right-clicking works a little differently than on Windows. On a Mac, you can use your trackpad or mouse to right-click. If you're using a trackpad, you can right-click by tapping two fingers on the right side of the trackpad simultaneously. If you're using a mouse, there's usually a right-click button that you can click directly on to right-click. Right-clicking opens a context menu with options for the selection, as well as accessing shortcuts and other submenus. This makes operating on Mac more convenient and efficient. In this guide, I will show you how to use different devices on your Mac such as the default touch

See all articles