Running PHP, external database server connection



  • For some reason, i need to run php and connect to external database server. We have application server and also database server, i want to create log files where it saves something like squidquard log by user to their log report (Web Application host at Application Server) to let them know what they access to and reason it been blocked. The problem is, in pfsense, it seems i cant run php-mysql function such as mysql_connect(); This is for me to get connected to database external server. It always give me error..
    "Fatal error: Call to undefined function: mysql_connect() in /usr/local/www/connect.php on line 5"

    on my connect.php

    $sqluser = "user";
    $sqlpass = "pass";
    $server = "ip_address";
    mysql_connect($server,$sqluser,$sqlpass) or die("Could not connect to SQL server");
    mysql_select_db("database") or die("Could not select database from SQL server");



  • We don't compile MySQL support into PHP on the pfSense builds.



  • solved it using ozanus recommendation..http://forum.pfsense.org/index.php/topic,21885.msg112854.html#msg112854

    the important line is..

    pkg_add -r http://files.pfsense.org/packages/7/All/php4-mysql-4.4.8.tbz
    ln -s /usr/local/lib/php/20020429/mysql.so /usr/local/lib/php/extensions/no-debug-non-zts-20020429/mysql.so
    

    now im capturing user details like mac address via arp and squidquard..


Log in to reply