I have a php script that places information in a db. When i run the script manually on the server all works as expected. But when I run that very script via javascript using ajax the php script fails at the following line:
$connection=new mysqli($servername,$username,$password,$dbname);
And the error i get is PHP Fatal error: Class 'mysqli' not found in /var/www/html/..
Which doesn't make any sense for I just ran that very script directly on the server with no problem.
I'm finding this error in /var/log/apache2/error.log.
Here's how my ajax call looks:
$.ajax({
url:'db/insert.php',
complete: function(response){
//$('#output').html(response.responseText);
alert('complete: '+response.responseText);
},
error: function(){
//$('#output').html('Bummer: there was an error!');
alert('error');
},
async:"false",
type:"POST",
data:{visit_report:'1'}
});
Why is the script failing in this way?
This question is continued here: Enable mysqli in my in-webserver copy of php