PHP coding at night :)

Yesterday I was programming late at night (4 am) and all the time I had a problem with authentication when switching between web sites.
This morning I looked at the code and found out that I made a simple mistake – a typo in the code.
My advice – do not sit, and code late at night. 😉

ClearOS 6.x MultiWan

Today i have had a problem with 3 external internet connection. What i did at the very beginning of configuring it was that I haven’t choose which interface is the PRIMARY and which is BACKUP.

At the very beginning i have only one external wan so there where no problems but, after some time i have had second and about 3 month ago third external wan.

When one interface was down whole traffic did not know which other interface he had to choose 😉

Today i have set it up properly and voila everything works as planned.

CentOS 6.5 and OpenFire

Yesterday i have installed OpenFire on one of my CentOS servers. First I had to download it from here, and then install it via yum:

Because i had 64 bit version of CentOS I had to install also glibc.i686

After that i had to do some things in MySQL:

After that:

Ok, now we have to allow some ports on firewall:

And add those lines

After that we have to start the openfire service and make it run through server restart

OK, last thing is to go to your http://your.ip.address:9090 and install it 🙂

CentOS 6.x and Microsoft SQL Server ODBC Linux driver

Some days ago in my company someone asked me if we can access to our ERP software which is using Microsoft SQL Server. They want to get data to program which is writing by me using PHP and MySQL. I started to googling the net but I only found that Microsoft is providing drivers for ODBC connection. Those drivers can be found here.

Here is what i have done: (I assume that you have LAMP server setup on your CentOS 6.x)

Next step was to download proper driver: For CentOS 5.x

For CentOS 6.x

Next I have to untar it

and then build it

After that:

And the last

Now I have to setup ODBC, so we have to edit /etc/odbc.ini file and setup proper DSNName values

To test it I have to use the isql command

I have seen something like this below

OK, now it’s time to test PHP connection – because this is what my cooworkers wanted. So let’s wrote some PHP code:

I save it under odbctest.php file. Now it’s time to test it in the linux terminal:

I have seen something like:

Which was good. Now it’s time to test it under Apache, so a I copied this odbctest.php file under /var/www/html

After that i run

the download seems not working. The problem was in selinux permissions. If I do

then wget command will work and my webpage was accessible – until next reboot. Another way was to change the semanage context

Now after reboot it was working 🙂

Important information!

In CentOS 7 all steps will work until →# php odbctest.php. The problem is that Microsoft does’nt provide driver for RHEL/CentOS 7 branch. It only works with PHP up to 5.4 🙁

Installing SARG on ClearOS 6.x

Today i have successfully installed and configured SARG on my work ClearOS 6.x based router. Main goal was to get better reports from existing data.

What we need is:

  1. Installing WGET
  2. Installing RPMForge repo

    Now we have to disable rpmforge repo to avoid conflicts between different software (for example during yum update process). You have to edit /etc/yum.repos.d/rpmforge.repo and change enabled=1 to 0 (zero).
  3. Installing SARG
  4. Configuring SARG
    You can edit /etc/sarg/sarg.conf to modify any variables you want. Also we have to fix problem with subdirectories
  5. Testing SARG – generate one-shoot report
  6. Access SARG reports from your IP
    To see reports generated by SARG you have to edit “/etc/httpd/conf.d/sarg.conf” and the line “# Allow from your-workstation.com” to the IP of your workstation. You can add as many IP as you want. After that it is required to restart webserver
  7. Testing SARG scripts

    There should be no information after running those scripts
  8. The end
    If feverything goes ok, you should visit http://you-server-ip/sarg/ to see reports generated by SARG 🙂

ps. Thanks Tony Ellis from clearfundation forum for tips how to do it right.

How to mount usb drive in ClearOS 6.4

Recently i had a problem with my server running ClearOS 6.4. One of the array hardrive goes down, and i had to recover what could be recovered (it wasn’t important server but users wanted to get back some data).

I have plugged usb 1TB drive, but the COS cannot mount it. The solution was easy:


  1. shows me that my usb drive was connected to /dev/sdb

  2. shows me that the partition type was HPFS/NTFS
  3. next thing was to add rpmforge repo to ClearOS (i followed instructions from CentOS wiki) but i have to install wget first 🙂

    because it wasn’t installed on my server. After that i do some things like:
  4. After that i created a directory in /mnt


    and then do

After that i am trying to copy what i can from that array 🙂

Xubuntu 12.04 LTS running on AMD X6 FX-6100

After couple of weeks i told my boss that my old hardware must be replaced. My plan was to buy hardware which would be able to serve me for testing stuff. My choice was:
CPU: AMD X6 FX-6100
RAM: Kingston 8GB HyperX Blue
Motherboard: Gigabyte GA-780T-D3L
Case: Modecom A14
Graphic card: ATi Radeon HD5450 1GB RAM DDR3

All my company runs programs which require Microsoft Windows, but i like ubuntu! So, because i don’t need any special desktop effects i have installed on that configuration Xubuntu 12.04.02 LTS. To run Windows software i have installed Oracle VirtualBox and then Windows 8 Enterprise Edition.

This is a second week when i am using that and everything works fine!