# php stops working



## balanga (Mar 13, 2018)

I have an apache24 server which has suddenly stopped formatting php statements. php has been formatting properly for months but all of a sudden info.php  

```
<?php phpinfo(); ?>
```
just shows up as plain text.

I have restarted apache but it makes no difference.

Why would php stop working?


----------



## obsigna (Mar 13, 2018)

Execute `apachectl -M` and verify that either the php5_module or the php7_module is in the list of the loaded modules. In case neither is loaded, enable the module in /usr/local/etc/apache24/httpd.conf. Corresponding to the installed PHP version there must be a line either of:

```
LoadModule php5_module    libexec/apache24/libphp5.so
```
or

```
LoadModule php7_module    libexec/apache24/libphp7.so
```

Then verify that the following directive is present somewhere in your configuration files and in addition is active for the respective web site.

```
<IfModule php7_module>
    DirectoryIndex index.php index.html
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
</IfModule>
```

Of course if you got PHP5.x installed, the above ifModule directive should reference the php5_module.

Then you need to restart Apache.


----------



## balanga (Mar 13, 2018)

obsigna said:


> Execute `apachectl -M` and verify that either the php5_module or the php7_module is in the list of the loaded modules. In case neither is loaded, enable the module in /usr/local/etc/apache24/httpd.conf. Corresponding to the installed PHP version there must be a line either of:
> 
> ```
> LoadModule php5_module    libexec/apache24/libphp5.so
> ...



Many thanks for this. Indeed the *php7_module* was missing from httpd.conf - no idea how that happened. All the other php72  modules required for Wordpress were installed...


----------



## obsigna (Mar 14, 2018)

balanga said:


> ... Indeed the *php7_module* was missing from httpd.conf - no idea how that happened...



Incidents to the instrumentation in our chemical laboratory were always blamed on the cleaning maid :-D


----------



## balanga (Mar 14, 2018)

Actually, I know exactly who was responsible for the missing php module 

I was updating two jails and obviously missed out one step in one of them.


----------

