Get the App
SLTechnology News&Howtos  ›  Development  › 

How to install php7 in macbook pro

Shulou Source: shulou.com Published: 2022-06-03 10:52:44 11月15日 Update

How to install php7 in macbook pro, aiming at this problem, this article introduces the corresponding analysis and answer in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

Macbook pro install php7 method: 1, install Homebrew;2, through brew to install PHP7, execute commands such as "$brew install php70"; 3, configure Apache;4, restart Apache.

This article operating environment: macOS10.15 system, php7 version, macbook pro 2020 computer

How does macbook pro install php7?

Mac installation PHP7:

After a long wait, after our PHP5.6 release, our latest PHP7 was finally released (wait, where's our 6? According to the official statement, PHP7 is now twice as fast as PHP5.6, so if we want to try something new, how can we experience it?

In fact, we have several ways to install it.

First, we can go to the official website up and down the source code to compile, this will not say much.

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

Installation method

First we need to install Homebrew

Install via brew:

$brew tap homebrew/dupes $brew tap homebrew/versions $brew tap homebrew/homebrew-php / / create the directory sudo mkdir / usr/local/varsudo chmod 777 / usr/local/var / / change it to your own user name and group sudo chown-R: / usr/local/sbin sudo mkdir / usr/local/sbin/// install PHP7 $brew install php70 / / delete the previously installed PHP5.6 / / you can modify it according to your own situation $brew unlink php56 $brew link php70// completed $php-vPHP 7.0.0 (cli) (built: Dec 2 2015 13:06:23) (NTS) Copyright (c) 1997-2015 The PHP GroupZend Engine v3.0.0 Copyright (c) 1998-2015 Zend Technologies

Configure Apache

$sudo vim / etc/apache2/httpd.conf

Find this line and comment it out (probably on 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 SetHandler application/x-httpd-php

Restart Apache

Sudo apachectl restart

Add an info.php file to your Apache's default directory / Library/WebServer/Documents.

Finally, go to your http://localhost/info.php to take a look at the following tests. If you see the relevant information, it means that it has been installed.

This is the answer to the question about how to install php7 in macbook pro. I hope the above content can be of some help to you. If you still have a lot of doubts to solve, you can follow the industry information channel for more related knowledge.

Tags: Method Laian question Zhongan more catalog help answer configuration easy long done easy information content command great achievement official boy buddy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia Shulou Technology macOS vpn