Install PHP 8.3 on Windows, then add the directory containing php.exe to PATH
winget install PHP.PHP.8.3Set up PHP: install on Windows, Linux and macOS, enable extensions in php.ini, install Composer with a mirror, run the built-in server, debug and fix common errors.
Install PHP 8.3 on Windows, then add the directory containing php.exe to PATH
winget install PHP.PHP.8.3For a turnkey Apache/Nginx + MySQL + PHP stack on Windows, install Laragon
winget install LeNgocKhoa.LaragonInstall PHP and common extensions via Homebrew on macOS or the ondrej repo on Ubuntu
# macOS
brew install php@8.3
brew link --force php@8.3
# Ubuntu / Debian
sudo apt update && sudo apt install -y php8.3 php8.3-cli php8.3-mbstring php8.3-xml php8.3-curlConfirm the version and list loaded extensions
php -v
php -mShow which php.ini is in use before editing configuration
php --iniSwitch the global Composer repository to the Aliyun mirror for much faster installs
composer config -g repos.packagist composer https://mirrors.aliyun.com/composer/Confirm the mirror is written into the global config.json
composer config -g --list | findstr reposSwitch the mirror for this project only so other projects keep their own repositories
composer config repos.packagist composer https://mirrors.tencent.com/composer/Configure credentials for a private repository; they are stored in the global auth.json
composer config -g http-basic.repo.example.com username passwordRoute composer through a proxy on Windows; use export on macOS/Linux
set HTTP_PROXY=http://127.0.0.1:7890
set HTTPS_PROXY=http://127.0.0.1:7890Add the PHP bin directory to PATH so php can be called directly
# Windows
setx PATH "%PATH%;C:\php"
# macOS / Linux
echo 'export PATH="/opt/homebrew/opt/php@8.3/bin:$PATH"' >> ~/.zshrcEnable common extensions in php.ini; restart PHP-FPM or the web server afterwards
extension=mbstring
extension=openssl
extension=pdo_mysql
extension=curlPoint extension_dir at the ext folder on Windows or extension= entries fail to load
extension_dir = "C:\php\ext"Check that the CLI and the web server read the same php.ini
php -i | findstr "Loaded Configuration File"Check the memory limit before handling large files or batch jobs
php -r "echo ini_get('memory_limit');"Verify the CLI environment without a web server
php -r "echo PHP_VERSION, PHP_EOL;"Create a Laravel project with Composer and start the dev server
composer create-project laravel/laravel demo
cd demo
php artisan serveUse the built-in server for a zero-config preview; development only
php -S 127.0.0.1:8000 -t publicRestore dependencies from the lock file and refresh the autoload map
composer install
composer dump-autoloadValidate composer.json and check dependencies for known vulnerabilities
composer validate
composer auditInstall the Xdebug debugger and Intelephense IntelliSense
code --install-extension xdebug.php-debug
code --install-extension bmewburn.vscode-intelephense-clientEnable Xdebug in php.ini for breakpoint debugging with an IDE
zend_extension=xdebug
xdebug.mode=debug,develop
xdebug.client_port=9003Install the coding standard checker to keep team style consistent
composer global require squizlabs/php_codesnifferWhen php is missing or the wrong version, check which executable PATH resolves
# Windows
where php
# macOS / Linux
which -a phpRun a syntax check to catch the errors behind blank pages or 500s
php -l index.phpTemporarily surface every error in development so nothing is swallowed
php -d display_errors=1 -d error_reporting=E_ALL -S 127.0.0.1:8000Clear the cache and reinstall when packages download corrupted
composer clear-cache
composer install --no-cacheRun a one-shot check of network, mirror, certificate and config issues
composer diagnoseSwitch the Windows console to UTF-8 when Chinese output is garbled
chcp 65001This website uses cookies to ensure you get the best experience on our website. Privacy Policy.