Apache error 500 after PHP upgrade

When upgrading your server from old PHP release to 5.4 make sure your application does not use deprecated functions such as session_register.
This function may be used in older CMS versions, as Tiger CMS.

To comment out all occurrences of incompatible functions in the code you can use following command:
Example for session_register:

[code]
find . -type f -exec sed -i ‘s/session_register/\/\/session_register/g’ {} \;
[/code]

Generic troubleshooting steps for error 500 in Apache:

1. Check Apache error log
/var/log/apache2/error.log

2. Turn on PHP Error reporting in etc/php.ini (/etc/php5/apache2/php.ini)
[code]
error_reporting(E_ALL);
[/code]

3. Create an info.php file to test php, with content:

[code]

[/code]

So you can see what version you use and if it is loaded correctly.

Good Luck!

Automating tasks with cron on CheckPoint Gaia

To use cron on CheckPoint Gaia firewall you need to create a separate user, as “admin” user crontab file is overwritten on every reboot by /bin/cron_xlate.

Instead of using default command :
> crontab -e
It will warn you as follows:
[code]
# This file was AUTOMATICALLY GENERATED
# Generated by /bin/cron_xlate on Wed Jan 14 13:33:33 2015
#
# DO NOT EDIT
#
SHELL=/bin/bash
MAILTO=””
#
# mins hrs daysinm months daysinw command
#
[/code]

You will also need to specify the user:

> crontab -u cron_user -e

To create a new user for cron, use following commands:

[code]
add user cron_user uid 0 homedir /home/cron_user
set user cron_user gid 100 shell /bin/bash
add rba user cron_user roles adminRole
set user cron_user password
[/code]

Make sure you use new user’s home folder for output in your scripts, to avoid issues with permissions.

SSHd server not starting at boot RHEL / CentOS 7

By default sshd server does not start in CentOS 7.
chkconfig command does not control ssh daemon any more.

Solution is to use systemctl:

[code]
> systemctl enable sshd
[/code]

It produces following awkward result:
ln -s ‘/usr/lib/systemd/system/sshd.service’ ‘/etc/systemd/system/multi-user.target.wants/sshd.service’

To check if SSH server is staring on boot (and if it is running):

[code]
> systemctl status sshd

sshd.service – OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
Active: active (running) since Mon 2014-11-03 18:43:56 GMT; 20min ago
[/code]

Enabled – means it will start at boot time automatically.
Welcome to systemd world..

Alias interfaces in CentOS 7/ RHEL 7

[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-enp3s0

HWADDR=00:15:80:99:A6:21
TYPE=Ethernet
BOOTPROTO=none
IPADDR0=212.47.x.x
NETMASK0=255.255.255.0
GATEWAY0=212.47.x.x
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_FAILURE_FATAL=no
NAME=enp3s0
IPADDR1=212.47.x.x
NETMASK1=255.255.255.0
IPADDR2=212.47.x.x
NETMASK2=255.255.255.0
IPADDR3=212.47.x.x
NETMASK3=255.255.255.0

UUID=a3fe28da-5d35-4885-9fe8-cb716c29b35a
ONBOOT=yes