I have 2 test servers that I am attempting to run a PHP script on. They are both running PHP 7.3.12-1 (according to PHP -v) and are on identical Debian installations. I am trying to run the block of code that follows.
//requre file
require_once "config.php";
// Prepare an insert statement
$sql = "INSERT INTO users (fname, lname, grade, username, password, uniqueid) VALUES (?, ?, ?, ?, ?, ?)";
echo "1";
if($stmt = mysqli_prepare($link, $sql)){
echo "2";
// Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "ssssss", $param_fname, $param_lname, $param_grade, $param_username, $param_password, $param_uniqueid);
// Set parameters
$param_username = $username;
$param_fname = $fname;
$param_lname = $lname;
$param_grade = $grade;
$param_uniqueid = $uniqueid;
$param_password = password_hash($password, PASSWORD_DEFAULT); // Creates a password hash
if(mysqli_stmt_execute($stmt)){
echo "3";
// Prepare an insert statement
$sql = "INSERT INTO publicprofile (fname, lname, grad_year) VALUES (?, ?, ?)";
if($stmt = mysqli_prepare($link, $sql)){
// Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "sss", $param_fname, $param_lname, $param_grade);
// Set parameters
$param_fname = $fname;
$param_lname = $lname;
$param_grade = $grade;
if(mysqli_stmt_execute($stmt)){
header("location: login");
}
}
}
}
I have been running this with full PHP error reporting, and there is no error displayed on either server. When I execute the PHP code on the first server (with an i5 CPU) the script goes all the way to the redirect and successfully inserts into both SQLs. On the other machine though, (with an i7 CPU) the server will echo the number 1, but that is it. It will not continue past the if($stmt = mysqli_prepare($link, $sql)){
I have the same rendition of the code on both servers, and the SQLs are set up identically. They both work as tested per individual script.
Is this some obscure php.ini setting that I had on one machine but not another? If so, this code is not running on a PHP 7.1 server either, and how can I configure it to work with both? Thank y'all!