PDO命令上来自开发控制台的Postgres PHP错误

PDO命令上来自开发控制台的Postgres PHP错误,php,jquery,postgresql,Php,Jquery,Postgresql,我的页面有一个html表单,其中包含七个字段,分别用于电子邮件、名字、姓氏等项。我通过表单按钮的单击事件调用jQuery Ajax函数。它传递序列化的表单数据,并将其提交到php脚本: function CollectData() { form_data = $('form').serialize() /*form_data = $('form').serializeArray()*/ console.log("CollectData"); console.log

我的页面有一个html表单,其中包含七个字段,分别用于电子邮件、名字、姓氏等项。我通过表单按钮的单击事件调用jQuery Ajax函数。它传递序列化的表单数据,并将其提交到php脚本:

function CollectData() {
    form_data = $('form').serialize()
    /*form_data = $('form').serializeArray()*/
    console.log("CollectData");
    console.log("Okay, I'm starting");
    console.log(form_data);
    return $.ajax({
        type: "POST",
        url: "register.php",
        data: form_data,
        success: function (responseText) {
            /*console.log(responseText);*/
        },
        error: function (error) {
            console.log("Okay, I failed" + error);
        }
    });
}
</script>
我的问题是,无论是使用serialize()还是serializeArray()传递数据,我都会在FF和Chrome的开发控制台中收到“Okay I failed”错误

以下是php脚本(register.php):

其中,最终IP地址已替换为零

PHP分析错误:语法错误,意外的“用户”(T_常量_封装的_字符串),在第9行的/var/www/html/register.PHP中应为“]”,请参考:

在数组声明中,在
'port'=>'5432'
之后缺少一个

这个

应该是

$params = [
    'host' => '000.000.000.000',
    'port' => '5432',
    'user' => 'xxxxxxxxxxx',
    'pwd' => 'xxxxxxxxxx',
    'db' => 'dbase01' ];

你看过PHP错误日志了吗?我正在读。它很长,所以我会发回相关的声音错误。我刚刚用最新的error.log条目更新了我的问题。最相关的一个看起来像第9行的/var/www/html/register.php中的“expecting']”,referer:“但是第9行不会有“]”,除非我不理解日志如何计算行号。谢谢你的回答。我将在5432后面加逗号。对于你的其他评论,这是Postgres,而不是MySQL——你的评论仍然与Postgres相关吗?@RTC222我从未使用过Postgres,但通过快速搜索,我不认为你在Postgres中使用反勾号。我会更新我的答案。5432后的逗号去掉了语法错误。剩下的问题是没有找到pdo_pgsql,显然没有启用。请参阅我的问题
<?php
// PHP file upload using PDO
header('Content-type: application/json');
echo json_encode($array);

$params = [
    'host' => '000.000.000.000',
    'port' => '5432'
    'user' => 'xxxxxxxxxxx',
    'pwd' => 'xxxxxxxxxx',
    'db' => 'dbase01' ];

try {
$pdo->beginTransaction();
    $sql = "INSERT INTO qsq01 ('"
. implode("','", $fields) . "') VALUES (?,?,?,?,?,?,?)";
    $stmt = $pdo->prepare($sql);
    foreach ($data as $row) $stmt->execute($row);
    $pdo->commit();
} catch (PDOException $e) {
    error_log($e->getMessage());
    $pdo->rollBack();
}
?>
PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/lib/php/20180731/pdo_pgsql (/usr/lib/php/20180731/pdo_pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20180731/pdo_pgsql.so (/usr/lib/php/20180731/pdo_pgsql.so: undefined symbol: pdo_parse_params)) in Unknown on line 0
PHP Warning:  Module 'pgsql' already loaded in Unknown on line 0
[Sat Jul 06 06:25:02.235252 2019] [mpm_prefork:notice] [pid 8217] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Sat Jul 06 06:25:02.235273 2019] [core:notice] [pid 8217] AH00094: Command line: '/usr/sbin/apache2'
[Sat Jul 06 21:34:23.181644 2019] [php7:emerg] [pid 31280] [client 73.35.150.123:52161] PHP Parse error:  syntax error, unexpected ''user'' (T_CONSTANT_ENCAPSED_STRING), expecting ']' in /var/www/html/register.php on line 9, referer: http://000.000.000.0/ 
$params = [
    'host' => '000.000.000.000',
    'port' => '5432'
    'user' => 'xxxxxxxxxxx',
    'pwd' => 'xxxxxxxxxx',
    'db' => 'dbase01' ];
$params = [
    'host' => '000.000.000.000',
    'port' => '5432',
    'user' => 'xxxxxxxxxxx',
    'pwd' => 'xxxxxxxxxx',
    'db' => 'dbase01' ];