diff --git a/config/apache_project.conf.template b/config/apache_project.conf.template
index f94448c..3cbb832 100644
--- a/config/apache_project.conf.template
+++ b/config/apache_project.conf.template
@@ -1,26 +1,38 @@
-# 1. PHP-FPM bağlantısını temiz ve stabil bir Proxy bloğu olarak tanımlayın
-
- ProxySet timeout=600 connectiontimeout=600
-
+# Apache Project Configuration (CGI Mode)
+# Accessed via: http://localhost:{{PORT}}/{{HOST}}/
-# 2. Alias tanımı (Sonunda ASLA eğik çizgi '/' olmamalı)
+# 1. Alias definition (restores localhost/projectname access)
Alias /{{HOST}} "{{PATH}}"
+# 2. ScriptAlias definition for the project's PHP CGI binary
+# This maps a virtual URL path to the actual PHP folder.
+ScriptAlias {{PHP_BIN_URL}}/ "{{PHP_DIR}}/"
+
+# 3. Directory settings for the project
- Options Indexes FollowSymLinks
+ Options Indexes FollowSymLinks ExecCGI
AllowOverride All
Require all granted
-
- # 3. Windows Path Sorununu Çözen Komut (Sadece bu klasöre özel zorluyoruz)
-
- ProxyFCGIBackendType GENERIC
-
-
- # 4. Klasör direkt çağrıldığında index.php'yi bulmasını garanti edin
+
+ # Passing Authorization header to PHP
+ CGIPassAuth On
+
+ # Directory index handling
DirectoryIndex index.php index.html
-
- # 5. PHP Dosyalarını Yönlendirme
+
+ # PHP Handling via mod_actions and CGI
- SetHandler "proxy:fcgi://127.0.0.1:{{PHP_PORT}}/"
+ SetHandler application/x-httpd-php-{{HOST}}
+
+ # Action maps the handler to the binary via the ScriptAlias URL
+ # This is more robust on Windows than using absolute local paths.
+ Action application/x-httpd-php-{{HOST}} "{{PHP_BIN_URL}}/php-cgi.exe"
+
+
+# 4. Permissions for the PHP binary directory
+
+ AllowOverride None
+ Options None
+ Require all granted
\ No newline at end of file
diff --git a/config/httpd.conf.template b/config/httpd.conf.template
index ce5b547..f807e18 100644
--- a/config/httpd.conf.template
+++ b/config/httpd.conf.template
@@ -17,6 +17,8 @@ LoadModule log_config_module modules/mod_log_config.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
+LoadModule actions_module modules/mod_actions.so
+LoadModule cgi_module modules/mod_cgi.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
@@ -53,6 +55,7 @@ DocumentRoot "{{ROOT}}"
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
+ CGIPassAuth On
ErrorLog "{{LOG_DIR}}/apache_error.log"
@@ -77,39 +80,20 @@ Alias /phpmyadmin "{{PHPMYADMIN_DIR}}"
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
-
-
- SetHandler "proxy:fcgi://127.0.0.1:{{PHP_PORT}}/"
-
-
-
-# Global PHP handler
-
- SetHandler "proxy:fcgi://127.0.0.1:{{PHP_PORT}}/"
CGIPassAuth On
-
+
# Project configurations
{{PROJECTS}}
-# Custom Server Assets (Logos, CSS, Error Pages)
-Alias /server-assets "D:/Works/2026/multiphp/public/server-assets"
-
- Options Indexes FollowSymLinks
- AllowOverride None
- Require all granted
-
+# Global PHP handler (Manual Nginx-Style SCRIPT_FILENAME)
+# Inspired by Nginx's fastcgi_param SCRIPT_FILENAME $request_filename.
+
+ SetHandler "proxy:fcgi://127.0.0.1:{{PHP_PORT}}/"
+
+ RewriteEngine On
+ # Explicitly set the physical path to avoid broken automatic mapping on Windows
+ RewriteRule . - [E=proxy-fcgi-pathinfo:%{REQUEST_FILENAME}]
+
+
-# Error Pages
-ErrorDocument 404 /server-assets/404.html
-ErrorDocument 500 /server-assets/500.html
-ErrorDocument 403 /server-assets/404.html
-ErrorDocument 502 /server-assets/500.html
-ErrorDocument 503 /server-assets/500.html
-ErrorDocument 504 /server-assets/500.html
-
-# Custom Directory Listing (Index of)
-IndexOptions +HTMLTable +IconHeight=16 +IconWidth=16 +SuppressRules +SuppressDescription +NameWidth=* +FoldersFirst +ScanHTMLTitles +CharSet=UTF-8
-IndexStyleSheet "/server-assets/style.css"
-HeaderName "/server-assets/header.html"
-ReadmeName "/server-assets/footer.html"
diff --git a/config/nginx.conf.template b/config/nginx.conf.template
index 75a5654..386a13a 100644
--- a/config/nginx.conf.template
+++ b/config/nginx.conf.template
@@ -36,19 +36,6 @@ http {
return 404;
}
- # Custom Server Assets (Logos, CSS, Error Pages)
- location /server-assets/ {
- alias "D:/Works/2026/multiphp/public/server-assets/";
- access_log off;
- allow all;
- }
-
- # Error Pages
- error_page 404 /server-assets/404.html;
- error_page 500 502 503 504 /server-assets/500.html;
- location = /server-assets/404.html { internal; }
- location = /server-assets/500.html { internal; }
-
{{PROJECTS}}
location /phpmyadmin {
diff --git a/settings.json b/settings.json
index c2f19d3..c1d86a7 100644
--- a/settings.json
+++ b/settings.json
@@ -1,6 +1,6 @@
{
"nginxPort": "80",
- "apachePort": "8081",
+ "apachePort": "8080",
"serverType": "nginx",
"phpPort": "9001",
"mariaDbPort": "3306",
diff --git a/src/main/ipc/index.ts b/src/main/ipc/index.ts
index eda60d3..1c6ca45 100644
--- a/src/main/ipc/index.ts
+++ b/src/main/ipc/index.ts
@@ -195,10 +195,16 @@ async function rebuildApacheConfig(forceProjects: boolean = false): Promise<{ bi
let normalizedPath = p.path.replace(/\\/g, '/')
if (!normalizedPath.endsWith('/')) normalizedPath += '/'
+ const phpDir = path.join(configService.getBasePath(), 'bin', `php-${p.phpVersion}`)
+ const phpCgiBinary = findExecutable(phpDir, process.platform === 'win32' ? 'php-cgi.exe' : 'php-cgi') || ''
+
await configService.generateConfig('apache_project.conf.template', `projects_apache/${p.host}.conf`, {
HOST: p.host,
PATH: normalizedPath,
- PHP_PORT: phpPort.toString()
+ PHP_PORT: phpPort.toString(),
+ PHP_DIR: phpDir.replace(/\\/g, '/'),
+ PHP_CGI_PATH: phpCgiBinary.replace(/\\/g, '/'),
+ PHP_BIN_URL: `/php-bin-${p.host}`
})
}
}