Category: Server

  • WHMCS cron job says ioncube not installed despite ioncube being installed

    This issue drove me batty for an hour – after installing WHMCS with PHP’s Ioncube extension installed successfully the cronjob required by WHMCS would not run, complaining about Ioncube not being installed. Yet php -v showed that it was in fact installed.

     

    What gives?

     

    Turns out that Ioncube had been enabled for PHP-FPM in the following directory:

     

    /etc/php/7.0/fpm/conf.d/

     

    …but had not been enabled in this directory also:

     

    /etc/php/7.0/cli/conf.d/

     

    …which is another directory that needs the same config file in. In my server’s case the config file was named 00-ioncube.ini and consisted of the following:

     

    zend_extension = “/usr/lib/php/20151012/ioncube_loader_lin_7.0.so”

     

    And with that, voila, cron job works. Can’t get that hour of my life back, though.

     

    Update: For the php7.1 servers the zend_extension line read:

     

    zend_extension = “/usr/lib/php/20160303/ioncube_loader_lin_7.1.so”

  • How do you check website links and jpgs etc. recursively?

    LinkChecker is a great way of doing this;

     

    http://wummel.github.io/linkchecker/

     

    Other people’s sites may have robots.txt files that prevent you from using this tool on their sites but it’s darn handy for pulling up broken links on your own sites. This is a valid alternative to the Integrity tool on Mac if you’re comfortable with the command line and piping the output to a CSV file etc.

     

     

  • PHP contact form returns 504 gateway error after moving to Digital Ocean

    This one had me scratching my head for a while – using php7.0-fpm and the latest nginx on Debian 8 Jessie I was seeing our PHP contact form working correctly but returning a Gateway 504 error upon submission, which was resulting in a great deal of resubmitted forms and error notifications from users.

     

    This only started occuring after we moved our site to Digital Ocean – it turns out that it was a IP priority issue and the following resolved it:

     

    vim /etc/gai.conf

     

    and uncommenting the following line:

     

    precedence ::ffff:0:0/96  100
    
    

    Then a reboot. Voila, the contact form worked properly again.

  • https://www.sotechdesign.com.au/date-a-millionaire-app/

    With the recent release of Intel’s Haswell-EP (aka Grantley) range of CPUs we have a new assortment of motherboards to match. One of the Supermicro server offerings is the X10SRH-CLN4F single-socket (UP, as opposed to dual socket – DP) board.

     

    single get togethers near me

  • Supermicro X10SRH-CLN4F review coming soon!

    We have a new motherboard in-house – the single-socket 2011-3 Supermicro X10SRH-CLN4F. Photos are done, full review to come soon!


    Review is now live! See: https://sotechdesign.com.au/supermicro-x10srh-cln4f-socket-2011-3-server-motherboard-review/

     

    supermicro-x10srh-cln4f-server-motherboard-socket-2011-3-haswell-review-coming-soon

  • How to auto mount samba or cifs shares in OS X Mavericks

    After mounting your shares using Command+K in Finder, go to:

     

    Settings -> Users and Groups -> Click on the lock to allow changes

     

    how-to-automount-samba-shares-os-x-mavericks-01

    Select “Login items” at the top, click on the plus symbol, then find your server on the left pane:

     

    how-to-automount-samba-shares-os-x-mavericks-02

    Click on the samba/CIFS share you wish to automount, then select “Add”; you should now see it in the list:

     

    how-to-automount-samba-shares-os-x-mavericks-03

    In theory, to hide the Finder window which opens when it is mounted you select the “Hide” tickbox on the left side of the share name. This doesn’t seem to work, however! Click on the lock to prevent further changes, restart and you should see your shares automount on boot.

  • How to cache yum repositories on CentOS using apt-cacher-ng on Debian or Ubuntu

     

    If you have a lot of virtual (or real) machines running Debian or Ubuntu and a limited internet connection, it can make a lot of sense to use apt-cacher-ng to create a local cache of the packages you use so that they are only downloaded once. The current version of apt-cacher-ng can also help out with yum repositories!

     

    On CentOS, edit /etc/yum.conf and add:

     

    proxy=http://[ip-of-your-local-apt-cacher-ng-server]:3142

     

    If you have changed the default port of apt-cacher-ng from 3142, you will need to modify that. Our example file:

     

    [main]
    cachedir=/var/cache/yum/$basearch/$releasever
    keepcache=0
    debuglevel=2
    logfile=/var/log/yum.log
    exactarch=1
    obsoletes=1
    gpgcheck=1
    plugins=1
    installonly_limit=5
    bugtracker_url=http://bugs.centos.org/set_project.php?project_id=16&ref=http://bugs.centos.org/bug_report_page.php?category=yum
    distroverpkg=centos-release
    proxy=http://10.1.1.12:3142

    #  This is the default, if you make this bigger yum won’t see if the metadata
    # is newer on the remote and so you’ll “gain” the bandwidth of not having to
    # download the new metadata and “pay” for it by yum not having correct
    # information.
    #  It is esp. important, to have correct metadata, for distributions like
    # Fedora which don’t keep old packages around. If you don’t like this checking
    # interupting your command line usage, it’s much better to have something
    # manually check the metadata once an hour (yum-updatesd will do this).
    # metadata_expire=90m

    # PUT YOUR REPOS HERE OR IN separate files named file.repo
    # in /etc/yum.repos.d

     

    As you can see, our local apt-cacher-ng VM is 10.1.1.12.

     

    Run yum update and check your apt-cacher-ng’s cache – you should now see some CentOS respositories cached there.

  • Fedora 20 – How to make SSH automatically start on boot (sshd.service)

     

    If you are coming to Fedora from Ubuntu you may be surprised that installing the package doesn’t automatically start the SSH daemon on boot. We can change this with the following command, run as root:

     

    systemctl  enable sshd.service

     

    The next time you boot your SSH server should have started automatically.

  • XenServer 6.2: How to set up passthrough of a PCI or PCI-Express device

     

    This is done by logging in as the root user to your XenServer system via SSH. To see the PCI devices available to your system, enter the following command:

     

    lspci

     

    Here is an example result:

     

    00:00.0 Host bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 Northbridge only dual slot (2×16) PCI-e GFX Hydra part (rev 02)
    00:00.2 IOMMU: Advanced Micro Devices, Inc. [AMD/ATI] RD990 I/O Memory Management Unit (IOMMU)
    00:02.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (PCI express gpp port B)
    00:09.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (PCI express gpp port H)
    00:0a.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (external gfx1 port A)
    00:0b.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890 PCI to PCI bridge (NB-SB link)
    00:0c.0 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] RD890S PCI Express bridge for GPP2 port 1
    00:11.0 SATA controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode]
    00:12.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
    00:12.1 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0 USB OHCI1 Controller
    00:12.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
    00:13.0 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
    00:13.1 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0 USB OHCI1 Controller
    00:13.2 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB EHCI Controller
    00:14.0 SMBus: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 SMBus Controller (rev 3d)
    00:14.1 IDE interface: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 IDE Controller
    00:14.3 ISA bridge: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 LPC host controller
    00:14.4 PCI bridge: Advanced Micro Devices, Inc. [AMD/ATI] SBx00 PCI to PCI Bridge
    00:14.5 USB controller: Advanced Micro Devices, Inc. [AMD/ATI] SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
    00:18.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 0
    00:18.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 1
    00:18.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 2
    00:18.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 3
    00:18.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 4
    00:18.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 5
    00:19.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 0
    00:19.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 1
    00:19.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 2
    00:19.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 3
    00:19.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 4
    00:19.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 5
    00:1a.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 0
    00:1a.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 1
    00:1a.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 2
    00:1a.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 3
    00:1a.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 4
    00:1a.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 5
    00:1b.0 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 0
    00:1b.1 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 1
    00:1b.2 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 2
    00:1b.3 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 3
    00:1b.4 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 4
    00:1b.5 Host bridge: Advanced Micro Devices, Inc. [AMD] Family 15h Processor Function 5
    01:01.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 10)
    01:03.0 Multimedia audio controller: C-Media Electronics Inc CMI8788 [Oxygen HD Audio]
    02:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
    03:00.0 Multimedia controller: Philips Semiconductors SAA7164 (rev 81)
    04:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
    05:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
    06:00.0 InfiniBand: Mellanox Technologies MT26418 [ConnectX VPI PCIe 2.0 5GT/s – IB DDR / 10GigE] (rev b0)

    As you might guess from some of the lines, it’s an AMD server. You’ll notice some USB controllers, likely a SATA controller and any PCI or PCI Express add-in cards (usually at the bottom). In this example we will pass through a digital TV card to a VM so we can record free-to-air TV. The controller here is the fourth-last entry:

     

    03:00.0 Multimedia controller: Philips Semiconductors SAA7164 (rev 81)

     

    It’s a Digital Now PCI-E card – as you can see there’s no mention of the brand in the chipset that the system can see, so you may have to make an educated guess (or do some research as to what’s actually used in the card) to determine which one you want. Making note of the above line, we now edit /boot/extlinux.conf:

     

    vi /boot/extlinux.conf

     

    In our example system it looks like this:

     

    # location mbr
    serial 0 115200
    default xe
    prompt 1
    timeout 50

    label xe
    # XenServer
    kernel mboot.c32
    append /boot/xen.gz mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 console=vga vga=mode-0x0311 — /boot/vmlinuz-2.6-xen root=LABEL=root-ckwntldj ro xencons=hvc console=hvc0 console=tty0 quiet vga=785 splashi  — /boot/initrd-2.6-xen.img

    label xe-serial
    # XenServer (Serial)
    kernel mboot.c32
    append /boot/xen.gz com1=115200,8n1 console=com1,vga mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 — /boot/vmlinuz-2.6-xen root=LABEL=root-ckwntldj ro console=tty0 xencons=hvc console=hvc0 — /boot/initrd-2.6-xen.img

    label safe
    # XenServer in Safe Mode
    kernel mboot.c32
    append /boot/xen.gz nosmp noreboot noirqbalance acpi=off noapic mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M com1=115200,8n1 console=com1,vga — /boot/vmlinuz-2.6-xen nousb root=LABEL=root-ckwntldj ro console=tty0 xencons=hvc console=hvc0 — /boot/initrd-2.6-xen.img

    label fallback
    # XenServer (Xen 4.1.5 / Linux 2.6.32.43-0.4.1.xs1.8.0.835.170778xen)
    kernel mboot.c32
    append /boot/xen-4.1.5.gz mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 — /boot/vmlinuz-2.6.32.43-0.4.1.xs1.8.0.835.170778xen root=LABEL=root-ckwntldj ro xencons=hvc console=hvc0 console=tty0 — /boot/initrd-2.6.32.43-0.4.1.xs1.8.0.835.170778xen.img

    label fallback-serial
    # XenServer (Serial, Xen 4.1.5 / Linux 2.6.32.43-0.4.1.xs1.8.0.835.170778xen)
    kernel mboot.c32
    append /boot/xen-4.1.5.gz com1=115200,8n1 console=com1,vga mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 — /boot/vmlinuz-2.6.32.43-0.4.1.xs1.8.0.835.170778xen root=LABEL=root-ckwntldj ro console=tty0 xencons=hvc console=hvc0 — /boot/initrd-2.6.32.43-0.4.1.xs1.8.0.835.170778xen.img

    Rather an intimidating-looking file if you’re new to *nix config files. Fortunately, we can ignore most of this and just pay attention to the last line in the “label xe” section at the top. The line we want to edit is:

     

    append /boot/xen.gz mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 console=vga vga=mode-0x0311 — /boot/vmlinuz-2.6-xen root=LABEL=root-ckwntldj ro xencons=hvc console=hvc0 console=tty0 quiet vga=785 splashi  — /boot/initrd-2.6-xen.img

     

    Looking at the line we wanted from lspci above, we want the number at the front – in this case:

     

    03:00.0

     

    Add the following near the end of the config line – inbetween “splashi” and “—“:

     

    pciback.hide=(03:00.0)

     

    The line should now read:

     

      append /boot/xen.gz mem=1024G dom0_max_vcpus=4 dom0_mem=4096M,max:4096M watchdog_timeout=300 lowmem_emergency_pool=1M crashkernel=64M@32M cpuid_mask_xsave_eax=0 console=vga vga=mode-0x0311 — /boot/vmlinuz-2.6-xen root=LABEL=root-ckwntldj ro xencons=hvc console=hvc0 console=tty0 quiet vga=785 splashi pciback.hide=(03:00.0) — /boot/initrd-2.6-xen.img

    Note the space on either side – one between splashi and the new text and one between the hyphens and the new text. Now run:

     

    extlinux -i /boot

     

    Then shut down any VMs and reboot the server:

     

    reboot

     

    Once it is back up, we need to find the UUID of the virtual machine we want to pass the device through to. Run:

     

    xe vm-list

     

    This will return a result for every VM on the system – it might be quite long! If it is a long list you may wish to pipe it to the less command for easier viewing:

     

    xe vm-list | less

     

    If you aren’t familiar with less you can exit with the “q” key. Sort through the list until you find the VM you want to pass through to. In this example it is:

     

    uuid ( RO)           : 6b664553-6822-b445-5a8c-c10d93c41c4c
    name-label ( RW): bacchus
    power-state ( RO): halted

    Now we can add the PCI device to the config of this VM:

     

    xe vm-param-set other-config:pci=0/0000:03:00.0 uuid=6b664553-6822-b445-5a8c-c10d93c41c4c

     

    Breaking that down:

     

    xe vm-param-set other-config:pci=0/0000:[PCI address for the device] uuid=[UUID of VM]

     

    Starting the VM – in this case a Windows 7 VM – we can check for the device to see that it has appeared (in this case the drivers were already installed so it has been immediately identified):

     

    xenserver-passthrough-to-windows

    Success! In a Linux system you should be able to do:

     

    lspci

     

    to see the newly passed through hardware.