Home >Backend Development >PHP Tutorial >Ubuntu installs a simple php environment (excluding mysql)

Ubuntu installs a simple php environment (excluding mysql)

WBOY
WBOYOriginal
2016-07-30 13:30:301067browse

1.安装
安装 Apache2:
sudo apt-get install apache2
安装PHP模块:
sudo apt-get install php5

2.修改,添加别名,apache2.conf文件

<code>Alias /client/ <span>"/var/www/client/"</span>
<<span>Directory</span><span>"/var/www/client/"</span>>
        <span>Options</span> Indexes FollowSymLinks
        AllowOverride <span>None</span>
        Require all granted
</<span>Directory</span>>
</code>

Require all granted很重要,要根据apache的版本来决定。

3.重启
sudo /etc/init.d/apache2 restart

4.如果php不能执行的话,考虑如下

在apache2.conf中找到
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf
在其后面添加
Include /etc/apache2/mods-available/php5.load
Include /etc/apache2/mods-available/php5.conf

版权声明:本文为博主原创文章,未经博主允许不得转载。

以上就介绍了ubuntu 安装简单php环境(不包含mysql),包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn