一、ubuntu11.04 安装 Apache2:
sudo apt-get install apache2
sudo /etc/init.d/apache2 restart // 重启APACHE
错误 apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName
解决办法
编辑 /etc/apache2/httpd.conf 文件,加入
ServerName localhost
或者
ServerName 127.0.0.1
二、 ubuntu11.04 安装PHP:
sudo apt-get install php5 // 安装PHP5
sudo apt-get install php5-gd //安装GD扩展
sudo apt-get install libapache2-mod-php5 //配置APACHE+PHP
以下可选择安装:
sudo apt-get install php5-curl
sudo apt-get install php5-xmlrpc
sudo apt-get install php5-imagick
sudo apt-get install php5-cgi
sudo apt-get install php5-fpm
sudo apt-get install php5-memcache
sudo apt-get install php5-xdebug
sudo /etc/init.d/apache2 restart // 重启APACHE
随便建一个test.php 的文件,内容为 <?php phpinfo(); ?>
http://localhost/ test.php 测试;这时会看到php 的安装环境等,默认会安装php5.3
三、 ubuntu11.04 安装Mysql
sudo apt-get install mysql-server
mysqladmin -u root password db_user_password
#db_user_password替换为密码
四、 ubuntu11.04 安装Mysql模块
sudo apt-get install libapache2-mod-auth-mysql
sudo apt-get install php5-mysql
sudo /etc/init.d/apache2 restart // 重启APACHE
五、配置php.ini:
sudo gedit /etc/php5/apache2/php.ini
把文件在文件后面的:
#extension=mysql.so
#extension=gd.so
的#去掉。
六、 ubuntu11.04 安装phpmyadmin
sudo apt-get install phpmyadmin
测试:http://localhost/phpmyadmin/
sudo /etc/init.d/apache2 restart // 重启APACHE
————————————
小贴士:
如果按照上面的方法安装的php环境,
打开http://localhost/phpmyadmin/这个链接出现
Not Found
The requested URL/phpmyadmin/was not found on this server.
Apache/2.2.9(Ubuntu) PHP/5.3.6-2ubuntu4 with Suhosin-Patch Server at localhost Port 80
sudo ln -s /usr/share/phpmyadmin/ /var/www/
phpmyadmin的默认安装路径不是在/var/www/(/var/www/是你的web服务站点的根目录),所以建一个软连接就可以了。
上述命令是在/var/www/下建一个phpmyadmin的软链接。