ubuntu14 安装apache和php环境
2014-12-31 21:48
323 查看
第一步:安装apache2
这个是没有指定ServerName的:http://stackoverflow.com/questions/5856205/starting-httpd-httpd-could-not-reliably-determine-the-servers-fully-qualified
http://wiki.ubuntu.com.cn/%E6%94%B9%E5%8F%98Apache%E7%BC%BA%E7%9C%81%E7%AB%AF%E5%8F%A3%E5%8F%B7
搜寻
替换成
浏览 http://localhost:90/html/出现 It works! apache安装成功
第二步:安装php环境
重启apache:
这地方很多博客都在www目录下编辑,浏览也没有html,我本地是浏览不成功的
sudo apt-get install apache2可能会出现如下错误:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
这个是没有指定ServerName的:http://stackoverflow.com/questions/5856205/starting-httpd-httpd-could-not-reliably-determine-the-servers-fully-qualified
Edit Apache2 conf file : vim /etc/apache2/apache2.conf Insert the following line at the apache2.conf: ServerName localhost Restart Apache2: apache2ctl restart or /etc/init.d/apache2 restart但是我本地装了nginx,他可能会出现如下错误:
# /etc/init.d/httpd restart Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80 (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 no listening sockets available, shutting down Unable to open logs出现这个情况,有两个解决方案,网上很多关于二者共存的,可是我只是用来学习的,还是用绕道的方式,把apache的端口改掉
http://wiki.ubuntu.com.cn/%E6%94%B9%E5%8F%98Apache%E7%BC%BA%E7%9C%81%E7%AB%AF%E5%8F%A3%E5%8F%B7
sudo cp /etc/apache2/ports.conf /etc/apache2/ports.conf_backup sudo gedit /etc/apache2/ports.conf
搜寻
Listen 80
替换成
Listen 90
sudo /etc/init.d/apache2 restart
浏览 http://localhost:90/html/出现 It works! apache安装成功
第二步:安装php环境
sudo apt-get install libapache2-mod-php5 php5 php5-gd php5-mysql
重启apache:
sudo /etc/init.d/apache2 restart下面进行测试:
sudo gedit /var/www/html/test.php添加如下代码:
<?php echo phpInfo();?>浏览:http://localhost:90/html/test.php
这地方很多博客都在www目录下编辑,浏览也没有html,我本地是浏览不成功的
相关文章推荐
- 在ubuntu中安装PHP(apache+mysql+phpmyadmin)开发环境
- ubuntu 64 server 环境安装php5.3.10+mysql5.5.20+apache2.2.22
- Ubuntu上安装PHP环境-mysql+apache+php-Linux操作系统
- Ubuntu10.10安装Drupal7及其环境(apache,mysql,php)
- 安装ubuntu10.10后,如何配置一个Apache+MySQL+PHP环境
- ubuntu 11.10下面安装apache+php+mysql+phpadmin搭建web环境
- Ubuntu14安装apache+mysql+php步骤
- Ubuntu下安装PHP环境(Apache+MySQL)
- UBUNTU10.10安装LAMP(Linux、Apache、Mysql、Php)环境图文教程
- ubuntu 11.10下面安装apache+php+mysql+phpadmin搭建web环境
- 安装ubuntu10.10后,如何配置一个Apache+MySQL+PHP环境
- 转载文章 ubuntu安装php Apache mysql 继承环境
- ubuntu 安装php环境/apache/php/mysql
- ubuntu 64 server 干净环境安装php5.3.10+mysql5.5.20+apache2.2.22
- ubuntu环境安装PHP+Apache
- UBUNTU10.10安装LAMP(Linux、Apache、Mysql、Php)环境教程
- Ubuntu10.10安装Drupal7及其环境(apache,mysql,php)
- 在Ubuntu上安装Apache、MySql和PHP环境,手把手都会菜鸟
- Ubuntu-14-04-安装PHP环境和反向代理
- 在Ubuntu上安装Apache、MySql和PHP环境,手把手都会菜鸟