wqzbxh 2011-06-15
一、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文件,加入
ServerNamelocalhost
或者
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
以下可选择安装:
sudoapt-getinstallphp5-curl
sudoapt-getinstallphp5-xmlrpc
sudoapt-getinstallphp5-imagick
sudoapt-getinstallphp5-cgi
sudoapt-getinstallphp5-fpm
sudoapt-getinstallphp5-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
sudoapt-getinstallmysql-server
mysqladmin-urootpassworddb_user_password
#db_user_password替换为密码四、ubuntu11.04安装Mysql模块
sudoapt-getinstalllibapache2-mod-auth-mysql
sudo apt-get install php5-mysqlsudo /etc/init.d/apache2 restart //重启APACHE
五、配置php.ini:
sudogedit/etc/php5/apache2/php.ini
把文件在文件后面的:
#extension=mysql.so
#extension=gd.so
的#去掉。六、ubuntu11.04安装phpmyadmin
sudoapt-getinstallphpmyadmin
测试:http://localhost/phpmyadmin/sudo /etc/init.d/apache2 restart //重启APACHE
————————————小贴士:
如果按照上面的方法安装的php环境,
打开http://localhost/phpmyadmin/这个链接出现
NotFound
TherequestedURL/phpmyadmin/wasnotfoundonthisserver.
Apache/2.2.9(Ubuntu) PHP/5.3.6-2ubuntu4 with Suhosin-Patch Server at localhost Port 80sudo ln -s /usr/share/phpmyadmin/ /var/www/
phpmyadmin的默认安装路径不是在/var/www/(/var/www/是你的web服务站点的根目录),所以建一个软连接就可以了。
上述命令是在/var/www/下建一个phpmyadmin的软链接。