Ad

Change Apache2 Php Path

- 1 answer

I am using https://github.com/wilmoore/php-version to switch between php versions on my local machine, installed within ~/php/versions. Currently setting up separate VMs with different versions of php installed is not an option.

When I switch php version through the command line using the linked tool, I see it listed as php 7. This also works when using php -v. I have restarted terminal and the machine and it still says php 7.

I have updated composer.json to require php 7.0.2 and greater. Yet when I use phpinfo() in my laravel application, it always states the default PHP Version 5.5.9-1ubuntu4.14.

Where is laravel pointing to the php distribution in my Ubuntu 14.04.3 machine and where can I change this path?

EDIT: I am using Apache. I can see in the phpinfo() output that it is reading the ini file from /etc/php5/apache2/php.ini. I have looked in this file but cannot see where to point to the php distribution.

Ad

Answer

The Apache loads the php5_module library in /etc/apache2/mods-available/php5.load.

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

If you know the loactions of your alternative libraries you can change them in this file.

After editing you need to restart your apache. sudo service apache2 restart or sudo systemctl restart apache2.service

Ad
source: stackoverflow.com
Ad