const { exec } = require('child_process'); const path = require('path'); // Jalur ke executable PHP const phpExecutablePath = '/www/server/php/74/bin/php'; // Jalur yang sesuai dengan sistem Anda // Daftar jalur ke file PHP const phpScriptPaths = [ path.join(__dirname, 'load_pesan.php'), path.join(__dirname, 'create_link_flip.php') ]; // Fungsi untuk menjalankan file PHP function runPhpScripts() { phpScriptPaths.forEach((phpScriptPath) => { console.log(`Running command: ${phpExecutablePath} ${phpScriptPath}`); exec(`${phpExecutablePath} ${phpScriptPath}`, (error, stdout, stderr) => { if (error) { console.error(`Error executing PHP script ${phpScriptPath}: ${error.message}`); return; } if (stderr) { console.error(`PHP script ${phpScriptPath} stderr: ${stderr}`); return; } console.log(`PHP script ${phpScriptPath} output: ${stdout}`); }); }); } // Jalankan PHP scripts segera dan kemudian setiap 5 detik runPhpScripts(); setInterval(runPhpScripts, 5000);