[英]SQL Server connect with PHP
I have a php script that connects to SQL Server, locally it works fine because I was able to edit the php.ini to include the extension for php_mssql.dll. 我有一个连接到SQL Server的php脚本,在本地它可以正常工作,因为我能够编辑php.ini以包含php_mssql.dll的扩展名。 With the production server, it would be nice if I didn't have to restart the server, so is there a way to add the php_mssql.dll at the start of the script?
对于生产服务器,如果我不必重新启动服务器,那就太好了,因此有没有办法在脚本开始时添加php_mssql.dll? If not, how can I check on the server (linux) to see if the php_mssql.dll file is available if I were to add it into the dynamic extensions section of the php.ini?
如果没有,如果我将其添加到php.ini的动态扩展部分中,如何检查服务器(linux)上的php_mssql.dll文件是否可用?
To test if the mssql extension is loaded, use extension_loaded()
: 要测试是否已加载mssql扩展,请使用
extension_loaded()
:
if (extension_loaded("php_mssql")) {}
Note that on Linux, it won't be a .dll, but rather a .so shared object library, and connections to MSSQL will probably require enabling the FreeTDS libraries on the Linux server. 请注意,在Linux上,它将不是.dll,而是.so共享对象库,并且与MSSQL的连接可能需要在Linux服务器上启用FreeTDS库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.