简体   繁体   中英

Cannot load localhost after update to BigSur (apache might be running)

I upgraded my laptop to mac OS bigsur, it is not at all smooth.

Last thing I found it broke is that I cannot access to localhost anymore:

在此处输入图像描述

在此处输入图像描述

I searched for a solution but could not find anything but that apache, php and mysql come preinstalled on big sure and everything should run smoothly. it is not.

Situation I have apache and php installed before the upgrade, and don't know how to debug what is wrong. I want to avoid using homebrew ( I am used in using python webservers installed via pip and conda to serve websites, and I fear homebrew messed up with the paths).

I referenced to: https://tech-cookbook.com/2020/11/14/setting-up-your-local-web-server-on-macos-big-sur-11-0-1-2020-mamp-macos-apache-mysql-php/

and https://medium.com/nerd-for-tech/how-to-run-apache-php-on-mac-os-big-sur-7ffbf7cbef7b

I tried to launch apache:

sudo apachectl start

/System/Library/LaunchDaemons/org.apache.httpd.plist: service already loaded
Load failed: 37: Operation already in progress

Mac X does not display a return message.

So I wanted to check the status, from here: https://serverfault.com/questions/297972/osx-how-to-show-apache-status-in-terminal

I tried:


[pid 2444] AH06665: No code signing authority for module at /usr/local/php5/libphp5.so specified in LoadModule directive. Proceeding with loading process, but this will be an error condition in a future version of macOS.
httpd: Syntax error on line 555 of /private/etc/apache2/httpd.conf: Syntax error on line 8 of /private/etc/apache2/other/+php-osx.conf: Cannot load /usr/local/php5/libphp5.so into server: dlopen(/usr/local/php5/libphp5.so, 10): Symbol not found: _unixd_config\n  Referenced from: /usr/local/php5/libphp5.so\n  Expected in: /usr/sbin/httpd\n in /usr/local/php5/libphp5.so

So I guess Php5 is broken, and apparently mac X fails to load Apache (but I don't get any message and still don't know how to check status like a systemctl status apache in linux ).

I thought about removing php5 and resintall: https://askubuntu.com/questions/59886/how-to-completely-remove-php

but the solutions there seem risky to me and worse the situation.

Can you please show how to debug if/where Apache breaks, to successfully connect to localhost, and 'user.local' domain name set up by 'user', and to serve websites in the Sites folder in BigSur, if one has already Apache and Php5?


Other info:

apachectl -v
Server version: Apache/2.4.53 (Unix)
Server built:   Apr 26 2022 20:36:30


php -v
WARNING: PHP is not recommended
PHP is included in macOS for compatibility with legacy software.
Future versions of macOS will not include PHP.
PHP 7.3.29-to-be-removed-in-future-macOS (cli) (built: Sep  6 2021 05:14:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.29, Copyright (c) 1998-2018 Zend Technologies

Found this solution.

in /private/etc/apache2/ folder, my httpd.conf had this last line:

Include /private/etc/apache2/other/*.conf

from there there were additional configurations to php5, but it seemed (I did not know that) big sur installed php7.

So I removed the loading from php5, and apache now starts.

Localhost is loading successfully, it resolved my problem.

However, if I:

apachectl configtest

AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using MacBook-Pro.local. Set the 'ServerName' directive globally to suppress this message
Syntax OK

I could not locate exactly what MacBook-Pro.local refers to: I tried find. -name MacBook-Pro.local find. -name MacBook-Pro.local and there are many.

Referring to: https://www.digitalocean.com/community/tutorials/apache-configuration-error-ah00558-could-not-reliably-determine-the-server-s-fully-qualified-domain-name

the error AH00558 means that:

AH00558: Could not reliably determine the server's fully qualified domain name

I did not understand how the configuration is actually loaded.

In /private/etc/apache2/httpd.conf ServerName is commented out:

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.com:80

But if tried to browse

https://localhost, https://my-user.local , https://127.0.0.1

all works (like before), but did not understand where they came from.

Comments to help cleaning unnecessary configurations and uninstall unused PhP packages will be appreciated

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM