【问题标题】:"The page cannot be displayed because an internal server error has occurred." as a result of The FastCGI process exited unexpectedly“由于发生内部服务器错误,无法显示该页面。”由于 FastCGI 进程意外退出
【发布时间】:2013-11-10 18:15:49
【问题描述】:

我正在使用部署在 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 server 获取数据时会发生这种情况。当我尝试将数据发布到 sql 服务器时,一切正常。

下面的代码代表我试图用 cmets 来解释发生了什么:

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));
    }

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

【问题讨论】:

    标签: php azure azure-sql-database


    【解决方案1】:

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

    【讨论】:

    • 可能你还没有安装 php 的 pdo 扩展。我知道如何在 linux 上完成,但不能在 windows azure 中完成(
    • 与数据库的连接确实发生了,因为我能够向表中添加一行...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-18
    • 2015-08-24
    • 2014-01-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多