feat: implement IPC service management for Nginx, PHP, and MySQL processes with dynamic configuration generation

This commit is contained in:
Ümit Tunç
2026-03-28 22:20:06 +03:00
parent 86f829e4ed
commit de880b19dc
5 changed files with 38 additions and 11 deletions
+7 -4
View File
@@ -107,8 +107,11 @@ export function registerIpcHandlers(): void {
const phpPort = phpVersion ? portMappingService.getPhpPort(phpVersion) : settings.phpPort
const extDir = path.join(path.dirname(binPath), 'ext')
const gdExtName = fs.existsSync(path.join(extDir, 'php_gd2.dll')) ? 'gd2' : 'gd'
const configPath = await configService.generateConfig('php.ini.template', `php_${phpVersion || 'default'}.ini`, {
EXT_DIR: extDir
EXT_DIR: extDir,
GD_EXT: gdExtName
})
const success = await processManager.startService(serviceName, binPath, ['-b', `127.0.0.1:${phpPort}`, '-c', configPath], false)
@@ -121,8 +124,8 @@ export function registerIpcHandlers(): void {
const mysqlId = mysqlVersion ? `mysql-${mysqlVersion}` : null
const dataDir = mysqlId
? path.join(configService.getBasePath(), `mysql_data_${mysqlId}`)
: path.join(configService.getBasePath(), 'mysql_data')
? path.join(configService.getBasePath(), 'data', mysqlId)
: path.join(configService.getBasePath(), 'data', 'default')
const mysqlDir = mysqlId ? path.join(binDir, mysqlId) : binDir
const binPath = findExecutable(mysqlDir, 'mysqld.exe')
@@ -147,7 +150,7 @@ export function registerIpcHandlers(): void {
const configPath = await configService.generateConfig('my.ini.template', `my_${mysqlId || 'default'}.ini`, {
PORT: mysqlPort,
DATADIR: dataDir.replace(/\\/g, '/'),
SOCKET: `/tmp/${serviceName}.sock`,
SOCKET: `/tmp/${sanitizedServiceName}.sock`,
LOG_FILE: logFile.replace(/\\/g, '/')
})