“无法显示页面,因为发生了内部服务器错误”,因为 FastCGI 进程意外退出


"The page cannot be displayed because an internal server error has occurred." as a result of The FastCGI process exited unexpectedly

我正在使用部署在Windows Azure上的php应用程序。

我遇到了导致错误的问题:

"The page cannot be displayed because an internal server error has occurred."

当我查看日志时,我看到:

HTTP Error 500.0 - Internal Server Error
D:'Program Files (x86)'PHP'v5.3'php-cgi.exe - The FastCGI process exited unexpectedly

问题是当我想从 sql 服务器获取数据时会发生这种情况。当我尝试将数据发布到sql服务器时,一切正常。

以下代码表示我尝试对注释执行的操作,以解释正在发生的事情:

try {
        // Try to connect to the database.
        $conn = new PDO ( "sqlsrv:server = server,1433; Database = name", "user", "password");
        $conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
        $conn->beginTransaction();
            // This works out when executed (I see the row in the table).
        $query = "INSERT INTO owner (email) VALUES ('email@email.com')";
        $conn->exec($query);
        $result = $conn->query("SELECT email FROM owner");
        $conn->commit();
        // If the SQL select is succesfully performed ($result not false)
        if($result !== false) {
            echo "there are results";
            // Traverse the result set and shows the data from each row
            foreach($result as $row) {
              echo $row['email']. '<br />';
            }
        }
        $conn = null;        // Disconnect
    } catch ( PDOException $e ) {
        print( "Error connecting to SQL Server. Please call support!" );
        die(print_r($e));
    }

上面的代码确实在服务器上的表中插入了信息,但会导致上述错误。如果我可以提供更多的信息,请告诉我。

检查访问数据库凭据,或者数据库中可能有重复的条目email@email.com。错误日志中记录了什么?

相关文章: