const bcrypt = require('bcryptjs'); const exec = require('child_process').exec const password = 'test'; const cmd = '/usr/local/bin/php ./password.php' exec(cmd, (err, stdout, stderr) => { // See https://en.wikipedia.org/wiki/Bcrypt#Versioning_history const hash = stdout.replace('$2y$', '$2a$'); bcrypt.compare(password, hash).then(function(res) { // Should output true console.log(res); }); });