feat: implement IPC service management for Nginx, PHP, and MySQL processes with dynamic configuration generation
This commit is contained in:
@@ -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, '/')
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user