Install php7.2 CentOS 6.X and 7.X

As PHP versions 5.6 and 7.0 reach End Of Life you might want to update to something newer and supported, unfortunately the official CentOS repositories don’t have PHP versions 7.1 or 7.2 yet, but with a third-party repository and a bit of fiddling it’s easy to update, and more importantly keep it updated, your server PHP version.
 
Just run as root:
Continue reading “Install php7.2 CentOS 6.X and 7.X”

Install php7.2 Debian Stretch

As PHP versions 5.6 and 7.0 reach End Of Life you might want to update to something newer and supported, unfortunately the official Debian Stretch repositories don’t have PHP versions 7.1 or 7.2 yet, but with a third-party repository and a bit of fiddling it’s easy to update, and more importantly keep it updated, your server PHP version.
 

Just run as root:
Continue reading “Install php7.2 Debian Stretch”

AWS S3 Backup Guide 2, aws-cli

If you already have aws-cli installed and want to send a file to Amazon S3 it’s really easy:

aws s3 cp ARCHIVE_TO_SEND s3://BUCKET_NAME/ARCHIVE_TO_SEND

 

Sending files ‘by hand’ is all good, but if you are serious about backups you need to automate the process, here is a quick and dirty backup script.
It lists, tars, bzips and individually uploads all the directories under the path you specify o the script.
 
You just need to set the variables at lines 5, 6, 7 and 8.
Continue reading “AWS S3 Backup Guide 2, aws-cli”

AWS S3 Backup guide 1, bash script

If you don’t have ( or don’t want ) aws-cli installed you can upload files under 5gb with the following script:

#!/bin/bash
# Size limit of 5gb, if you need to upload a bigger file use AWS Cli tools
# $1 Must be the full path of the file
file=$(basename $1)

# S3 authentication information
bucket="<NameOfTheAwsBucket>"
s3Key=""<AWSAccessUser>"
s3Secret="<AWSAccessKey>"
awspath=s3.amazonaws.com
resource="/${bucket}/${file}"

# as we are uploading a backup the need to be a tar archive
contentType="application/x-compressed-tar"
dateValue=$(date -R)
stringToSign="PUT\n\n${contentType}\n${dateValue}\n${resource}"


# Signature magic :)
signature=$(echo -en ${stringToSign} | openssl sha1 -hmac ${s3Secret} -binary | base64)

curl -X PUT -T "${file}" -H "Host: ${bucket}.s3.amazonaws.com" -H "Date: ${dateValue}" -H "Content-Type: ${contentType}" -H "Authorization: AWS ${s3Key}:${signature}" https://${bucket}.${awspath}/${file}

 
Continue reading “AWS S3 Backup guide 1, bash script”

Setting Enviroment Variables for PHP-FPM with Apache

Once in a while you may want to be able to pass information from the apache server to the php-fpm process, a way of doing it is by using environment variables, you can set them either in .htaccess files or in your virtual host configuration files.
 
You can set one variable per line as the following in your file of choice:

SetEnv VARIABLE_NAME "VARIABLE_VALUE"

 
Continue reading “Setting Enviroment Variables for PHP-FPM with Apache”

Force apt-get to use IPv4

If you are having problems with apt and IPv6 a temporary solution is to use the option ‘Acquire::ForceIPv4=true’ by appending ‘-o Acquire::ForceIPv4=true’ at the end of the apt command.

apt-get update -o Acquire::ForceIPv4=true

 
If you want a more permanent solution you can disable the usage of IPv6 with apt altogether with:

echo 'Acquire::ForceIPv4 "true";' | tee /etc/apt/apt.conf.d/99force-ipv4

 

Sources:

https://unix.stackexchange.com/questions/9940/convince-apt-get-not-to-use-ipv6-method

Bad Idea of the day, Disabling VLC root check

Trailing in the deeps of the interwebs, I found an interesting Post, It teaches how to disable the root check for the VLC media player.
 
As some may know VLC rightfully refuses to run as root, and why you would want to run a video player as root is beyond me, but the post explain in some detail how to use a hex editor to search and alter the call to the ‘geteuid()’ function to a call of the ‘getppid()’ function effectively neutering the root check.
 
Continue reading “Bad Idea of the day, Disabling VLC root check”