diff --git a/config/php.ini.template b/config/php.ini.template index 4eb0c0b..885421c 100644 --- a/config/php.ini.template +++ b/config/php.ini.template @@ -41,6 +41,9 @@ max_file_uploads = 20 allow_url_fopen = On allow_url_include = Off default_socket_timeout = 60 +session.save_path = "{{SESSION_DIR}}" +upload_tmp_dir = "{{TEMP_DIR}}" +sys_temp_dir = "{{TEMP_DIR}}" extension_dir = "{{EXT_DIR}}" [ExtensionList] diff --git a/logs/nginx.pid b/logs/nginx.pid index d8ea9fb..a8eeab3 100644 --- a/logs/nginx.pid +++ b/logs/nginx.pid @@ -1 +1 @@ -87480 +48324 diff --git a/src/main/ipc/index.ts b/src/main/ipc/index.ts index 1f29553..ce17774 100644 --- a/src/main/ipc/index.ts +++ b/src/main/ipc/index.ts @@ -60,21 +60,22 @@ export function registerIpcHandlers(): void { const phpPort = portMappingService.getPhpPort(p.phpVersion) const normalizedPath = p.path.replace(/\\/g, '/') return ` - location = /${p.host} { - return 301 /${p.host}/; - } location /${p.host}/ { - alias "${normalizedPath}/"; - index index.php index.html; - try_files $uri $uri/ /${p.host}/index.php?$query_string; + alias "${normalizedPath}/"; + index index.php index.html; + try_files $uri $uri/ /${p.host}/index.php?$query_string; - location ~ ^/${p.host}/(?.+\.php)$ { - fastcgi_pass 127.0.0.1:${phpPort}; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME "${normalizedPath}/$rel_path"; - include "${confDir.replace(/\\/g, '/')}/fastcgi_params"; - } - }` + # Sadece .php değil, URI'nin tamamını eşleştirip dosya adını $1 içine alıyoruz + location ~ ^/${p.host}/(.*\.php)$ { + fastcgi_pass 127.0.0.1:${phpPort}; + fastcgi_index index.php; + + # Hatalı olan $request_filename yerine manuel path veriyoruz + fastcgi_param SCRIPT_FILENAME "${normalizedPath}/$1"; + + include "${confDir.replace(/\\/g, '/')}/fastcgi_params"; + } +}` }).join('\n') const configPath = await configService.generateConfig('nginx.conf.template', 'nginx.conf', { @@ -108,12 +109,20 @@ export function registerIpcHandlers(): void { if (!binPath) return { success: false, message: `${phpVersion || ''} PHP executable bulunamadı. Lütfen indirin.` } const phpPort = phpVersion ? portMappingService.getPhpPort(phpVersion) : settings.phpPort - const extDir = path.join(path.dirname(binPath), 'ext') + const extDir = path.join(path.dirname(binPath), 'ext').replace(/\\/g, '/') const gdExtName = fs.existsSync(path.join(extDir, 'php_gd2.dll')) ? 'gd2' : 'gd' + const sessionDir = path.join(configService.getBasePath(), 'data', 'sessions').replace(/\\/g, '/') + const tempDir = path.join(configService.getBasePath(), 'data', 'temp').replace(/\\/g, '/') + + if (!fs.existsSync(sessionDir)) fs.mkdirSync(sessionDir, { recursive: true }) + if (!fs.existsSync(tempDir)) fs.mkdirSync(tempDir, { recursive: true }) + const configPath = await configService.generateConfig('php.ini.template', `php_${phpVersion || 'default'}.ini`, { EXT_DIR: extDir, - GD_EXT: gdExtName + GD_EXT: gdExtName, + SESSION_DIR: sessionDir, + TEMP_DIR: tempDir }) const success = await processManager.startService(serviceName, binPath, ['-b', `127.0.0.1:${phpPort}`, '-c', configPath], false)