search
Homephp教程php手册MAC平台 Apache+PHP+MySql配置

MAC平台 Apache+PHP+MySql配置

Jun 06, 2016 pm 07:46 PM
macstart upplatformConfiguration

一。启动Apache 启动方式有两种: 1.可视化配置 在“系统偏号设置”-“共享”,选择互联网共享。(我没测试) 2.命令行方式 输入sudo apachectl start 这时在浏览器输入http://localhost,会显示It Works! Apache的主目录位置是在: Libary/WebServer/Docum

一。启动Apache

启动方式有两种:

1.可视化配置

在“系统偏号设置”-“共享”,选择互联网共享。(我没测试)

2.命令行方式

输入sudo apachectl start


这时在浏览器输入http://localhost,会显示It Works!

Apache的主目录位置是在:Libary/WebServer/Documents

二。配置PHP

1.修改apache配置文件

把/etc/apache2/httpd.conf

去掉#loadModule php5_module libexec/apache2/libphp5.so前的#号

2.设置php.ini

/etc/php.ini.default复制为/etc/php.ini,并按自己需求修改内容。

3.重启apache

在命令行运行sudo apachectl restart


三。安装MySql

1.下载安装并安装

下载地址:http://dev.mysql.com/downloads/mysql/ ,下载最新的DMG ARCHIEVE版本。安装以后会在系统偏号设置里有MySql图标。

2.设置密码

cd /usr/local/mysql/bin
sudo ./mysqladmin -u root -password root


四。安装mcrypt

1.下载并解压libmcrypt-2.5.8.tar.bz2

http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download
到命令行解压
cd ~/Downloads
sudo tar -xvf libmcrypt-2.5.8.tar


2.编译

cd ~/Downloads/libmcrypt-2.5.8/
./configure --disable-posix-threads --enable-static
make
sudo make install


3.下载php源码文件(注意选择版本)

查看php版本 
php -v
下载http://cn2.php.net/distributions/php-5.5.14.tar.gz
tar -xvf php-5.5.14.tar
cd php-5.5.14
/usr/bin/phpize
./configure
make
sudo make install
sudo vi /etc/php.ini
加入内容extension=mcrypt.so
sudo apachectl restart


五。安装PhpMyAdmin

1.下载PhpMyAdmin

放置到/Library/WebServer/Documents/phpMyAdmin中。

2.设置

把config.sample.inc.php复制为config.inc.php,做如下修改:

用于Cookie加密,随意的长字符串

$cfg['blowfish_secret']='fewf323';
$cfg['Servers'][$i]['host']='localhost';
$cfg['Servers'][$i]['AllowNoPassword']=false;




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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment