Change php version Apache uses

New to Debian (Or Linux in general)? Ask your questions here!

Change php version Apache uses

Postby banderas20 » 2018-07-01 17:13


I have come to have php 7.0, 7.1 and 7.2 installed on a single system.

My apache2 is using php 7.0, and I want to force it to use 7.1.

I have taken a look at
Code: Select all
, but I can't find anything related to php version.
On the other hand, I can't find
Code: Select all

¿Any help?

Posts: 107
Joined: 2016-11-10 15:30

Re: Change php version Apache uses

Postby GarryRicketson » 2018-07-01 19:18
You should read the above link, completly, below is just some pieces:
Configuring Apache 2 on Debian, Ubuntu

The Debian distribution of Linux includes the Apache web server, both the venerable version 1 and the more modern version 2. The Debian maintainers have a peculiar way of arranging the configuration files for Apache 2.0 which is not documented in the standard Apache documentation. This introduction should help you get acclimated to the Debian way of configuring Apache 2.0.

Conclusion and Resources

Although Debian’s configuration setup for Apache 2 is non-standard, it is still fairly easy to understand, and it provides tools that make life easier for the administrators of web servers that change often or serve multiple web sites. For additional help, view the Debian README file at /etc/apache2/README. For general information on configuring Apache, try these resources.

Have you read the README file ?
Since I do not use apache2, I do not have it handy, but it seems like that is what you should read first.
What does this command show ?:
Code: Select all
locate httpd.conf

======== edit ====
according to this,
This guide lists the default installation layouts for Apache HTTPD on various operating systems and distributions.

While examples in the main Apache HTTP Server documentation assume that you are using the standard file layout distributed from, many third-party distributors change the layout to conform to local policies. This can make it difficult to follow the examples and to find various important files. Using the information below, you can find where things live on your local install, and compare it to the standard Apache httpd paths.
there is no httpd.conf file:
Code: Select all
ServerRoot              ::      /etc/apache2
DocumentRoot            ::      /var/www
Apache Config Files     ::      /etc/apache2/apache2.conf
                        ::      /etc/apache2/ports.conf
Default VHost Config    ::      /etc/apache2/sites-available/default, /etc/apache2/sites-enabled/000-default
Module Locations        ::      /etc/apache2/mods-available, /etc/apache2/mods-enabled
ErrorLog                ::      /var/log/apache2/error.log
AccessLog               ::      /var/log/apache2/access.log
cgi-bin                 ::      /usr/lib/cgi-bin
binaries (apachectl)    ::      /usr/sbin
start/stop              ::      /etc/init.d/apache2 (start|stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean)
User avatar
Posts: 5287
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: Change php version Apache uses

Postby banderas20 » 2018-07-02 04:58


I have done it by replacing the symlinks in
Code: Select all
directory to proper php version in
Code: Select all

Posts: 107
Joined: 2016-11-10 15:30

Return to Beginners Questions

Who is online

Users browsing this forum: No registered users and 4 guests