El Manu
El Manu

Reputation: 81

How can I change the PHP version used by phpmyadmin?

I have phpmyadmin installed on my ubuntu server, that runs several versions of PHP depending on the website used. The default version is 7.4, but phpmyadmin use 7.2 for unknown reason. Simple question : where do I change that ? Cannot find it in any forum or documentation...

I tried to put in phpmyadmin/apache.conf what I use in my virtual hosts sites :

<FilesMatch \.php$>
    SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost/"
</FilesMatch>

but it doesn't work and I still have 7.2

Thanks a lot !

Upvotes: 3

Views: 28238

Answers (3)

Mike C
Mike C

Reputation: 413

Here's how I do it:

Go to phpMyAdmin config

cd /etc/apache2/sites-available

Open config file

sudo nano phpmyadmin.conf

Put the following line inside the tags to serve 7.4:

include /etc/apache2/conf-available/php7.4-fpm.conf

Restart apache:

sudo systemctl restart apache2

Note that my setup is mostly from this tutorial.

Upvotes: 1

Naveen Kumar
Naveen Kumar

Reputation: 1067

Add the below code inside /etc/phpmyadmin/apache.conf

<Directory /usr/share/phpmyadmin>
    <FilesMatch \.php$>
    SetHandler "proxy:unix:/var/run/php/php8.1-fpm.sock|fcgi://localhost/"
    </FilesMatch>
</Directory>

After that restart Apache

sudo systemctl restart apache2

Upvotes: 1

El Manu
El Manu

Reputation: 81

Solution found ! As my Phpmyadmin installation doesn't use the virtual host file system, the file to modify is /etc/phpmyadmin/apache.conf

I put a code, but outside the Directory tags, and you have to put it inside to make it work :

<Directory /usr/share/phpmyadmin>
    <FilesMatch \.php$>
    SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost/"
    </FilesMatch>
</Directory>

And then, restart Apache change the PHP version of phpmyadmin page.

Thanks !

Upvotes: 5

Related Questions