Trying to get the built in web-server to work

When running the page i get this error.

/opt/homebrew/Cellar/php/8.2.3/bin/php -c /opt/homebrew/bin/php -S localhost:80 -t /Applications/XAMPP/xamppfiles/htdocs/
PHP:  syntax error, unexpected '!' in /opt/homebrew/Cellar/php/8.2.3/bin/php on line 1
[Mon Feb 20 17:21:13 2023] Failed to listen on localhost:80 (reason: Permission denied)

Process finished with exit code 1

1 comment

Hello! Please, change the port you use in the PHP server configuration to 1024 or higher. It will fix the Failed to listen on localhost:80 error.

The PHP: syntax error, unexpected '!' in /opt/homebrew/Cellar/php/8.2.3/bin/php on line 1 can occur because you specify the path to the configuration file in the settings of CLI incorrectly. To fix it, remove this path specification in the settings of the CLI interpreter.

Alternatively, it may be caused by incorrect run configuration. Then to fix it, open Run | Edit configurations, choose build-in server configuration, and delete -c /opt/homebrew/bin/php in the Interpreter options field.

I noticed that you are using the path of XAMPP document root for the built-in PHP server. Using XAMPP instead of the built-in PHP server may be more convenient.


Please sign in to leave a comment.