Introduction
If you want a faster and more efficient PHP runtime, this is it install and configure FrankenPHP for Magento 2.
This modern PHP application server combines performance and simplicity in one package. Additionally, it handles concurrent requests with minimal configuration effort.
In this guide, we’ll explore every step — from installation to system-level configuration — to make FrankenPHP production-ready for your Magento 2 projects.
What is FrankenPHP?
FrankenPHP is a next generation PHP server built Caddyoffers speed, security, and simplicity.
Unlike PHP-FPM, FrankenPHP serves requests directly — skipping the overhead of FastCGI for better performance.
Besides thatit supports HTTP/3 support, Automatic HTTPSAnd modern worker based architecturemaking it ideal for high performance Magento 2 environments.
Why Use FrankenPHP for Magento 2?
- Performance Improvements: Handles requests faster than PHP-FPM.
- Simpler Setup: No dependency on Apache or Nginx.
- Built-in HTTPS: Equipped with automatic TLS and HTTP/3.
- Better Resource Efficiency: Uses fewer processes to manage concurrent requests.
Additionally, it simplifies Magento hosting by combining the web server and PHP engine into one binary.
Advantages of FrankenPHP compared to Apache and Nginx
FrankenPHP offers several advantages over Apache and Nginx:
- Better Performance: No FastCGI overhead; requests are processed natively.
- Simpler Configuration: A single binary handles all requests.
- Built-in HTTPS & HTTP/3: No external configuration required.
- Lower Memory Usage: Efficient request handling for modern cloud environments.
- Quick Start: Faster initialization compared to multi-service setup.
As a resultFrankenPHP simplifies your Magento 2 hosting and increases speed significantly.
Disadvantages of FrankenPHP compared to Apache and Nginx
Despite its advantages, FrankenPHP still has several disadvantages:
- Limited Production Adoption: This is still relatively new compared to Apache/Nginx.
- Small Community Support: Fewer community guides and fixes available.
- Feature Gaps: Some advanced rewrite rules or modules are not yet supported.
- Compatibility Issues: Not all hosting panels or tools support it natively.
HoweverFrankenPHP provides speed and simplicity, although it still lacks the maturity and ecosystem of Apache and Nginx.
Step 1: Install FrankenPHP
Run the following command to download and install FrankenPHP:
curl -fsSL -o /usr/local/bin/frankenphp chmod +x /usr/local/bin/frankenphp
Installation verification:
frankenphp --version
Step 2: Create Required Directories and Configuration Files
To keep FrankenPHP running smoothly as a system service, create the following directories and files:
1️⃣ Create Directory
sudo mkdir -p /etc/frankenphp sudo mkdir -p /var/log/frankenphp sudo mkdir -p /var/lib/frankenphp
/etc/frankenphp
→ Save the FrankenPHP configuration file./var/log/frankenphp/
→ Contains logs for monitoring and debugging./var/lib/frankenphp
→ Used as data directory for runtime files.
Besides thatthis directory ensures proper separation of configuration, logs, and data.
2️⃣ Create and Configure /etc/frankenphp/Caddyfile
This is the main FrankenPHP configuration file.
File Path:
/etc/frankenphp/Caddyfile
Contents:
{ frankenphp { # Enable worker mode for better performance (optional) # worker } # Allow self-signed certificates but disable automatic HTTPS for domains without explicit TLS auto_https disable_redirects } :8080 { root * /var/www/html # Enable compression for better performance encode zstd br gzip # Default handling for non-Magento files php_server file_server browse } # HTTPS Virtual Host for Magento248 on port 8080 magento248.local:8080 { root * /var/www/html/userprojects/Magento248/pub # Use self-signed certificate for local development tls internal # Enable compression for better performance encode zstd br gzip # Handle static files first @static { path *.css *.js *.png *.jpg *.jpeg *.gif *.ico *.svg *.woff *.woff2 *.ttf *.eot *.otf *.pdf path /static/* /media/* /opt/* } handle @static { file_server } # For all other requests, try file then index.php try_files {path} {path}/ /index.php # Execute PHP php_server }
✅ Explanation:
- The first block handles basic PHP requests and serving static files.
- The second block is special Magento 2 virtual host running on the port
8080
with HTTPS enabled. - Compression added for better page load speed.
Even more sothis configuration ensures smooth Magento 2 performance.
3️⃣ Create Systemd Service File
This allows FrankenPHP to start automatically at system boot.
File Path:
/etc/systemd/system/frankenphp.service
Contents:
[Unit] Description=FrankenPHP Application Server Documentation= After=network.target network-online.target Wants=network-online.target systemd-networkd-wait-online.service [Service] Type=notify User=custom.user Group=customgroup ExecStart=/usr/local/bin/frankenphp run --config /etc/frankenphp/Caddyfile ExecReload=/bin/kill -USR1 $MAINPID TimeoutStopSec=5s LimitNOFILE=1048576 LimitNPROC=1048576 PrivateTmp=true ProtectSystem=full AmbientCapabilities=CAP_NET_BIND_SERVICE Environment=XDG_DATA_HOME=/var/lib/frankenphp Environment=XDG_CONFIG_HOME=/etc/frankenphp # Restart policy Restart=on-abnormal RestartSec=5s StartLimitBurst=5 StartLimitInterval=60s # Logging StandardOutput=journal StandardError=journal SyslogIdentifier=frankenphp # Security settings NoNewPrivileges=true ProtectControlGroups=true ProtectKernelModules=true ProtectKernelTunables=true RestrictRealtime=true RestrictSUIDSGID=true RemoveIPC=true RestrictNamespaces=true [Install] WantedBy=multi-user.target
Then run:
sudo systemctl daemon-reload sudo systemctl enable frankenphp sudo systemctl start frankenphp sudo systemctl status frankenphp
As a resultFrankenPHP starts on boot and logs errors correctly.
✅ Explanation:
This service configuration ensures FrankenPHP starts at boot, runs safely, logs properly, and restarts automatically if it crashes.
Step 3: Configure Magento for FrankenPHP
1. First, Set Base URL:
bin/magento setup:store-config:set --base-url=" bin/magento setup:store-config:set --base-url-secure="
2. Next, Flush Cache:
bin/magento cache:flush
Finallytest shop at https://magento248.local:8080
. It should load smoothly via FrankenPHP.
Notes: If you get it Database Connection Failure error
Then you may need to update the db connection host:
env.php: ‘host’ => ‘localhost’ → ‘host’ => ‘127.0.0.1’
Conclusion
That’s it — you’ve now learned how install and configure FrankenPHP for Magento 2including systemd service settings, directory structure, and configuration details.
This approach improves performance, improves manageability, and introduces modern PHP serving technology.
Additionally, while FrankenPHP is still new compared to Apache and Nginx, it is quickly growing into a powerful and efficient option for modern Magento deployments.
Ready to improve your Magento 2 performance? Try FrankenPHP and enjoy a faster and cleaner hosting stack!
News
Berita
News Flash
Blog
Technology
Sports
Sport
Football
Tips
Finance
Berita Terkini
Berita Terbaru
Berita Kekinian
News
Berita Terkini
Olahraga
Pasang Internet Myrepublic
Jasa Import China
Jasa Import Door to Door