Apache Lounge



Forum Index Downloads Search Register Log in  RSS Apache Lounge

Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.



A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored by anyone.

Your donations will help to keep this site alive and well, and continuing the building of the binaries.

Cannot change PHP version or Server API

Post new topic   Reply to topic    Apache Forum Index -> Other Software

View previous topic :: View next topic  
Author Message

Joined: 10 Jun 2017
Posts: 3
Location: South Africa, Johannesburg

PostPosted: Fri 14 Jul '17 10:48    Post subject: Cannot change PHP version or Server API Reply with quote

I have spent a week searching and trying all sorts of solutions for my problem to no avail.

Here is the scenario: PHP version 5.4 was installed. Now installed PHP version 5.6.

Virtualmin - System settings - recheck configuration shows: The following PHP versions are available : 5.4.16 (/bin/php-cgi), 5.6.25 (/opt/rh/php56/root/usr/bin/php-cgi)

Virtualmin - System settings - server templates - apache shows: Apache mod_php and Default PHP version 5.6.25 (5.4 can also be selected on the dropdown) NOTE: whatever I change here makes no difference - for eg. change to FCGId - still shows Server API : Apache 2.0 Handler (mod_php) even after server reboot.

php -v and phpinfo() shows PHP5.4.

However when I type in: scl enable rh-php56 bash Then php -v shows PHP5.6! but phpinfo() on one domain and Woocommerce on another domain both show PHP5.4 Reboot server and php -v shows PHP5.4 again.

The template located at: /etc/webmin/virtual-server/templates/1 is empty.

I am running NGINX.

This is my Apache global configuration (/etc/httpd/conf/httpd.conf):

ServerRoot "/etc/httpd"
StartServers 2
MinSpareServers 6
MaxSpareServers 12
MaxClients 30
MaxRequestWorkers 256
MaxRequestsPerChild 3000

Listen *:8080
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost

<Directory />
AllowOverride none
Require all denied

DocumentRoot "/var/www/html"

<Directory "/var/www">
AllowOverride None
# Allow open access:
Require all granted

<Directory "/var/www/html">
AllowOverride None
Require all granted

<IfModule dir_module>
DirectoryIndex index.html

<Files ".ht*">
Require all denied

ErrorLog "logs/error_log"
LogLevel warn

<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common

<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio

CustomLog "logs/access_log" combined


<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted

<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

AddDefaultCharset UTF-8

<IfModule mime_magic_module>
MIMEMagicFile conf/magic

EnableSendfile on

IncludeOptional conf.d/*.conf
SSLProtocol ALL -SSLv2 -SSLv3
ServerTokens Minimal
ServerSignature Off
TraceEnable Off

<VirtualHost [1111:0000::cccc:ffff:8888:175]:8080>
SuexecUserGroup "#538" "#517"
ServerAdmin admin@domain.com
ServerName domain.com
ServerAlias www . domain . com
ServerAlias webmail.domain . com
ServerAlias admin.domain.com
DocumentRoot /home/domain/public_html
ErrorLog /var/log/virtualmin/domain.com_error_log
CustomLog /var/log/virtualmin/domain.com_access_log combined
ScriptAlias /cgi-bin/ /home/domain/cgi-bin/
ScriptAlias /awstats/ /home/domain/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/domain/public_html>
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
AddType application/x-httpd-php .php
AddType application/x-httpd-php5 .php5
<Directory /home/domain/cgi-bin>
allow from all
AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
Require all granted
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.domain.com
RewriteRule ^(.*) https:// domain . com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.domain.com
RewriteRule ^(.*) https:// domain . com:10000/ [R]
<Files awstats.pl>
AuthName "domain.com statistics"
AuthType Basic
AuthUserFile /home/domain/.awstats-htpasswd
require valid-user
php_value memory_limit 32M


Apache Log files show this on every reboot:

[Thu Jun 08 16:37:41.746759 2017] [core:notice] [pid 9267] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND' [Thu Jun 08 20:00:30.678476 2017] [mpm_prefork:notice] [pid 9267] AH00170: caught SIGWINCH, shutting down gracefully [Thu Jun 08 20:01:19.281138 2017] [suexec:notice] [pid 4057] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec) [Thu Jun 08 20:01:20.005418 2017] [auth_digest:notice] [pid 4057] AH01757: generating secret for digest authentication ... [Thu Jun 08 20:01:20.007244 2017] [lbmethod_heartbeat:notice] [pid 4057] AH02282: No slotmem from mod_heartmonitor [Thu Jun 08 20:01:23.446113 2017] [mpm_prefork:notice] [pid 4057] AH00163: Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_fcgid/2.3.9 PHP/5.4.16 SVN/1.7.14 configured -- resuming normal operations [Thu Jun 08 20:01:23.446502 2017] [core:notice] [pid 4057] AH00094: Command line: '/usr/sbin/httpd -D FOREGROUND'

Virtualmin - Server configuration - PHP versions shows:

This virtual server is using the mod_php execution mode for PHP, such does not allow per-directory version selection.

I do not know if it is Apache or NGINX that is reading the wrong information. I just cannot change the PHP version at all.

Please help!
Back to top
James Blond

Joined: 19 Jan 2006
Posts: 6189
Location: Germany, Next to Hamburg

PostPosted: Sun 23 Jul '17 17:03    Post subject: Reply with quote

There is a tutorial how to use mod_fcgid with php


I made also an example how to use php5 with mod_fcgid on debian


you can run mod_php and mod_fcgid parallel
Back to top

Joined: 10 Jun 2017
Posts: 3
Location: South Africa, Johannesburg

PostPosted: Wed 26 Jul '17 10:16    Post subject: Problem solved! Reply with quote

Thanks to: https://www.digitalocean.com/community/tutorials/how-to-upgrade-to-php-7-on-centos-7

Remove all repositories as I want to change to IUS for CENTOS 7. This can be done by removing the webtatic-release package and others, which controls various .repo files within the /etc/yum.repos.d/ directory.

yum remove webtatic-release -y
Do it for any other repositories.

sudo yum remove php-cli mod_php php-common

Install IUS repository:
yum install https://centos7.iuscommunity.org/ius-release.rpm

Install the new PHP 7 packages from IUS. Press y and Enter when prompted.

sudo yum install mod_php70u php70u-cli php70u-mysqlnd

Finally, restart Apache to load the new version of mod_php:

service httpd restart

service httpd status

Back to top

Post new topic   Reply to topic    Apache Forum Index -> Other Software
Page 1 of 1