Opened 6 months ago

Last modified 6 months ago

#68660 new defect

php: Installing PHP8.2 when PHP8.1 is installed - requires manual adjustments to httpd.conf

Reported by: jasimon9 Owned by:
Priority: Normal Milestone:
Component: ports Version: 2.8.1
Keywords: Cc:
Port: php

Description (last modified by jasimon9)

I have PHP8.1 on a machine. I wanted to upgrade it to PHP8.2. I ran all the install routines, including php82, php82-apache2handler, the apxs command, and the port select --set php php82.

After restarting apache, the local website was still running on PHP8.1, as shown by phpinfo().

I looked into httpd.conf and noted that both php_modules were loaded:

LoadModule php_module         lib/apache2/modules/mod_php81.so
LoadModule php_module         lib/apache2/modules/mod_php82.so

I commented out the first line, restarted apache again, and then PHP8.2 was running. So I was able to fix the problem for myself.

In addition I noticed that in the httpd.conf file that the ../extra/mod_php81.conf file was still referenced, instead of the php82 version. Harmless because the 81 and 82 files are identical in this instance, but nevertheless not the way it should be.

Change History (3)

comment:1 Changed 6 months ago by jasimon9

Description: modified (diff)

comment:2 Changed 6 months ago by ryandesign (Ryan Carsten Schmidt)

Milestone: MacPorts Future
Port: php added
Summary: Installing PHP8.2 when PHP8.1 is installed - requires manual adjustments to httpd.confphp: Installing PHP8.2 when PHP8.1 is installed - requires manual adjustments to httpd.conf

Yes, you can have multiple PHP versions installed at the same time, and you need to configure your web server to use whichever one(s) you want in the ways that you want. There are many PHP-compatible web servers and many different ways they can be set up so MacPorts can't set it up for you.

comment:3 in reply to:  2 Changed 6 months ago by jasimon9

Replying to ryandesign:

Yes, you can have multiple PHP versions installed at the same time, and you need to configure your web server to use whichever one(s) you want in the ways that you want. There are many PHP-compatible web servers and many different ways they can be set up so MacPorts can't set it up for you.

Thank you for that.

After the install, the new version of PHP is not running but rather the previous version.

I suggest adding “notes from the php app" that httpd.conf requires commenting out of versions that are not desired.

Note: See TracTickets for help on using tickets.