Download the PHP package berkan/server without Composer
On this page you can find all versions of the php package berkan/server. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download berkan/server
More information about berkan/server
Files in berkan/server
Package server
Short Description Berkan - PHP development environment for macOS (Apache & Nginx)
License MIT
Homepage https://github.com/berkanakman/berkanServer
Informations about the package server
BERKAN
PHP Development Environment for macOS
macOS için PHP Geliştirme Ortamı
Table of Contents / İçindekiler
- English
- What is Berkan?
- Features
- Requirements
- Installation
- Quick Start
- Commands Reference
- Serving Sites
- HTTPS / SSL
- PHP Version Management
- Database Management
- Web Server Selection
- Site Proxying
- Sharing Sites
- Custom Drivers
- Supported Frameworks
- Configuration
- Error Display Control
- Short Open Tag
- Logs & Diagnostics
- Architecture
- Troubleshooting
- Uninstalling
- Türkçe
- Berkan Nedir?
- Özellikler
- Gereksinimler
- Kurulum
- Hızlı Başlangıç
- Komut Referansı
- Site Sunma
- HTTPS / SSL Desteği
- PHP Versiyon Yönetimi
- Veritabanı Yönetimi
- Web Sunucu Seçimi
- Site Proxy
- Site Paylaşımı
- Özel Driver Yazma
- Desteklenen Framework'ler
- Konfigürasyon
- Hata Görüntüleme Kontrolü
- Short Open Tag
- Log ve Tanı
- Mimari
- Sorun Giderme
- Kaldırma
English
What is Berkan?
Berkan is a lightweight macOS PHP development environment that supports both Apache (httpd) and Nginx as web servers. Choose your preferred web server during installation, switch between them at any time, and manage PHP versions and databases from a single CLI.
Berkan configures your Mac to always run your chosen web server, PHP-FPM, and DnsMasq in the background when your machine starts. Then, using DnsMasq, Berkan proxies all requests on the .test TLD to point to sites installed on your local machine.
In other words, a blazing fast macOS PHP development environment that uses roughly 7 MB of RAM. Berkan isn't a complete replacement for Vagrant or Docker, but it's a great alternative if you want a flexible, speed-focused baseline.
Features
Web Server (Apache or Nginx)
Berkan lets you choose between Apache and Nginx during installation, and switch at any time with berkan server:switch.
Apache (httpd):
- Native
.htaccesssupport - your rewrite rules work exactly as they do on production mod_rewritefor URL routing and pretty URLsmod_sslfor TLS/HTTPS with self-signed trusted certificatesmod_proxy+mod_proxy_fcgifor connecting Apache to PHP-FPM via Unix socketmod_proxy_httpfor reverse-proxying to other local servicesmod_headers,mod_deflate,mod_vhost_alias,mod_http2- Automatic
apachectl configtestvalidation before every restart
Nginx:
- High-performance event-driven architecture
fastcgi_passfor connecting Nginx to PHP-FPM via Unix socket- SSL/TLS with HTTP/2 support
- Reverse proxy with WebSocket support
- Gzip compression out of the box
- Automatic
nginx -tvalidation before every restart
Site Serving
- Zero-configuration - park a directory and every subfolder is instantly a
.testsite - Interactive park -
berkan parkscans projects, detects frameworks, and lets you assign PHP versions per project - Park entire directories:
~/Sites/blogbecomeshttp://blog.test - Link individual projects from anywhere on disk with custom names
- Automatic framework detection via the driver system (25+ built-in drivers)
- Custom 404 page for sites that can't be found
- Configurable directory listing (on/off)
HTTPS / SSL
- One-command HTTPS:
berkan secure myappgenerates a trusted TLS certificate - 2048-bit RSA private keys with SAN (Subject Alternative Name)
- Certificates are automatically trusted in the macOS System Keychain
- HTTP-to-HTTPS redirect is configured automatically
- HTTP/2 enabled on all secured sites
- HSTS header added by default for secure sites
- Unsecure a site back to HTTP with a single command
PHP Management
- Full PHP version range: PHP 5.6, 7.0–7.4, 8.0–8.4 supported via
shivammathur/phptap - Global PHP version switching between any installed PHP version
- Install/remove PHP versions at any time with
berkan php:install/berkan php:remove - List installed PHP versions with
berkan php:list - Per-site PHP isolation - different sites can run different PHP versions simultaneously
- Per-project PHP selection via
berkan park- interactive project scanning with automatic framework detection and PHP version assignment - Isolated PHP-FPM pools - each isolated version gets its own socket (
berkan-7.4.sock,berkan-8.1.sock, etc.) - Automatic framework detection during park: Laravel, Symfony, WordPress, Drupal, Magento 2, Craft CMS, Joomla, Composer projects, Plain PHP
berkan php- run PHP CLI using Berkan's managed versionberkan composer- run Composer with the correct PHP binary- Automatic PHP-FPM pool configuration with Unix socket (
berkan.sock) - Memory limit, upload size, and execution time tuned for development (512 MB, no timeout)
Error Display Control
- Toggle PHP error display with
berkan error hide/berkan error show - Uses PHP-FPM
auto_prepend_filefor reliable per-request error control - Works consistently across all sites, including those with
.htaccessrewrites and PHP version isolation - Settings persist in
config.jsonand take effect immediately without restart
Short Open Tag
- Toggle PHP
short_open_tagwithberkan shorttag on/berkan shorttag off - Enables or disables the
<?short tag syntax across all installed PHP versions - Uses a dedicated
.inifile (berkan-short-open-tag.ini) in each PHP version'sconf.ddirectory - Settings persist in
config.jsonand are applied via PHP-FPM restart
Database Management
- Install and manage databases directly from Berkan CLI
- Supported databases:
- MySQL -
berkan db:install mysql - PostgreSQL -
berkan db:install postgresql - MongoDB -
berkan db:install mongodb - Redis -
berkan db:install redis
- MySQL -
- Start, stop, restart individual or all databases
- View database status alongside other services with
berkan statusandberkan db:list - Interactive database selection during
berkan install
DNS Resolution
- DnsMasq resolves all
*.test(or any custom TLD) domains to your loopback address - macOS resolver file (
/etc/resolver/test) ensures seamless system-wide DNS - Custom TLD support - change
.testto.dev,.local, or anything else - Custom loopback address - default
127.0.0.1, configurable to any IP
Proxy
- Reverse proxy any
.testdomain to another local service (Node.js, Go, Python, Docker, etc.) - Automatic WebSocket support
- Proxy sites can optionally be secured with HTTPS
Sharing
- Share local sites publicly via three tunneling tools:
- Ngrok (default)
- Expose
- Cloudflare Tunnel (cloudflared)
- Switch between sharing tools with a single command
- Fetch the public tunnel URL programmatically
Framework Drivers
- 25 built-in drivers auto-detect your application framework
- Supported: Laravel, WordPress, Symfony, Drupal, CakePHP, Magento 2, Craft CMS, Statamic, Joomla, Kirby, TYPO3, Neos, Nette, Contao, Concrete5, Jigsaw, Sculpin, Katana, Bedrock, Radicle, and more
- Custom driver API - write your own driver for any PHP application by implementing three methods
- Driver priority: Custom > Specific > Default (BasicWithPublic, Basic)
System Integration
- Homebrew-native - all services installed and managed via
brew services - Sudoers integration -
berkan trustremoves the need for repeatedsudopasswords - Loopback plist for persistent custom loopback addresses across reboots
- Symlink to PATH -
berkanis accessible globally after install
Diagnostics & Logging
berkan status- see web server, PHP-FPM, DnsMasq, and database status at a glanceberkan diagnose- comprehensive diagnostic reportberkan log- tail web server, PHP, PHP-FPM, or access logs in real-time- Separate log files per service in
~/.config/berkan/Log/
Requirements
- macOS (Apple Silicon or Intel)
- Homebrew and Composer (installed in the steps below)
- Port 80/443 are used by default, but custom ports can be selected during installation if these are occupied
Installation
Step 1: Install Homebrew
If you don't have Homebrew installed, run:
Step 2: Install PHP and Composer
Step 3: Install Berkan
Note: Make sure Composer's global vendor bin directory is in your
PATH. Add one of the following to your shell profile (~/.zshrcor~/.bashrc):Then restart your terminal or run
source ~/.zshrc.
Step 4: Install Berkan Services
This is an interactive installer that will guide you through the setup. It automatically checks for Homebrew, PHP, and Composer — installing any that are missing.
1. Web Server Selection:
- Apache - Best if you use
.htaccessfiles (Laravel, WordPress, etc.) - Nginx - Best if you want high-performance event-driven architecture
2. PHP Version Selection (multi-select):
Select one or more PHP versions. The latest version you select will be set as the active version. Older versions (5.6–8.0) are installed via the shivammathur/php Homebrew tap (added automatically).
3. Database Selection (multi-select):
Select the databases you need, or choose "None" to skip. You can always install databases later with berkan db:install.
4. Port Configuration (automatic):
If ports 80 or 443 are already in use by another process, Berkan will detect the conflict and offer alternative ports:
If no conflict is detected, Berkan silently uses the default ports 80/443. Custom ports are saved in config.json and all server configurations are automatically updated.
Step 5: Trust Berkan (Recommended)
This step adds Berkan to sudoers so you don't need to type your password for common operations like start, stop, restart, secure, etc.:
Step 6: Verify Installation
You should see all services running:
Run diagnostics to make sure everything is correctly configured:
Step 7: Park Your Projects Directory
Berkan will scan the directory, detect each project's framework, and interactively ask which PHP version to use for each project:
Projects assigned a specific PHP version will be isolated with their own PHP-FPM pool and socket. Projects set to "Default" will use the globally linked PHP version.
Now any folder you create inside ~/Sites/ will automatically be accessible as http://folder-name.test in your browser.
What berkan install Does (Step by Step)
- Checks for Homebrew — if not installed, runs the official Homebrew installer automatically
- Checks for Composer — if not installed, installs it via Homebrew
- Asks you to choose a web server (Apache or Nginx), PHP versions, and databases
- Detects port conflicts on 80/443 and lets you choose alternative ports if needed
- Creates the configuration directory at
~/.config/berkan/ - Creates subdirectories:
Apache/orNginx/,Certificates/,Drivers/,Sites/,Log/,dnsmasq.d/ - Saves your choices (including port configuration) to
~/.config/berkan/config.json - Installs the chosen web server via Homebrew (if not already installed)
- Writes the main server configuration (
httpd.conffor Apache ornginx.conffor Nginx) with configured ports - Creates the default catch-all server configuration (routes all
.testrequests toserver.php) - Configures PHP-FPM with a
berkanpool using Unix socket (~/.config/berkan/berkan.sock) - Installs additional PHP versions you selected via Homebrew (adds
shivammathur/phptap for older versions) - Installs and configures DnsMasq to resolve all
*.testdomains to127.0.0.1 - Creates macOS resolver file at
/etc/resolver/test - Installs and starts selected databases via Homebrew
- Starts all services (
brew services start) - Symlinks the
berkanexecutable to/usr/local/bin/berkan - Copies a sample custom driver to
~/.config/berkan/Drivers/
Updating Berkan
Alternative: Manual Installation
If you prefer to install from source:
To update a manual installation:
Quick Start
That's it. Every folder inside ~/Sites/ is now automatically available as http://folder-name.test. Legacy projects can run older PHP versions side by side with modern ones.
Commands Reference
Service Management
| Command | Description |
|---|---|
berkan install |
Install Berkan services (interactive web server, PHP, database selection) |
berkan uninstall |
Uninstall Berkan (asks for confirmation) |
berkan uninstall --force |
Force uninstall and remove all configuration |
berkan start |
Start all Berkan services |
berkan stop |
Stop all Berkan services |
berkan restart |
Restart all Berkan services |
berkan status |
Display service status table |
berkan trust |
Add Berkan to sudoers (no more password prompts) |
Site Management
| Command | Description |
|---|---|
berkan park [path] |
Register directory as a parked path with interactive project scanning and per-project PHP version selection |
berkan parked |
List all parked directories |
berkan forget [path] |
Remove a parked path |
berkan link [name] |
Create a symbolic link for the current directory |
berkan links |
List all linked sites with SSL status, URLs, and PHP version |
berkan unlink [name] |
Remove a linked site |
berkan open [name] |
Open site in default browser |
berkan paths |
Display all registered paths |
HTTPS / SSL
| Command | Description |
|---|---|
berkan secure [name] |
Enable HTTPS with a self-signed trusted certificate |
berkan secured |
List all secured sites |
berkan unsecure [name] |
Remove HTTPS and revert to HTTP |
PHP Management
| Command | Description |
|---|---|
berkan use <version> |
Switch global PHP version (e.g., berkan use 8.3) |
berkan php:install <version> |
Install a new PHP version (e.g., berkan php:install 8.2) |
berkan php:remove <version> |
Remove a PHP version |
berkan php:list |
List all installed PHP versions with status |
berkan which-php |
Display the currently active PHP version |
berkan php [args...] |
Run PHP CLI with Berkan's version |
berkan composer [args...] |
Run Composer with Berkan's PHP version |
berkan isolate <version> |
Isolate current site to a specific PHP version |
berkan unisolate |
Remove PHP isolation from current site |
berkan isolated |
List all isolated sites and their PHP versions |
Database Management
| Command | Description |
|---|---|
berkan db:install <name> |
Install a database (mysql, postgresql, mongodb, redis) |
berkan db:uninstall <name> |
Uninstall a database |
berkan db:start [name] |
Start a database (or all installed databases) |
berkan db:stop [name] |
Stop a database (or all installed databases) |
berkan db:restart [name] |
Restart a database (or all installed databases) |
berkan db:list |
List all supported databases and their status |
Web Server
| Command | Description |
|---|---|
berkan server:switch |
Switch between Apache and Nginx |
Proxy
| Command | Description |
|---|---|
berkan proxy <name> <url> |
Create a proxy (e.g., berkan proxy myapi http://localhost:3000) |
berkan proxy <name> <url> --secure |
Create a proxy with HTTPS |
berkan proxies |
List all proxy sites |
berkan unproxy <name> |
Remove a proxy |
Sharing
| Command | Description |
|---|---|
berkan share [name] |
Share a site publicly via tunnel |
berkan share-tool [tool] |
Get or set the sharing tool (ngrok, expose, cloudflared) |
berkan fetch-share-url |
Fetch the current share URL |
berkan set-ngrok-token <token> |
Set Ngrok auth token |
Configuration
| Command | Description |
|---|---|
berkan tld [name] |
Get or set the TLD (default: test) |
berkan loopback [address] |
Get or set the loopback IP (default: 127.0.0.1) |
berkan directory-listing [on/off] |
Toggle directory listing |
berkan shorttag on |
Enable PHP short_open_tag (<? syntax) on all PHP versions |
berkan shorttag off |
Disable PHP short_open_tag on all PHP versions |
berkan shorttag |
Display current short_open_tag status |
berkan error hide |
Hide PHP errors (notices, warnings, deprecations) on all sites |
berkan error show |
Show PHP errors on all sites |
berkan on-latest-version |
Display current Berkan version |
Diagnostics
| Command | Description |
|---|---|
berkan diagnose |
Run full diagnostics and display results |
berkan log [service] |
View logs (apache/nginx, php, php-fpm, access) |
berkan log |
List all available log files |
Serving Sites
Berkan supports two ways to serve your PHP projects:
The park Command
The park command registers a directory and interactively scans it for projects. Every subdirectory within a parked directory becomes automatically accessible as a .test site.
Berkan will scan the directory, detect each project's framework (Laravel, Symfony, WordPress, Drupal, Magento 2, Craft CMS, Joomla, Composer, Plain PHP, etc.), and ask which PHP version to assign:
Each project assigned a specific PHP version gets an isolated PHP-FPM pool with its own socket (e.g., berkan-7.4.sock). This means different projects can run entirely different PHP versions simultaneously.
You can park multiple directories:
To stop serving a directory:
The link Command
The link command creates a symbolic link for a single site. This is useful when you want to serve a single directory from a non-parked location, or when you want the site name to differ from the folder name.
How Request Routing Works
Apache:
- A request for
myapp.testarrives at Apache - The site's
.htaccessrewrite rules run first (if any) - If no
.htaccessrule matched, Berkan's fallback rule routes unmatched requests toserver.php(viaRewriteOptions InheritDown) server.phpextracts the site name from the hostname- The driver system auto-detects the framework (Laravel, WordPress, etc.)
- The appropriate front controller is loaded and executed
Nginx:
- A request for
myapp.testarrives at Nginx - The server block routes it to
server.php server.phpextracts the site name from the hostname- It looks for a matching linked site or parked directory
- The driver system auto-detects the framework
- The appropriate front controller is loaded and executed
Note: Apache uses
RewriteOptions InheritDownso that your project's.htaccessrules always take priority over Berkan's fallback routing. This means traditional PHP sites with custom rewrite rules (e.g., multilingual routing like/tr/subeler.php) work natively without modification.
HTTPS / SSL
Berkan can secure any site with a trusted self-signed TLS certificate with a single command. This works identically whether you're using Apache or Nginx.
Securing a Site
This will:
- Generate a 2048-bit RSA private key
- Create a self-signed certificate with SAN (Subject Alternative Name)
- Trust the certificate in the macOS System Keychain
- Create the appropriate web server configuration (Apache VirtualHost or Nginx server block)
- Set up HTTP-to-HTTPS redirect
- Enable HTTP/2 support
- Add HSTS header
- Restart the web server
Unsecuring a Site
This removes the certificate, untrusts it from Keychain, and removes the SSL configuration.
Listing Secured Sites
PHP Version Management
Berkan supports PHP versions from 5.6 to 8.4. Versions 8.1–8.4 are available from the standard Homebrew formula. Older versions (5.6–8.0) are provided by the shivammathur/php tap, which Berkan adds automatically when needed.
Supported PHP Versions
| Version | Source | Formula |
|---|---|---|
| PHP 8.4 | Homebrew | php or [email protected] |
| PHP 8.3 | Homebrew | [email protected] |
| PHP 8.2 | Homebrew | [email protected] |
| PHP 8.1 | Homebrew | [email protected] |
| PHP 8.0 | shivammathur/php | [email protected] |
| PHP 7.4 | shivammathur/php | [email protected] |
| PHP 7.3 | shivammathur/php | [email protected] |
| PHP 7.2 | shivammathur/php | [email protected] |
| PHP 7.1 | shivammathur/php | [email protected] |
| PHP 7.0 | shivammathur/php | [email protected] |
| PHP 5.6 | shivammathur/php | [email protected] |
Global PHP Switching
Installing and Removing PHP Versions
Per-Site PHP Isolation
You can isolate individual sites to use different PHP versions. Each isolated site gets its own PHP-FPM pool and socket:
Per-Project PHP via berkan park
When you run berkan park, Berkan scans the directory and lets you assign PHP versions per project interactively. See The park Command for details.
Using PHP CLI
Database Management
Berkan can install and manage databases directly from the CLI.
Supported Databases
| Database | Install Command | Formula |
|---|---|---|
| MySQL | berkan db:install mysql |
mysql |
| PostgreSQL | berkan db:install postgresql |
postgresql@17 |
| MongoDB | berkan db:install mongodb |
mongodb-community |
| Redis | berkan db:install redis |
redis |
Installing a Database
MongoDB requires the mongodb/brew tap, which Berkan handles automatically.
Managing Databases
Checking Database Status
Installed databases also appear in berkan status:
Web Server Selection
Choosing During Installation
When you run sudo berkan install, Berkan asks which web server you want:
Switching Web Servers
You can switch between Apache and Nginx at any time:
This will:
- Confirm the switch (e.g., "Switch from Apache to Nginx?")
- Stop the current web server
- Update the configuration
- Install and configure the new web server
- Update sudoers entries
- Start the new web server
All your sites, certificates, and configurations continue to work seamlessly after switching.
Differences Between Apache and Nginx
| Feature | Apache | Nginx |
|---|---|---|
.htaccess support |
Native | Not supported |
| Config test command | apachectl configtest |
nginx -t |
| Config directory | ~/.config/berkan/Apache/ |
~/.config/berkan/Nginx/ |
| Log prefix | apache-error.log |
nginx-error.log |
| PHP connection | mod_proxy_fcgi (Unix socket) |
fastcgi_pass (Unix socket) |
| Proxy support | mod_proxy_http |
proxy_pass |
Site Proxying
Berkan can proxy .test domains to other local services like Node.js, Go, Python, or Docker containers.
Proxy configurations include WebSocket support for both Apache and Nginx.
Sharing Sites
Berkan supports three tunneling tools for sharing local sites publicly:
Using Ngrok (Default)
Using Expose
Using Cloudflare Tunnel
Checking Current Tool
Custom Drivers
If Berkan doesn't auto-detect your application, you can write a custom driver.
Creating a Driver
A sample driver is placed at ~/.config/berkan/Drivers/SampleBerkanDriver.php during installation. Create a new file in that directory:
Note: The
isStaticFile()method omits the return type declaration for compatibility with PHP 7.x isolated sites. Use a@returndocblock instead.
Driver Resolution Order
- Custom drivers in
~/.config/berkan/Drivers/(highest priority) - Specific drivers (WordPress, Laravel, Symfony, etc.)
- Default drivers (
BasicWithPublicBerkanDriver,BasicBerkanDriver)
The first driver whose serves() method returns true will handle the request.
Supported Frameworks
Berkan includes built-in drivers for 25 frameworks and CMS platforms:
| Framework | Detection |
|---|---|
| Laravel | artisan or bootstrap/app.php + public/index.php |
| WordPress | wp-config.php + wp-admin/ |
| WordPress Bedrock | web/wp/wp-settings.php |
| Symfony | bin/console + public/index.php |
| Drupal | core/lib/Drupal.php |
| Joomla | configuration.php + libraries/ |
| CakePHP | config/app.php + webroot/index.php |
| Magento 2 | bin/magento + pub/index.php |
| Craft CMS | craft file |
| Statamic v3+ | Laravel + statamic/cms in composer.json |
| Statamic v2 | statamic/ dir + please file |
| Statamic v1 | _app/core/statamic.php |
| Kirby CMS | kirby/ directory |
| Contao | system/initialize.php or vendor/contao/ |
| Concrete5 | concrete/dispatcher.php |
| TYPO3 | typo3/ dir + typo3conf/ or config/system/settings.php |
| Neos CMS | flow file |
| Nette | app/bootstrap.php + www/index.php |
| Jigsaw | build_local/ directory |
| Sculpin | output_dev/ or output_prod/ directory |
| Katana | public/_katana/ directory |
| Radicle | web/wp/wp-settings.php + config/application.php |
| Basic with /public | Any project with a public/ directory |
| Basic | Fallback for any PHP project |
Configuration
Configuration File
The main configuration file is at ~/.config/berkan/config.json:
| Key | Description | Default |
|---|---|---|
tld |
Top-level domain for sites | test |
loopback |
Loopback IP address | 127.0.0.1 |
http_port |
HTTP port for the web server | 80 |
https_port |
HTTPS port for the web server | 443 |
paths |
Parked directories | [] |
web_server |
Active web server (apache or nginx) |
apache |
php_versions |
Installed PHP versions | ["8.4"] |
databases |
Installed databases | [] |
isolated_versions |
Per-site PHP version assignments | {} |
hide_errors |
Hide PHP errors on all sites (berkan error hide/show) |
false |
short_open_tag |
Enable PHP short_open_tag (berkan shorttag on/off) |
false |
Configuration Directories
| Directory | Purpose |
|---|---|
~/.config/berkan/config.json |
Main configuration |
~/.config/berkan/Apache/ |
Apache VirtualHost configurations (when using Apache) |
~/.config/berkan/Nginx/ |
Nginx server configurations (when using Nginx) |
~/.config/berkan/Certificates/ |
SSL certificates and keys |
~/.config/berkan/Drivers/ |
Custom user drivers |
~/.config/berkan/Sites/ |
Symbolic links for linked sites |
~/.config/berkan/Log/ |
Web server, PHP, and PHP-FPM logs |
~/.config/berkan/dnsmasq.d/ |
DnsMasq TLD configuration |
~/.config/berkan/berkan.sock |
PHP-FPM Unix socket (global/default) |
~/.config/berkan/berkan-7.4.sock |
Isolated PHP-FPM socket (example: PHP 7.4) |
~/.config/berkan/berkan_prepend.php |
PHP auto-prepend file for error display control |
System Files
| File | Purpose |
|---|---|
/etc/resolver/test |
macOS DNS resolver for .test TLD |
/etc/sudoers.d/berkan |
Sudoers entries (after berkan trust) |
$(brew --prefix)/etc/httpd/httpd.conf |
Apache main configuration (when using Apache) |
$(brew --prefix)/etc/nginx/nginx.conf |
Nginx main configuration (when using Nginx) |
$(brew --prefix)/etc/dnsmasq.conf |
DnsMasq main configuration |
Changing the TLD
Changing the Loopback Address
Error Display Control
Berkan can globally hide or show PHP errors (notices, warnings, deprecations, etc.) across all your sites:
This uses PHP-FPM's auto_prepend_file mechanism, which injects a small script (berkan_prepend.php) before every PHP request. The script reads the hide_errors setting from config.json and suppresses error display accordingly.
This approach works reliably across all scenarios:
- Sites using
.htaccessrewrite rules - Sites isolated to different PHP versions (PHP 7.x, 8.x)
- Sites served via
server.phpfallback router
The setting takes effect immediately for new requests without requiring a service restart.
Short Open Tag
Berkan can globally enable or disable PHP's short_open_tag directive, which controls whether the <? short tag syntax is allowed (in addition to the standard ````
| Anahtar | Açıklama | Varsayılan |
|---|---|---|
tld |
Siteler için üst düzey alan adı | test |
loopback |
Loopback IP adresi | 127.0.0.1 |
http_port |
Web sunucu HTTP portu | 80 |
https_port |
Web sunucu HTTPS portu | 443 |
paths |
Park edilmiş dizinler | [] |
web_server |
Aktif web sunucu (apache veya nginx) |
apache |
php_versions |
Kurulu PHP versiyonları | ["8.4"] |
databases |
Kurulu veritabanları | [] |
isolated_versions |
Site bazlı PHP versiyon atamaları | {} |
hide_errors |
Tüm sitelerde PHP hatalarını gizle (berkan error hide/show) |
false |
short_open_tag |
PHP short_open_tag etkinleştir (berkan shorttag on/off) |
false |
Konfigürasyon Dizinleri
| Dizin | Amaç |
|---|---|
~/.config/berkan/config.json |
Ana konfigürasyon |
~/.config/berkan/Apache/ |
Apache VirtualHost konfigürasyonları (Apache kullanılırken) |
~/.config/berkan/Nginx/ |
Nginx sunucu konfigürasyonları (Nginx kullanılırken) |
~/.config/berkan/Certificates/ |
SSL sertifikaları ve anahtarları |
~/.config/berkan/Drivers/ |
Özel kullanıcı driver'ları |
~/.config/berkan/Sites/ |
Bağlantılı siteler için sembolik bağlantılar |
~/.config/berkan/Log/ |
Web sunucu, PHP ve PHP-FPM log'ları |
~/.config/berkan/dnsmasq.d/ |
DnsMasq TLD konfigürasyonu |
~/.config/berkan/berkan.sock |
PHP-FPM Unix soketi (global/varsayılan) |
~/.config/berkan/berkan-7.4.sock |
İzole PHP-FPM soketi (örnek: PHP 7.4) |
~/.config/berkan/berkan_prepend.php |
Hata görüntüleme kontrolü için PHP auto-prepend dosyası |
Sistem Dosyaları
| Dosya | Amaç |
|---|---|
/etc/resolver/test |
.test TLD için macOS DNS çözümleyici |
/etc/sudoers.d/berkan |
Sudoers kayıtları (berkan trust sonrası) |
$(brew --prefix)/etc/httpd/httpd.conf |
Apache ana konfigürasyonu (Apache kullanılırken) |
$(brew --prefix)/etc/nginx/nginx.conf |
Nginx ana konfigürasyonu (Nginx kullanılırken) |
$(brew --prefix)/etc/dnsmasq.conf |
DnsMasq ana konfigürasyonu |
TLD Değiştirme
# .test'ten .dev'e değiştir
sudo berkan tld dev
# Artık siteler *.test yerine *.dev'de
# http://myapp.dev
# Mevcut TLD'yi kontrol et
berkan tld
# Çıktı: dev
Loopback Adresi Değiştirme
sudo berkan loopback 10.200.10.1
# Mevcut loopback'i kontrol et
berkan loopback
# Çıktı: 10.200.10.1
Hata Görüntüleme Kontrolü
Berkan, tüm sitelerinizde PHP hatalarını (notice, warning, deprecation, vb.) toplu olarak gizleyip gösterebilir:
# Tüm sitelerde PHP hatalarını gizle
berkan error hide
# PHP hatalarını tekrar göster
berkan error show
Bu özellik PHP-FPM'in auto_prepend_file mekanizmasını kullanır. Her PHP isteğinden önce küçük bir script (berkan_prepend.php) enjekte edilir. Script, config.json'daki hide_errors ayarını okur ve hata görüntülemeyi buna göre bastırır.
Bu yaklaşım tüm senaryolarda güvenilir şekilde çalışır:
.htaccessrewrite kuralları kullanan siteler- Farklı PHP versiyonlarına izole edilmiş siteler (PHP 7.x, 8.x)
server.phpyedek yönlendirici üzerinden sunulan siteler
Ayar, servis yeniden başlatma gerektirmeden yeni istekler için anında etki eder.
Short Open Tag
Berkan, PHP'nin short_open_tag direktifini toplu olarak etkinleştirip devre dışı bırakabilir. Bu direktif, standart <?php etiketine ek olarak <? kısa tag sözdiziminin kullanılıp kullanılamayacağını kontrol eder:
# Short open tag'i etkinleştir (<? sözdizimi)
berkan shorttag on
# Short open tag'i devre dışı bırak (sadece <?php çalışır)
berkan shorttag off
# Mevcut durumu kontrol et
berkan shorttag
short_open_tag bir PHP_INI_PERDIR direktifi olduğu için ini_set() ile runtime'da değiştirilemez. Berkan bunu, her kurulu PHP versiyonunun conf.d dizinine özel bir .ini dosyası (berkan-short-open-tag.ini) yazarak ve PHP-FPM'i yeniden başlatarak halleder.
Ayar, tüm kurulu PHP versiyonlarına aynı anda uygulanır.
Log ve Tanı
Logları Görüntüleme
# Tüm log dosyalarını listele
berkan log
# Web sunucu hata logunu canlı takip et
berkan log apache # Apache kullanılırken
berkan log nginx # Nginx kullanılırken
# PHP hata logunu görüntüle
berkan log php
# PHP-FPM logunu görüntüle
berkan log php-fpm
# Erişim logunu görüntüle
berkan log access
Tanı Çalıştırma
berkan diagnose
Bu, kapsamlı bir tanı raporu görüntüler:
Berkan Diagnostics
==================================================
+-------------------------+-----------------------------------+
| Check | Result |
+-------------------------+-----------------------------------+
| Berkan Version | 1.0.0 |
| PHP Version | 8.4.18 |
| PHP Binary | /opt/homebrew/opt/[email protected]/bin/php |
| Operating System | Darwin 24.6.0 |
| Homebrew Prefix | /opt/homebrew |
| TLD | test |
| Loopback | 127.0.0.1 |
| Web Server | apache |
| Apache (httpd) Status | Running |
| PHP-FPM Status | Running |
| DnsMasq Status | Running |
| Apache (httpd) Config | Found |
| PHP-FPM Socket | Found |
| DNS Resolver | Found |
| Installed PHP | [email protected], [email protected] |
| Linked PHP | [email protected] |
| Apache (httpd) Config T.| Syntax OK |
| Parked Paths | /Users/siz/Sites |
| DNS Test | 127.0.0.1 |
| Installed Databases | mysql, redis |
+-------------------------+-----------------------------------+
Mimari
Teknoloji Yığını
İstek Akışı
===========
Tarayıcı (myapp.test)
|
v
DnsMasq (DNS) *.test -> 127.0.0.1 çözümler
|
v
Apache veya Nginx 127.0.0.1:80/443 dinler
|
v
.htaccess kuralları (Yalnızca Apache) Sitenin kendi rewrite kuralları önce çalışır
|
v
server.php Yedek istek yönlendirici (eşleşmeyen istekler)
|
v
Driver Sistemi Framework'ü otomatik algılar
|
v
PHP-FPM Unix soketi üzerinden PHP çalıştırır
| (hata kontrolü için auto_prepend_file)
v
Uygulamanız Laravel, WordPress, vb.
Proje Yapısı
server/
├── berkan # Ana çalıştırılabilir dosya (bash)
├── server.php # HTTP istek yönlendirici
├── find-usable-php.php # PHP 8.1+ ikili bulucu
├── composer.json # Bağımlılıklar
├── cli/
│ ├── berkan.php # CLI giriş noktası ve konteyner kurulumu
│ ├── app.php # 48 komut tanımı
│ ├── includes/
│ │ └── helpers.php # Yardımcı fonksiyonlar
│ ├── stubs/ # Konfigürasyon şablonları
│ │ ├── httpd.conf # Apache ana konfig
│ │ ├── berkan.conf # Apache varsayılan catch-all VirtualHost
│ │ ├── site.berkan.conf # Apache site bazlı VirtualHost (InheritDown)
│ │ ├── secure.berkan.conf # Apache HTTPS VirtualHost (InheritDown)
│ │ ├── proxy.berkan.conf # Apache proxy VirtualHost
│ │ ├── secure.proxy.berkan.conf # Apache güvenli proxy
│ │ ├── nginx.conf # Nginx ana konfig
│ │ ├── nginx-berkan.conf # Nginx varsayılan catch-all sunucu
│ │ ├── nginx-site.berkan.conf # Nginx site bazlı sunucu
│ │ ├── nginx-secure.berkan.conf # Nginx HTTPS sunucu
│ │ ├── nginx-proxy.berkan.conf # Nginx proxy sunucu
│ │ ├── nginx-secure.proxy.berkan.conf # Nginx güvenli proxy
│ │ ├── etc-phpfpm-berkan.conf # PHP-FPM havuz şablonu
│ │ ├── etc-phpfpm-berkan-isolated.conf # İzole PHP-FPM havuz şablonu
│ │ ├── berkan_prepend.php # Hata görüntüleme kontrolü için PHP auto-prepend
│ │ └── ... # Daha fazla şablon
│ ├── templates/
│ │ └── 404.html # Özel 404 sayfası
│ └── Berkan/ # PHP sınıfları (PSR-4: Berkan\)
│ ├── Contracts/
│ │ └── WebServer.php # WebServer arayüzü (interface)
│ ├── Apache.php # Apache yönetimi (WebServer implement eder)
│ ├── Nginx.php # Nginx yönetimi (WebServer implement eder)
│ ├── Berkan.php # Ana sınıf
│ ├── Brew.php # Homebrew entegrasyonu
│ ├── CommandLine.php # Kabuk komut çalıştırma
│ ├── Composer.php # Composer paket yönetimi
│ ├── Configuration.php # Konfigürasyon yönetimi
│ ├── Database.php # Veritabanı yönetimi
│ ├── Diagnose.php # Tanı
│ ├── DnsMasq.php # DNS yönetimi
│ ├── Filesystem.php # Dosya işlemleri
│ ├── PhpFpm.php # PHP-FPM yönetimi
│ ├── Server.php # İstek yönlendirme
│ ├── Site.php # Site ve SSL yönetimi
│ ├── Status.php # Sağlık kontrolleri
│ ├── Ngrok.php # Ngrok tünel paylaşımı
│ ├── Expose.php # Expose tünel paylaşımı
│ ├── Cloudflared.php # Cloudflare tünel paylaşımı
│ └── Drivers/ # Framework driver'ları
│ ├── BerkanDriver.php
│ ├── LaravelBerkanDriver.php
│ └── Specific/ # 21 framework'e özel driver
└── tests/
Sorun Giderme
Web sunucu başlamıyor
Apache:
# Apache konfigürasyon sözdizimini kontrol et
sudo apachectl configtest
# Port 80 başkası tarafından kullanılıyor mu?
sudo lsof -i :80
# Apache hata logunu kontrol et
berkan log apache
Nginx:
# Nginx konfigürasyon sözdizimini kontrol et
sudo nginx -t
# Port 80 başkası tarafından kullanılıyor mu?
sudo lsof -i :80
# Nginx hata logunu kontrol et
berkan log nginx
Port çakışmaları
Port 80/443 başka bir servis tarafından kullanılıyorsa iki seçeneğiniz var:
-
Özel portlar kullanın -
berkan installkomutunu tekrar çalıştırın ve alternatif portlar seçin (ör. 8080/8443). Portlarconfig.json'a kaydedilir ve tüm sunucu konfigürasyonları otomatik güncellenir. -
Varsayılan portları boşaltın - Çakışan servisi durdurun:
# Port 80'i ne kullanıyor? sudo lsof -i :80 # macOS dahili Apache'si çalışıyorsa durdurun sudo apachectl stop sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null
Özel portlar kullanırken sitelerinize port numarasıyla erişin: http://myapp.test:8080 veya https://myapp.test:8443.
Siteler çözümlenmiyor
# DNS çözümlemesini kontrol et
dig myapp.test @127.0.0.1
# Resolver dosyasının varlığını doğrula
cat /etc/resolver/test
# DnsMasq'i yeniden başlat
sudo brew services restart dnsmasq
# macOS DNS önbelleğini temizle
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder
PHP-FPM soketi bulunamıyor
# Varsayılan soketin var olup olmadığını kontrol et
ls -la ~/.config/berkan/berkan.sock
# İzole soketleri kontrol et (ör. PHP 7.4)
ls -la ~/.config/berkan/berkan-7.4.sock
# PHP-FPM'i yeniden başlat
sudo brew services restart php
# Belirli bir izole PHP-FPM'i yeniden başlat
sudo brew services restart [email protected]
# PHP-FPM logunu kontrol et
berkan log php-fpm
HTTPS sertifikası güvenilir değil
# Siteyi yeniden güvenli hale getir
sudo berkan unsecure myapp
sudo berkan secure myapp
# Bir sertifikayı elle güvenilir yap
sudo security add-trusted-cert -d -r trustRoot \
-k /Library/Keychains/System.keychain \
~/.config/berkan/Certificates/myapp.test.crt
Veritabanı başlamıyor
# Veritabanı durumunu kontrol et
berkan db:list
# Belirli bir veritabanını yeniden başlat
sudo berkan db:restart mysql
# Homebrew servis durumunu kontrol et
brew services list
Komple sıfırlama
# Tüm servisleri durdur
sudo berkan stop
# Kaldırma
sudo berkan uninstall --force
# Yeniden kur
sudo berkan install
Kaldırma
Yumuşak kaldırma (konfigürasyonu saklar)
sudo berkan uninstall
Tam kaldırma (her şeyi siler)
sudo berkan uninstall --force
Bu işlem şunları kaldırır:
- Web sunucu konfigürasyon değişiklikleri (Apache veya Nginx)
- PHP-FPM berkan havuzu
- DnsMasq TLD konfigürasyonu
- DNS resolver dosyası
- Sudoers kaydı
- Loopback konfigürasyonu
- Tüm kurulu veritabanlarını durdurur
~/.config/berkan/içindeki tüm dosyalar (--forceile)/usr/local/bin/berkansembolik bağlantısı
Berkan - Built by Berkan Akman | MIT License
All versions of server with dependencies
illuminate/container Version ^10.0|^11.0|^12.0
illuminate/collections Version ^10.0|^11.0|^12.0
mnapoli/silly Version ^1.9
symfony/console Version ^6.0|^7.0
symfony/process Version ^6.0|^7.0
guzzlehttp/guzzle Version ^7.0