简体   繁体   English

启用PHP Apache2

[英]Enable PHP Apache2

I can find the php5 mod in the mods-available directory, but I'm not sure how to get it into the mods-enabled directory. 我可以在mods-available目录中找到php5 mod,但我不知道如何将它放入启用mods的目录中。

Also, I just wanted to check that this is the way to enable php on my device...I know that PHP is installed, but another dev has disabled it (and is uncontactable)! 另外,我只想检查这是在我的设备上启用php的方法...我知道PHP已安装,但是另一个开发者已经禁用它(并且是无法检测的)!

If anyone gets 如果有人得到

ERROR: Module phpX.X does not exist! 错误:模块phpX.X不存在!

just install the module for your current php version: 只需为当前的php版本安装模块:

apt-get install libapache2-mod-phpX.X

You can use a2enmod or a2dismod to enable/disable modules by name. 您可以使用a2enmoda2dismod按名称启用/禁用模块。

From terminal, run: sudo a2enmod php5 to enable PHP5 (or some other module), then sudo service apache2 reload to reload the Apache2 configuration. 从终端运行: sudo a2enmod php5启用PHP5(或其他一些模块),然后sudo service apache2 reload重新加载Apache2配置。

You have two ways to enable it. 您有两种方法可以启用它。

First, you can set the absolute path of the php module file in your httpd.conf file like this: 首先,您可以在httpd.conf文件中设置php模块文件的绝对路径,如下所示:

LoadModule php5_module /path/to/mods-available/libphp5.so

Second, you can link the module file to the mods-enabled directory: 其次,您可以将模块文件链接到启用mods的目录:

ln -s /path/to/mods-available/libphp5.so /path/to/mods-enabled/libphp5.so

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM