xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

如何在 macOS 上搭建 PHP 开发环境 All In One

如何在 macOS 上搭建 PHP 开发环境 All In One

Linux, Nginx, MySQL, PHP

$ php --version

$ php -v

# PHP 7.3.11 (cli) (built: Apr 17 2020 19:14:14) ( NTS )
# Copyright (c) 1997-2018 The PHP Group
# Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies
➜  ~ 

$ php -v
$ php --version
# PHP 7.3.11 (cli) (built: Apr 17 2020 19:14:14) ( NTS )

# cli test
$ php foreach.php

# -S <addr>:<port> Run with built-in web server.
$ php -S 127.0.0.1:8090
# http://127.0.0.1:8090
# [Sat Aug  8 01:25:06 2020] Failed to listen on 127.0.0.1:8090 (reason: Address already in use)

$ ifconfig
# en0
# inet 192.168.1.12 netmask 0xffffff00 broadcast 192.168.1.255
$ php -S 192.168.1.12:8090
# http://192.168.1.12:8090/

php info

# php info
$ php info.php 

<?php
/**
 *
 * @author xgqfrms
 * @license MIT
 * @copyright xgqfrms
 * @created 2020-08-0
 * @modified
 *
 * @description
 * @augments
 * @example
 * @link http://192.168.1.12:8090/info.php
 *
 */

  // php info
  phpinfo();
  echo('$php_info');
  // return 1
  // $php_info = phpinfo();
  // echo($php_info)
?>

https://www.php.net/manual/en/function.phpinfo.php

# php 7.x
$ brew install php


macOS 12 & PHP

2022.08.31 更新

# PHP

$ sudo vi /etc/apache2/httpd.conf

$ sudo code /etc/apache2/httpd.conf

PHP was deprecated in macOS 11 and removed from macOS 12 ⚠️

refs

https://learnku.com/articles/35981

Nginx

http://nginx.org/en/download.html

Laravel

Laravel是一个具有表达力,优雅语法的Web应用程序框架。

https://laravel.com/

https://github.com/xgqfrms/php-all-in-one/issues/1



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2020-08-08 11:12  xgqfrms  阅读(919)  评论(7编辑  收藏  举报