Setup Apache, PHP, MySQL and WordPress on Mac OS X 10.8.3

本文详细介绍了如何在Mac上配置并启动Apache、安装并设置PHP、安装MySQL以及部署WordPress的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Part I : Launch Apache

case 1:  'System Preferences' –> 'Sharing' –> 'Web Sharing';

case 2: launch terminal

  1.  run 'sudo apachectl start',input root password;
  2.  run 'sudo apachectl -v',check Apache version info on Mac.

then, input 'http://localhost' or 'http://127.0.0.1' in Safari, 'It works!' will display on the Page, which can be located in '/Library/WebServer/Documents/', it is the root Directory of Apache.

Part II : Launch PHP

1. run 'sudo vi /etc/apache2/httpd.conf', then unconment '#LoadModule php5_module libexec/apache2/libphp5.so';

2. run 'sudo cp /etc/php.ini.default /etc/php.ini', the you can edit file 'pho.ini', for example:

*************************************

upload_max_filesize = 2M

post_max_size = 8M 

display_errors = Off

*************************************

3. run 'sudo apachectl restart',restart Apache,PHP will be OK;

4. run 'sudo cp /Library/WebServer/Documents/index.html.en /Library/WebServer/Documents/info.php',and run 'sudo vi /Library/WebServer/Document/info.php',edit info.php with '<?php phpinfo(); ?>',then you can check it from 'http://localhost/info.php' in Safari.

Part III : Install Mysql

1. download 'mysql-5.5.3-osx10.6-x86_64.dmg'; 

2. set up 'mysql-5.5.3-osx10.6-x86_64.pkg',  it will be located at '/usr/local';

3. set up 'MySQLStartupItem.pkg';

4. set up 'MySQL.prefPane', you can check it from 'System Preferences';

5. run 'sudo vi /etc/bashrc',add alias name for mysqlstart, mysql and mysqladmin in 'bashrc', you need restart Terminal.

*************************************

#mysql

alias mysqlstart='sudo /Library/StartupItems/MySQLCOM/MySQLCOM restart'

alias mysql='/usr/local/mysql/bin/mysql'

alias mysqladmin='/usr/local/mysql/bin/mysqladmin'

*************************************

6. run 'mysqladmin -u root password 'password''; run 'mysql -u root -p', and input your password; run 'create database yourdb;'; run 'grant all privileges on yourdb.* to yourusername@localhost;'; run 'use yourdb;'; run 'SET PASSWORD FOR 'yourusername'@'localhost' = PASSWROD('pw');'; 

7. run 'sudo mkdir /var/mysql'; run 'sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock';

8. import your own mysql database: run 'mysql -u yourusername -p;'; run 'use yourdb;'; run 'source all.sql;';

Note: in file 'all.sql', you can edit like below,

*************************************

source first.sql;

source second.sql;

……

*************************************

Part IV : Install WordPress

1. run 'mkdir ~yourusername/Sites'; copy your wordpress directory into '~yourusername/Sites/'; run 'sudo vi /etc/apache2/users/yourusername.conf', input like below:

*************************************

<Directory "/Users/yourusername/Sites/">
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

*************************************

2. run 'sudo apachectl restart'; 

3. Solve WordPress "Error establishing a database connection", check file 'wp-config.php' like below:

/** MySQL database username */

define('DB_USER', 'yourusername');

/** MySQL database password */
define('DB_PASSWORD', 'pw');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

4.  Change your Server address:

~download all the files from old Server;

~export all the databases with phpmyadmin;

~upload all the files to new Server;

~create new database, and import all your databases;

~update wp-config.php;

~'mysql -u yourusername -p'; 'UPDATE wp_options SET option_value = replace( option_value, 'http://oldadress', 'http://newadress') WHERE option_name = 'home' OR option_name ='siteurl';'

~'UPDATE wp_posts SET post_content = replace(post_content, 'http://oldadress', 'http://newadress');UPDATE wp_posts SET guid = replace( guid, 'http://oldadress' , 'http://newadress' ) ;'

资源下载链接为: https://pan.quark.cn/s/1bfadf00ae14 最近在使用 MongoDB 3.0.6 版本时,小编遇到了一个棘手的问题:在对集合执行大规模排序操作(如聚合)时,出现了错误提示。今天就来分享一下如何快速解决 MongoDB 排序操作超出内存限制的问题。 MongoDB 是一款广受欢迎的开源文档型数据库,凭借其出色的性能、高可用性和可扩展性而备受青睐。但在处理海量数据集时,尤其是涉及排序操作时,很容易碰到内存限制的瓶颈。MongoDB 在执行排序操作时,默认会使用内存来完成,以保证操作的高效性。不过,为了防止过度占用系统资源,MongoDB 对内存中的排序操作设置了上限,通常为 100MB(在 3.0.6 版本中)。一旦排序的数据量超出了这个限制,就会出现类似以下的错误: 该错误表明,排序操作超出了 100MB 的内存限制,且未启用外部排序功能。为了解决这一问题,可以使用allowDiskUse选项。allowDiskUse允许 MongoDB 在排序时借助磁盘空间,而不再仅依赖内存。具体操作是在聚合查询或排序操作中加入{allowDiskUse: true}。例如,针对上述错误,可以将查询语句修改为: 启用allowDiskUse后,MongoDB 会将排序数据写入临时文件,并在磁盘上完成排序。虽然这种方式可能会因磁盘 I/O 的延迟而降低排序速度,但它能够有效处理大规模数据集。 不过,需要注意的是,虽然allowDiskUse可以解决内存限制问题,但其对性能的影响也不容忽视。在处理大量数据时,建议优化查询语句,减少需要排序的文档数量,或者考虑采用其他数据存储和查询策略,比如分片(sharding)或预计算索引等。此外,保持数据库版本的更新也非常重要。MongoDB 的后续版本可能在内存管理和排序机制方面进行了优化,例如提升了内存限
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值