快速业务通道

Mac OS X Snow Leopard 开启Web共享,建立Web服务器:Apache+PHP+MySql

作者 佚名技术 来源 服务器技术 浏览 发布时间 2012-07-05

教程内容:Mac OS X Snow Leopard 开启Web共享,建立Web服务器:Apache+PHP+MySQL 1.开启Web Sharing: System Preferences -> Sharing -> 勾选Web Sharing 网站默认目录位于 ~/Sites 测试:http://localhost/~ElfSundae (ElfSundae为你的用户名) 2.配置Apache,安装并配置MySql 详见: Install Apache/PHP/MySQL on Mac Snow Leopard http://www.cnblogs.com/elfsundae/archive/2010/11/27/1889570.html 注意:该篇文章是我转载国外的一篇文章,是stackoverflow热烈讨论后的精华,建议详细阅读并熟记。 安装完MySql后在系统预设里Start Mysql server 如果需要更改默认端口80,最简便的方法就是显示隐藏文件,直接编辑 /private/etc/apache2/httpd.conf 为MySql添加环境变量PATH: 不会添加PATH的请移步:http://www.cnblogs.com/elfsundae/archive/2010/12/01/1893190.html /*引用MySql ReadMe*/

The Mac OS X PKG of MySQL installs itself into
`/usr/local/mysql-VERSION'' and also installs a symbolic link,
`/usr/local/mysql'', that points to the new location. If a Directory
named `/usr/local/mysql'' exists, it is renamed to
`/usr/local/mysql.bak'' first. Additionally, the installer creates the
grant tables in the `mysql'' database by executing `mysql_install_db''.
$ echo ''export PATH=/usr/local/mysql-5.1.53-osx10.6-x86/bin:$PATH'' >> ~/.bash_profile 测试PATH:$ mysql --version
mysql Ver 14.14 Distrib 5.1.53, for apple-darwin10.3.0 (i386) using readline 5.1 建立管理员帐号:帐号:root,密码:123456 $ mysqladmin -u root password 123456
$ mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.1.53 MySQL Community Server (GPL) Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license Type ''help;'' or ''\h'' for help. Type ''\c'' to clear the current input statement. mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.02 sec) mysql> quit
Bye 3.测试PHP 在/Library/WebServer/Documents 下建立test.php: <HTML>
<head>
<title> php test - By:Elf Sundae </title>
</head>

<body>
<?php
echo "http://www.cnBlogs.com/ElfSundae <hr>";

phpinfo();
?>

</body>
</html> 测试:http://localhost:8080/test.php (如果你没有改默认端口,就不需要加:8080) 4.测试MySql连接 建表: mysql> Create database mytest;
Query OK, 1 row affected (0.00 sec) mysql> use mytest;
Database changed
mysql> CREATE TABLE members (
-> id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> password VARCHAR(12) NOT NULL,
-> username VARCHAR(12) NOT NULL,
-> index(password),
-> index(user

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号