安装PHP和Apache
安装完成的apache在目录/etc/apache2下。运行apache:
运行不成功,出现错误:httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
这时要在修改/etc/apache2/apache2.conf,添加:
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
参考: