Home  >  Article  >  Backend Development  >  About how to build a PHP environment under Mac system

About how to build a PHP environment under Mac system

不言
不言Original
2018-07-18 16:57:501632browse

This article shares with you the method of setting up a PHP environment under Mac system. The steps are very detailed. Friends in need can refer to it.

* I was short of money some time ago... I bought a second-hand Macbook pro! The configuration is quite high, 16 models of 13 inches are basically top-of-the-range... The only difference is that the hard drive is not 1T... I can make up my mind. Configured it all at once
* By the way, don’t all programmers say that every program should have its own mac?
* Then I had it... But there was nothing much new! Because I had it before After a while... I was still working on iOS at that time...
* I won’t talk about the history of blood and tears! ....
* Let’s get straight to the point....
* Running of PHP Environment.... Apache PHP MySql
* Conscience Mac comes with Apache (2.4.33) and PHP (7.1.16). I have seen many versions that are different from mine. Don’t worry about the details. The operations are the same
* So just Just need to turn on the support!
* Start Apache: sudo apachectl start(start)/stop(stop)/restart(restart)
* View version: httpd -v

* 然后访问localhost
* 正常情况下
* 会出现
* It works!

* File directory:/Library/WebServer/Documents
* Then enable Apache to support PHP module
* When modifying, it is good practice to back up first and just cp directly
* sudo vim /etc/apache2/httpd.conf
* Remove the
#* LoadModule php7_module libexec/apache2/libphp7.so

* Mine is PHP7 at line 176 of the configuration file
* If you don’t know where it is, you can search in command mode :/php
* and press Enter.. ... Press n is next N is previous... If you are not familiar with it, you can check vim search
* I won’t go too far...
* At this time...
* Restart apache
* That's it....
* However, you can write a test.php and put it in the current directory and print PHPinfo
* This is completely OJBK...

* Well, MySql is left...
* Go to the official website to download mysql... I downloaded version 8.0.11
* I also forgot where I am. Downloaded... If you need it, just ask me... I can send you the package.
* The installation is very simple... dmg file with various dots...
* The installation is complete. ..
* Here’s a reminder: Many articles say... You need to record a temporary password... But I didn’t have a temporary password when I installed it...
* I was asked to set a password directly... So there is no need It needs to be recorded... It may be because of different versions. Anyway, this is not the main problem
* After installation, there will be Mysql option in the preferences

* At this time, if you directly use the database management tool to connect to the local database, you should get an error...
* Probably the encryption method is wrong. This thing is caching_sha2_password
* Hmmmm
* It's easy to say...
* 1->Open System Preferences, find mysql, and click Initialize Database.
* 2->Enter your database password.
* 3->Select ‘Use legacy password‘.
* 4->Restart the mysql service.
* 5->Use the tool to connect again.
* Under normal circumstances, that’s it!

* Okay, congratulations!
* You’ve basically fallen into the trap..
* Because it’s at the back You will find that there are so many things to install... It hurts! You also have to find ways to crack...
* For example, VMware Navicat PHPstorm FinalShell FTP, etc.....
* Hand code for the article .... For reference only. If there is an error... please point it out! Thank you

Related recommendations:

PHP environment construction, PHP environment construction

win7 php environment building tutorial: detailed explanation of the steps to build php environment under win7

The above is the detailed content of About how to build a PHP environment under Mac system. 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