您的位置:首页 > 运维架构 > Apache

ubuntu 配置 LAMP(Linux+Apache+Mysql+PHP)环境

2015-05-22 18:12 931 查看
安装PHP和Apache

sudo apt-get install apache2
sudo apt-get install php5
<code class="plain" style="background-image: none !important; position: static !important; padding: 0px !important; line-height: 1.1em !important; border-width: 0px !important; margin: 0px; outline-width: 0px !important; width: auto !important; bottom: auto !important; display: inline !important; font-family: consolas, 'bitstream vera sans mono', 'courier new', courier, monospace !important; direction: ltr !important; float: none !important; height: auto !important; font-size: 1em !important; vertical-align: baseline !important; top: auto !important; right: auto !important; left: auto !important; ">sudo apt-get install libapache2-mod-php5 </code>


安装完成的apache在目录/etc/apache2下。运行apache:

/etc/init.d/apache2 start


运行不成功,出现错误:httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

这时要在修改/etc/apache2/apache2.conf,添加:

ServerName 127.0.0.1:80
之后重启apache2即可,我们可以在/var/www/html中编写自己的静态文件以供浏览器访问

安装PHP对Mysql的API

sudo apt-get install php5-mysql mysql-server

参考:

Ubuntu下的PHP开发环境架设
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php mysql