

在 Mac OS X 中搭建 Apache + PHP + MySQL 开发环境
source link: https://ourai.ws/posts/apache-mysql-php-on-mac-os/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

我所使用的操作系统是 Mac OS X Yosemite,自带 Apache 和 PHP,所以不用安装,只需稍微修改一下配置文件即可。
启动 Apache
打开终端,输入 sudo apachectl start
后即可启动 Apache。访问 http://localhost/
会看到 It works!
字样。
启用 PHP
修改 /etc/apache2/httpd.conf
文件的配置,将 #LoadModule php5_module libexec/apache2/libphp5.so
前面的 #
去掉后,在终端中输入 sudo apachectl restart
重启 Apache 后 PHP 就能够正常使用了!
不过,用默认的目录开发很是不方便,还好可以自定义工作目录。同样是在 /etc/apache2/httpd.conf
文件中,将 DocumentRoot "/Library/WebServer/Documents"
和 <Directory "/Library/WebServer/Documents">
中引号内的路径改为自己的路径即可。新建一个 index.php
文件,代码为 <?php phpinfo(); ?>
,用浏览器访问 http://localhost/
就能够看到结果。
安装 MySQL
Recommend
-
49
导读 Apache是世界使用排名第一的Web服务器软件。它可以运行在几乎所有广泛使用的计算机平台上,由于其跨平台和安全性被广泛使用,是最流行的Web服务器端软件之一。它快速、可靠并且可通过简单的API扩充,将Perl/Python等解释器编译到服务器中。今天我们就...
-
18
Mac-go语言环境搭建 mac上会默认安装brew,但是版本一般比较低,这时候你可以执行brew update,如果一直没有反应,建议重新安装brew。 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Home...
-
18
今天下午一直在捣鼓如何用PhpStorm进行调试,查找了许多资料,零零碎碎的,所以自己弄篇文章记录一下步骤。 安装xdebug 使用brew安装xdebug,语法如下 brew install homebrew/php/php<version number>-xdebug
-
20
Mac mini 环境搭建 dong4j 11/11/2018 macOS 记录 mac mini 开发环境的搭建过程
-
6
brew install [email protected] nginx配置环境变量vim ~/.zshrc# PHP export PATH="/opt/homebrew/opt/[email protected]/bin:$PATH" export PATH="/opt/homebrew/opt/[email protected]/sbin:$PATH" export LDFLAGS="-L/opt/homebrew/opt/[email protected]...
-
5
Mac 下 Homebrew 搭建 PHP 开发环境 发表于 2021-07...
-
4
MAC搭建PHP调试环境 mac 不推荐使用这种方式,更好的是使用docker的方式来搭建调试环境。 使用Docker搭建php调试环境,支持gdb, xdebug, vld等工具调试php。 1. 源码安装 1.1. 获取源码
-
7
Ubuntu 搭建 php、mysql、nginx 开发环境php 安装进入 php 官方站点现在所需版本 http://php.net/downloads.php,提取下载地址使用 wget 进行下载:
-
6
除了能在AppStore下到或者可以轻易获取的工具,我的iOS开发环境还需要以下环境支持: homebrew cocoapods fastlane xcode的arm64模拟器 homebrew原始的写法因为无法访问raw.git...
-
6
在Mac上编译针对于51单片机的C语言源代码,并将编译后的代码下载到单片机,本篇文章针对于Intel和Apple Silicon版本的Mac均有效 安装编译器 sdcc
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK