dongquanlin1885 2011-09-17 08:28
浏览 103

PHP PDO:设置FireBird连接超时

I'm connecting to a FireBird database, which works fine when the database is online. When the server is offline, the user gets an max execution time passed error.

Therefore I want to surround the connection statement with a try catch and set the timeout to 10 seconds. But I can't find the right attribute to do so. The default ATTR_TIMEOUT doesn't seem to work. Can anyone tell me if this is possible with PDO and FireBird?

  • 写回答

1条回答 默认 最新

  • dstobkpm908182 2011-09-17 09:54

    Not sure about PHP / PDO but there is ConnectionTimeout parameter in the firebird.conf file you could try. The default value is 180 seconds (quote from conf file):

    # ----------------------------
    # Client Connection Settings (Basic)
    # Seconds to wait before concluding an attempt to connect has failed.
    # Type: integer
    #ConnectionTimeout = 180

    If your FireBird server is not in the same server where the PHP script runs and you don't have firebird.conf file on the "PHP server", then try to put one into same directory where the fbclient dll is. Or if there is FIREBIRD enviroment variable defined, then into the directory that var points to.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?



  • ¥15 安卓13,动态广播无法接受
  • ¥50 docker运行容器端口如何映射(不重启服务、不重建容器)
  • ¥50 基于TwinCAT3实现力传感器的实时读取
  • ¥20 python求解八元一次不定方程,无数解中随机输出几组即可(相关搜索:用python)
  • ¥50 libreoffice导出PPTX到PDF中的错误换行问题
  • ¥15 python实现网页视频下载
  • ¥15 如何通过深度图获得物体的完整、正确点云?
  • ¥15 有没有操作系统适用白丁的经典的书籍,如何解决?(标签-学习)
  • ¥15 Catia V5 R20 64位 安装过程中选择orbix配置创建套接字失败
  • ¥100 C51单片机设计交通灯时出现的问题