1.购买一个阿里云的云服务器,选择自己喜欢和需要的操作系统,并完成基本设置。我选的是ubuntu14.04.
2.安装apche:
apt-get install apche2
3.安装php5 :
apt-get install php5 libapache2-mod-php5
4. 重启apache:
service apche restart
5.安装pcre:
apt-get install libpcre3 libpcre3-dev
如果失败,先更新下软件源:
apt-get update
6.安装mongodb:mongodb的官网给出了不同版本的操作系统的安装方法。具体的详情请见链接: ubuntu 的mongodb安装手册
7.安装php-mongo拓展:
sudo apt-get install php5-mongo
8.在/var/www/html/下建立一个测试文件test.php,文件内容如下。查看apche+php+mongo环境是否搭建成功。如果成功,可以看到我们以上步骤安装的插件和拓展。
<?php
phpinfo();
?>
经过以上步骤,可以顺利搭建起apche+php+mongo的开发环境。如果有问题,欢迎讨论。