# PHP broken since php 7.0 install [SOLVED]

## binro

I have just noticed that no php apps work on my Apache server. PHP7 was recently installed and has been selected and I have updated apache2 options:

```

APACHE2_MODULES="actions alias auth_basic authn_core auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_core authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info lbmethod_byrequests log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif slotmem_shm so socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias"

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D MANUAL -D SSL -D SSL_DEFAULT_VHOST -D SUEXEC -D LANGUAGE -D NAGIOS -D STATUS -D PHP7"

```

I tried reverting to php 5.6 but that didn't help. I also recompiled apache and php with gcc 5.3 which I have just converted to. What have I missed?

TIA

----------

## Ant P.

 *binro wrote:*   

> What have I missed?

 

Error logs, maybe?  :Rolling Eyes: 

----------

## binro

The only message is:

Dec 31 23:03:00 opal apache2[4858]: [core:alert] [pid 4858] [client 66.249.71.154:57965] /var/www/localhost/htdocs/phpsyslogng/html/.htaccess:

Invalid command 'php_flag', perhaps

misspelled or defined by a module not included in the server configuration

which apparently means PHP is not loaded. Apart from that you only see see the php source in the browser, it is not executed.

----------

## Ant P.

That's a problem then. Does anything out of the ordinary get logged when you restart apache?

----------

## binro

Nothing.   :Sad: 

----------

## ct85711

I haven't installed apache and php in a while, but some things you may want to check for is first:

make sure on your system, you have 

```
libphp7.so
```

 using locate or find will be a easy test to make sure you have that file.

Also, according to php's documentation, in your apache conf's, you should have a line 

```
LoadModule php7_module modules/libphp7.so
```

 somewhere (if it's commented out, it's not enabled)

http://php.net/manual/en/install.unix.apache2.php

Almost forgot, not sure if this also applies for gentoo, but on some other distros, they've been having an issue where the php7 config file was not installed.

----------

## binro

```
 locate libphp7.so

/usr/lib64/php7.0/apache2/libphp7.so

```

The module is installed and there is a LoadModule for it (in /var/lib/eselect-php/mod_php.conf because of the eselect mechanism). There is also a /etc/php/apache2-php7.0/php.ini so it all looks good, it just doesn't work.

----------

## juergen-ger

See this bug https://bugs.gentoo.org/show_bug.cgi?id=569042

The same here.Downgrade to app-eselect/eselect-php-8.0 works for me.

----------

## ct85711

from my understanding from the mailing list linked to the bug report, it mentions instead of doing -D PHP7 or PHP5 try -D PHP instead.

----------

## juergen-ger

Right,if you are upgrading.And also "you must run eselect at least once to choose your apache2 target before the new configuration will work."

----------

## binro

 *juergen-ger wrote:*   

> See this bug https://bugs.gentoo.org/show_bug.cgi?id=569042
> 
> The same here.Downgrade to app-eselect/eselect-php-8.0 works for me.

 

Thank you! I changed APACHE2_OPTS to -D PHP and it all worked again. I fixed it using my phone in a bar, it was that simple. OK, phpsyslog-ng had all sorts of problems with PHP7 but switching back to PHP 5.6 fixed that.

Thanks to all who tried to help.   :Very Happy: 

----------

