How to get php to use a mysql server on pfsense ???



  • hi,

    i try to use mysql on pfsense from php
    but php don't get the mysql
    i think i missed somting this is wat i have done :

    pkg_add -r ftp://ftp.freebsd.org/pub/FreeBSD/releases/i386/6.2-RC2/packages/databases/mysql-server-5.1.11.tbz
    /usr/local/bin/mysql_install_db
    chmod 777 /var/db/mysql
    chmod 777 /var/db/mysql/mysql
    chmod 777 /var/db/mysql/mysql/.
    mv /usr/local/etc/rc.d/mysql-server /usr/local/etc/rc.d/mysql-server.sh
    vi /usr/local/etc/rc.d/mysql-server.sh

    chanced
    : ${mysql_enable="NO"}
    to
    : ${mysql_enable="YES"}
    save the file

    vi /usr/local/lib/php.ini
    add
    extension=mysql.so
    save the file

    cd /tmp
    mkdir php
    cd php
    fetch ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-6.2-release/All/php4-mysql-4.4.4_1.tbz
    tar -xjvf php4-mysql-4.4.4_1.tbz
    cd lib/php/20020429/
    cp mysql.so /usr/local/lib/php/extensions/no-debug-non-zts-20020429/mysql.so
    chmod 755 /usr/local/lib/php/extensions/no-debug-non-zts-20020429/mysql.so

    but afther a reboot still no mysql suport in php
    the mysql server is started



  • I am no security expert, but i don't see how it would be beneficial to install msql on your firewall. If you really need to have database access, install the server on aonther machine within your network and use it from there. Installing it on your bastion host is a BAD idea, no matter what the purpose.



  • I think MySQL, or for that matter any database, should never be installed on a firewall device. From a security standpoint, that would be basically shooting yourself in the foot. Firewalls are simply not meant to run databases :).



  • its not run on my pfsense firewall server but on my pfsense aplication server

    i have found the problem
    on boot php.ini is made new again can't find where but this fixes it

    cd /usr/local/lib
    cp php.ini php.mysql
    vi php.mysql
    add
    extension=mysql.so
    save file

    vi /usr/local/etc/rc.d/mysql-server.sh
    add after

    run_rc_command "$1"
    these lines

    killall php
    cp /usr/local/lib/php.mysql /usr/local/lib/php.ini

    save file

    now mysql in php on the gui works



  • Ugh! Why are you using pfSense as an app server??? If you would have been using a stock FreeBSD 6.x, there wouldn't have been the need to twiddle with the php.ini file. At least not the way you had to …

    Regards
    Daniel S. Haischt



  • butt then you don't have a good gui
    that what i love on pfsense its gui
    so i have a pfsense server configed as a firewall
    and one as a pfsense aplication server



  • hummm but on an app server ypu have Apache etc. and the pfSense GUI isn't meant to administer Apache via it's GUI. Why don't you install webmin orsomething similar on your application server?

    Regards
    Daniel S. Haischt



  • yup, if you have another freebsd system just say pkg_add -r webmin and run setup, it runs pretty much right out of the box.  You have to give it a few directory names to setup mysql support and other things in the gui, but not too difficult overall.  Ebox and Freenas have some interesting application server junk included in them as well.



  • @jeroen234:

    butt then you don't have a good gui
    that what i love on pfsense its gui
    so i have a pfsense server configed as a firewall
    and one as a pfsense aplication server

    You might want to look into sqlite if you really, really, really need a database.  If you only need to store a few settings, just use the XML dude. =)

    [ simon.cpu ]



  • Basically people should take five minutes to sit down and think about roles. After that you will realize that pfSense has not the role of a database server (period!). So if you need to store data, setup a RDBMS on a dedicated machine.

    Cheers
    Daniel S. Haischt


Log in to reply