douduan4116 2018-01-26 18:56
浏览 78

连接到运行MAMP PRO的OS X上的MSSQL

EDIT: I have not found the solution, instead a virtual machine was created with centOS where the extensions needed would load. If this can help someone in the future, that's fantastic.

Versions: PHP5.6, MSSQL 2008, OS x El Capitan

I'm trying to query a MSSQL database to compare results with a MySQL database. I can query the MySQL db without issue, I cannot query the MSSQL db. I've installed freetds, odbc, autoconf, followed multiple tutorials including:

I've also tried using Propelorm without success.

Checks: - myssql.so is in the extensions folder and is being called in my php.ini. - I've tried running a try/catch on my 500 error, no good. - apache and php logs don't show anything in regards to the page I'm loading or the service in general. - php.info show the correct extensions file and the correct directory to call the extension, a search in the page did not spit back anything with "mssql" or "pdo_dblib".

My next course of action is to create a virtual machine running Ubuntu to test the script but I would like to be able to develop on my host machine.

Looking at the php.ini for php5.6.31 (version being used by MAMP PRO):

/Applications/MAMP/bin/php/php5.6.31/conf/php.ini

 421 ; Directory in which the loadable extensions (modules) reside.
 422 extension_dir = "/Applications/MAMP/bin/php/php5.6.31/lib/php/extensions/no-debug-non-zts-20131226/"

 531 ; Extensions
 532 
 533 ;extension=apcu.so
 534 extension=mssql.so
 535 extension=pdo_dblib.so
 536 extension=imap.so
 537 extension=mcrypt.so
 538 extension=gettext.so
 539 extension=pgsql.so
 540 extension=pdo_pgsql.so
 541 
 542 ;extension=imagick.so
 543 ;extension=tidy.so
 544 extension=oauth.so

Taking a look in the extensions folder, we can see the mssql.so file:

/Applications/MAMP/bin/php/php5.6.31/lib/php/extensions/no-debug-non-zts-20131226/

apcu.so                         mcrypt.so                       tidy.so
gettext.so                      memcached.so                    uploadprogress.so
igbinary.so                     mssql.so                        xcache.so
imagick.so                      oauth.so                        xdebug.so
imap.so                         opcache.so                      yaml.so
ioncube_loader_dar_5.6.so       pdo_pgsql.so                    yaz.so
ioncube_loader_dar_5.6_ts.so    pgsql.so

I'm not sure what else to include, let me know in the comments and I will update the questions.

 23   $mssql_link = mssql_connect($custom_mssql_host, $custom_mssql_user, $custom_mssql_pass, $custom_mssql_db);
 24   if (!$mssql_link) {
 25     die('Could not connect to MSSQL database: ' . mssql_error());
 26     exit;
 27   }
 28   if(!mssql_select_db($custom_mssql_db)) {
 29     die('Could not select MSSQL database: ' . mssql_error());
 30     exit;
 31   }
 46   $query2 = mssql_query("SELECT * FROM table2");
 47   $result2 = mssql_query($query1);
 48   if(!$query1) {
 49     die('Could not query:' .mssql_error());
 50   }
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀
    • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100