在Ubuntu中安装Apach2/PHP5/MySql

 url:file:///home/simple/apache+mysql+php%20install.html

考虑到前不久在这儿测试Wordpress主题的惨痛经历,俺决定自己建一个web平台来先在本机测试

本来想在openSUSE中安装,但想想apt-get这几键俺按得比较多,就先在Ubuntu中下手
按照 Unofficial Ubuntu 6.06 (Dapper Drake) Linux Starter Guide的步骤来

一、安装Apache2
sudo apt-get install apache2
然后在Firefox中打开:
http://localhost/
提示成功

二、安装PHP5
sudo apt-get install php5
sudo apt-get install libapache2-mod-php5(根据俺的实际测试,这一步似乎不用做了,在上一步已经安装好了,不过还是建议你copy/paste一下这条命令)
sudo /etc/init.d/apache2 restart

测试PHP5是否安装成功
sudo gedit /var/www/testphp.php
在里面写入
然后在Firefox中打开:
http://localhost/testphp.php
应该能看到下面的画面,很长的,俺截了一下
php5.png
看完后把testphp.php删掉,可能会有安全风险

三、安装MySql
sudo apt-get install mysql-server

MySql初始只允许本机(127.0.0.1)连接,如果想多台机子使用或者向Internet开放的话,编辑/etc/mysql/my.cnf
sudo gedit /etc/mysql/my.cnf
找到
bind-address = 127.0.0.1
用#注释掉,象这样
#bind-address = 127.0.0.1

MySql默认没有设置root密码,本机的root用户也没有密码,有风险是吧,这样
mysqladmin -u root password your-new-password
mysqladmin -h root@local-machine-name -u root -p password your-new-password(这里我怎么也连接不上mysql服务器,最后在mysql-admin里面改的)
sudo /etc/init.d/mysql restart

安装MYSQL Administrator
sudo apt-get install mysql-admin
安装好后在Gnome-应用程序-系统工具-MySQL Administrator

这里俺遇到了一个问题,就是运行MySQL Administrator后,点击User Administrator后,整个MySQL Administrator挂死,最后还是解决了,方法见后面

安装MYSQL for Apache HTTP Server
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo apt-get install phpmyadmin

要让PHP与MySql一起工作,编辑
sudo gedit /etc/php5/apache2/php.ini
取消对;extension=mysql.so的注释,象这样

extension=mysql.so

保存文件,然后
sudo /etc/init.d/apache2 restart

测试:
http://localhost/phpmyadmin

这里俺能修改用户,新增用户等等,回过头来解决前面提到的点击User Administrator后,整个MySQL Administrator挂死的问题,见下面的网址:
MySQL Administrator hangs after pressing User Administration Icon
高手们解决的办法不一,主要的方法:
在终端中:
export DEBUG_DONT_SPAWN_FETCHES=1
mysql-admin
这样就能顺利修改用户了

有时间再测试安装Wordpress/MT等

ps:今晚Opera社区极慢,不知何原因?

update:swiftfox访问这儿也慢,俺换用Opera来访问就很快,何故?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
项目要用到zend Optimizer,但是目前只支持php5.2,Ubuntu默认安装php版本为5.3,找了好多 方法,终于借助下面这篇文章的方法成功的安装了5.2及5.3两个版本的php Although Drupals 7+ run smoothly on PHP 5.3, Drupal 6 still feels much better with PHP 5.2. Even though D6 core is compatible with PHP 5.3 for quite some time now, a lot of contributes modules still get nasty hiccup when asked to run on the newer version. Therefore developing for both D7 and D6 at the same time becomes much less painful when running both versions of PHP in parallel. One way of doing it is using mod_php5 Apache module to serve PHP 5.3 applications, while running PHP 5.2 applications using fastcgi module. Under Ubuntu 12.04 this can be achieved by installing PHP 5.3 from the repositories and manually compiling and installing PHP 5.2 afterwards. Installing PHP 5.3 from repositories is fairly easy process, which you most probably already have under your belt, so let's just say that it looks more or less like this: sudo apt-get install php5 php5-common php5-cli php5-dev php5-mysql phpmyadmin php5-pgsql phppgadmin php5-gd php5-mcrypt php5-curl php-pear libapache2-mod-php5 php5-xdebug php5-codesniffer What is much more interesting though, and what this post will focus on, is how to add PHP 5.2 to the whole picture and make both those versions work nicely together. Please note that this tutorial is for Apache's name- based virtual hosts, and essentially leaves PHP 5.3 enabled globally while allowing to use PHP 5.2 on specific, selected virtual hosts only.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值