Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Upgraded mac mojave php 7.3 to 8.1 using guide from https://stitcher.io/blog/php-81-upgrade-mac

php -v now shows
PHP 8.1.13 (cli) (built: Dec 27 2022 03:01:41) (NTS)

However...
phpinfo(); no longer works [Forbidden]
NOR
sudo apachectl restart
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using cdplMacMini.local. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start
(48)Address already in use: AH00072: make_sock: could not bind to address [::]:8080
(48)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:8080
no listening sockets available, shutting down
AH00015: Unable to open logs

I have "ServerName" in /private/etc/apache2/httpd.conf

httpd -v
Server version: Apache/2.4.54 (Unix)

I am at a loss as to what to do next
to httpd.conf I added
#LoadModule php7_module libexec/apache2/libphp7.so [I added the #]
LoadModule php_module /usr/local/opt/php@8.1/lib/httpd/modules/libphp.so
plus

DirectoryIndex index.php index.html
#DirectoryIndex index.html [my original]

Anyone who can assist will be greatly appreciated
Full disclosure - totally out of my depth with this
Is uninstall an option - ie go back to my php 7.3
Does the php.ini need replacing?
NEW: /usr/local/etc/php/8.1/php.ini
EXISTING: /private/etc/php.ini

You must be logged in to vote

It is not a good idea to mix PHP from brew and apache from the system, especially on old macOS versions like Mojave.

It is recommended to use apache from brew i.e httpd.
The formula and dependencies are the same on the core repo and in this tap. So you would have the same upgrade experience.

Replies: 3 comments

Comment options

followup...
https://MYSEVER.COM/phpinfo/index.php WORKS shows full php version info
https://MYSEVER.COM/phpinfo/ DOES NOT load
SO how can I have the url load without having the index.php after the folder? [which worked with php7.3]
also has
brew services restart httpd
replaced
sudo apachectl restart

You must be logged in to vote
0 replies
Comment options

...6+ hours later
Turns out the homebrew upgrade to php8.1 added a whole new httpd for Apache at
/usr/local/etc/httpd/httpd.conf

which was already existing at on my system at
/private/etc/apache2/httpd.conf

This new httpd for Apache rendered any terminal command sudo apachectl restart[start/stop/configtest] useless, hence the AH00558 errors
I finally discovered this new path/file when looking for the new php files

I finally concluded "/usr/local/etc/httpd/httpd.conf" was now the new "default" for all Apache "sudo apachectl commands"
So this new "httpd.conf" had to be fully configured along with "extra" config files, especially for VirtualHost and SSL support
So working from the "old" file to the "new" plus adding new bits from the upgrade install, the web server with new php8.1 seems to be now fully working 100%

Maybe I should have chosen "Normal upgrade: brew upgrade php"
and NOT "Upgrade with shivammathur/homebrew-php: brew install shivammathur/php/php@8.1" IF that added the new "/usr/local/etc/httpd/httpd.conf"

Maybe this experience noted here may help someone else

You must be logged in to vote
0 replies
Comment options

It is not a good idea to mix PHP from brew and apache from the system, especially on old macOS versions like Mojave.

It is recommended to use apache from brew i.e httpd.
The formula and dependencies are the same on the core repo and in this tap. So you would have the same upgrade experience.

You must be logged in to vote
0 replies
Answer selected by shivammathur
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.