This guide shows how to configure a basic PHP development environment on Fedora 44 using mise for version management, PHP 8.5, ZSH with Oh My ZSH, and Docker Engine.
The goal is to create a clean and flexible setup for local PHP development, allowing you to manage PHP versions per project while also having Docker available for containers, databases, queues, and other services.
1. Update the system
Start by updating all system packages:
sudo dnf update -y
After the update finishes, reboot the system if Fedora installs a new kernel or important system libraries:
sudo reboot
2. Install basic development tools
Install common utilities such as Git, Vim, cURL, ZSH, and basic build tools:
sudo dnf install -y vim curl git zsh gcc gcc-c++ make pkgconf-pkg-config
Check the installed versions:
git --version
vim --version
zsh --version
3. Install and configure Oh My ZSH
Install Oh My ZSH to improve the terminal experience:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
During the installation, the script may ask whether you want to set ZSH as your default shell. Choose:
Y
You may also be asked for your password to confirm the shell change.
If you need to change the shell manually later, run:
chsh -s "$(which zsh)"
Then log out and log back in.
4. Install PHP build dependencies
Because PHP installed through mise is usually compiled locally, you need development libraries and build dependencies.
Install the required packages:
sudo dnf install -y \
autoconf \
bison \
clang \
gd-devel \
libcurl-devel \
libpq-devel \
libxml2-devel \
libzip-devel \
oniguruma-devel \
openssl-devel \
readline-devel \
re2c \
sqlite-devel \
libsodium-devel \
libicu-devel \
bzip2-devel \
libjpeg-turbo-devel \
libpng-devel \
libwebp-devel \
freetype-devel
These packages provide support for common PHP extensions such as:
curlgdintlmbstringopensslpdo_pgsqlpdo_sqlitereadlinesodiumzip
5. Install mise
mise is a version manager for development tools and languages. It can replace tools like ASDF, NVM, pyenv, rbenv, and similar version managers.
Enable the mise COPR repository and install it:
sudo dnf copr enable jdxcode/mise -y
sudo dnf install -y mise
Verify the installation:
mise --version
6. Activate mise in ZSH
Add mise activation to your ZSH configuration:
echo 'eval "$(mise activate zsh)"' >> "${ZDOTDIR-$HOME}/.zshrc"
Reload your shell:
exec zsh
Then run:
mise doctor
This command helps verify whether mise is correctly configured.
7. Install PHP 8.5 with mise
Install PHP 8.5 globally:
mise use --global php@8.5
This command installs the latest available PHP 8.5 patch release and sets it as the global default version.
Check the installed PHP version:
php -v
You should see something similar to:
PHP 8.5.x
Check PHP modules:
php -m
Check PHP configuration:
php --ini
8. Configure PHP per project
For project-specific PHP versions, go to your project folder:
mkdir ~/Projects/my-php-app
cd ~/Projects/my-php-app
Set PHP 8.5 only for this project:
mise use php@8.5
This creates or updates a mise.toml file in the project directory.
Example:
[tools]
php = "8.5"
Now, whenever you enter this project folder, mise will use PHP 8.5.
Verify it:
php -v
mise current
9. Install Composer
Composer is the standard dependency manager for PHP.
Install Composer using the official installer:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Move Composer to a global executable path:
sudo mv composer.phar /usr/local/bin/composer
Verify the installation:
composer --version
10. Install Docker Engine
First, remove conflicting Docker packages if they exist:
sudo dnf remove -y \
docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-selinux \
docker-engine-selinux \
docker-engine
Add the official Docker repository:
sudo dnf config-manager addrepo --from-repofile https://download.docker.com/linux/fedora/docker-ce.repo
Install Docker Engine, Docker CLI, containerd, Buildx, and Docker Compose plugin:
sudo dnf install -y \
docker-ce \
docker-ce-cli \
containerd.io \
docker-buildx-plugin \
docker-compose-plugin
Enable and start Docker:
sudo systemctl enable --now docker
Verify Docker:
sudo docker run hello-world
11. Run Docker without sudo
Add your user to the Docker group:
sudo usermod -aG docker "$USER"
Apply the group change:
newgrp docker
Test Docker without sudo:
docker run hello-world
If this does not work immediately, log out and log back in.
12. Verify Docker Compose
Docker Compose is installed as a Docker CLI plugin.
Check the version:
docker compose version
Example usage:
docker compose up -d
13. Create a basic PHP test project
Create a simple PHP file:
mkdir -p ~/Projects/php-test
cd ~/Projects/php-test
mise use php@8.5
Create index.php:
cat > index.php <<'PHP'
<?php
echo "PHP version: " . PHP_VERSION . PHP_EOL;
PHP
Run it:
php index.php
Start PHP’s built-in development server:
php -S localhost:8000
Open in the browser:
http://localhost:8000
14. Optional: create a Docker Compose file for local development
Inside your project folder, create a compose.yaml file:
cat > compose.yaml <<'YAML'
services:
postgres:
image: postgres:17
container_name: php_dev_postgres
environment:
POSTGRES_DB: app
POSTGRES_USER: app
POSTGRES_PASSWORD: secret
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
redis:
image: redis:8
container_name: php_dev_redis
ports:
- "6379:6379"
volumes:
postgres_data:
YAML
Start the services:
docker compose up -d
Check running containers:
docker compose ps
Stop the services:
docker compose down
15. Useful commands
Check the active PHP version:
php -v
List mise-managed tools:
mise ls
Show the current active tool versions:
mise current
Install tools defined in a project:
mise install
Update system packages:
sudo dnf update -y
Update mise-managed tools:
mise upgrade
Check Docker status:
systemctl status docker
Final setup summary
After completing this setup, Fedora 44 will have:
- Updated system packages
- Git, Vim, cURL, and ZSH
- Oh My ZSH
- mise for runtime version management
- PHP 8.5 installed through mise
- Composer
- Docker Engine
- Docker Compose plugin
- A basic structure for local PHP development
This setup is suitable for PHP projects using frameworks such as Laravel, Symfony, Slim, or custom PHP applications.
Top comments (0)