Create project through composer
1.1 Run the command in the terminal to install laravelcomposer create-project --prefer-dist laravle/laravel slrApp
1.2 Configure the virtual domain name
1) Modify the hosts file in the terminal
1.1sudo su
Obtain permissions
1.2vim /etc/hosts
vim to modify the hosts file. After entering, go to the last line and press theikey to enter the editor.
1.3127.0.0.1
slrApp.net
Enter what you want to use Domain name, pressescafter modification to exit editing, then enter:wqto save
1.4vim /private/etc/apache2/extra/httpd-vhosts.conf
vim edit httpd-vhosts.conf file
DocumentRoot "/Users/zhouhongliang/Site/slrApp/public" ServerName slrApp.net ErrorLog "/private/var/log/apache2/dummy-host2.example.com-error_log" CustomLog "/private/var/log/apache2/dummy-host2.example.com-access_log" common
Fill in the final path and domain name and change the path and domain name to your own
1.5 Restart apachesudo apachectl restart
1.6 An error is reported when accessing the domain name and the log file cannot be opened because permissions need to be added to the storage and bootstrap/cache in the project
1) In the terminal, enter the project root directory
2) After enteringsudo chmod -R 777 storage
3) Enter the bootstrap file again
4) Executesudo chmod -R 777 cache/
and then access the Laravel project successfully.
For more Laravel related technical articles, please visit theLaravel Tutorialcolumn to learn!
The above is the detailed content of Install Laravel on Mac computer. For more information, please follow other related articles on the PHP Chinese website!