-
Notifications
You must be signed in to change notification settings - Fork 5
[Guide] PHP Setup
This document describes how to setup PHP in order to work on Dashbrd and is mainly aimed towards those who are unfamiliar and/or new to PHP development.
At time of writing PHP 8.2 is used unless stated otherwise.
Generally, these PHP extensions/modules need to be installed on your machine:
php-zip php-pdo php-pdo_pgsql php-intl php-process php-pecl-redis5 php-gd php-gmp
How you install them depends on your target machine. Below you can find instructions for different operating systems. Feel free to add/update instructions if anything should be missing.
Let's not go there. You should be able to find what you need in https://laravel.com/docs/10.x#getting-started-on-windows
Make sure to install the following:
- Composer
- Homebrew, to make your life easier
- Valet, personal preference but it works in an easy way
- Sanity check for PHP 8.2, to make sure it's set to 8.2
- Redis and XDebug (optional)
Basically if you install all of the above, you will have everything you need for a basic Laravel setup. You can run valet through valet link
in the directory you want to serve (usually the root of the repository) and then navigating to <name>.test
in your browser.
sudo dnf install http://rpms.remirepo.net/fedora/remi-release-37.rpm -y
sudo dnf config-manager --set-enabled remi
sudo dnf module reset php
sudo dnf module install php:remi-8.2
sudo dnf install php-zip php-pdo php-pdo_pgsql php-intl php-process php-pecl-redis5 php-gd php-gmp
# Debugger
sudo dnf install php82-php-pecl-xdebug3
## Add this line to /etc/php.ini
zend_extension=/opt/remi/php82/root/usr/lib64/php/modules/xdebug.so
## Verify it gets loaded
php -v
PHP 8.2.3 (cli) (built: Feb 14 2023 01:06:39) (NTS gcc x86_64)
Copyright (c) The PHP Group
Zend Engine v4.2.3, Copyright (c) Zend Technologies
with Xdebug v3.2.0, Copyright (c) 2002-2022, by Derick Rethans
Composer is a dependency manager similar to npm
and is required to install additional libraries.
curl -Ss https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
chmod +x /usr/local/bin/composer