Moving from DigitalOcean to Vultr after price change (July 2022)

Recent price change in DigitalOcean make me reconsider old friend that I rarely visit. After my workload seem to slow down I decide to make little comparison. This table is for my friend vps that use DigitalOcean before move to Vultr.

So, he will pay $4 more than usual.

Related screnshot (regular)

Related DO (premium)

Interestingly DO have new $4 package for regular (10 GB storage)

In Vultr side

Shared vCPU is enough with regular performance (for no.1 and 2 server)

For server 3, vultr also support it

reguler 1 and 2

My friend told me if vultr have $2.5 and $3.5 server but I can’t see it.

At the end, I have same price as in DigitalOcean before price change but in Vultr.

After I give this table to my friend he refuse it and modify my table into this one.

He told me to help migration process with this table within 2 weeks.

Now the process is finished. Nothing change much except server 2 that use lower memory . I suggest him to use $5 from vultr . As he’ll get double memory and storage.

I give my referral link from vultr that give him $100 to get start.

 

Saved by the bell (Vultr)

For limited time Vultr give you $50 free credit . Use this link to get the offer.

One of my client dedicated server crash due to electrical failure. They want the service run as soon as possible.

The problem is their service run with old centos 5 because they use old php 5.2 for the web based app. New version of app is not ready yet. Still baked by the programmer teams.

Vultr come to rescue by providing custom iso service. They let us using iso simply by providing link to the iso then mounting the iso then reboot to start install.

For my case, I use 64 bit iso 5.11 from centos vault here.

Get yum update work on centos 5.11

nano /etc/yum.repos.d/CentOS-Base.repo

put these lines :

[base]

name=CentOS-$releasever - Base
baseurl=http://vault.centos.org/5.11/os/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[updates]

name=CentOS-$releasever - Updates
baseurl=http://vault.centos.org/5.11/updates/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[extras]

name=CentOS-$releasever - Extras
baseurl=http://vault.centos.org/5.11/extras/x86_64/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[centosplus]

name=CentOS-$releasever - Plus
baseurl=http://vault.centos.org/5.11/centosplus//x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[contrib]

name=CentOS-$releasever - Contrib
baseurl=http://vault.centos.org/5.11/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

yum clean all

yum update

For php 5.2.17 section I use this guide.

Testing UpCloud : another awesome VPS that support Singapore

Well, the title is bit subjective since I live in Asia then any Singapore node would be my concern. Specially new one (I don’t know about upcloud till their ads show up in my instagram feed 🙂 ).

The price also come affordable so I decide to try it with one study case, install centminmod beta!

Lets get start!

Deployment process is not hard as I already have experience with Vultr, DigitalOcean and Linode.

Enter server name and short description.

I pick Singapore zone

Choose $5/month server

I let disk name as is and pick CentOS 6.9 as operating system.

Skip ssh keys and change little in timezone and ipv6 to no (i don’t need it)

Pay attention to summary and hit ‘Deploy Server’ button.

This next section is wait 🙂

I got stuck in this part till I deposit money in billing section (might be trial mode make me stuck in this step but after deposit everything work well)

Install Centminmod Beta

I prefer to use php 7

yum -y update; curl -O https://centminmod.com/betainstaller7.sh && chmod 0700 betainstaller7.sh && bash betainstaller7.sh

wait for moment

My connection seem not stable so I got disconnected from server during centminmod installation. Continue with installation but still no luck. Nginx installation went wrong and also the rest (php, mysql).

I decide to reinstall the server

In this section I can see ‘Reinstall’ button as I want reinstall my server for clean start. Well, I hope they will add that feature.

So I delete server and create from scratch new server that run CentOS 6.9.

This time I use legacy stable CentMinMod.

yum -y update; curl -O https://centminmod.com/installer.sh && chmod 0700 installer.sh && bash installer.sh

Wow, this time everything work very fast. Might be processor plus the MaxIOPS things that do the magic.

Thank You for my friend who tell me about upcloud by using his code I get $25 for my credit. You’re also welcome to use my code by clicking HERE and get $25 for your upCloud account.

I’ll consider to deploy more server , keep up the good work upCloud!

How to upgrade storage in VPS

Yes, I know the title is not good enough for many of you but not for me. I’m in a hurry when I need this feature. Lucky me, the process is not difficult at all.

Problem. One of vps server that reside in digitalocean need to upgrade the storage as the report told me about the service not run well due to unsufficient storage.

Further investigation tell me the truth.

df -H

Filesystem Size Used Avail Use% Mounted on
/dev/vda1 32G 30G 278M 100% /
tmpfs 523M 0 523M 0% /dev/shm
/home/usertmp_donotdelete
4.0G 12M 3.8G 1% /tmp

Well, only 278M left after delete log file and a few old backup files.

I know if digitalocean provide volume service and now its time to use it 🙂

Click the ‘Add Volume’ button lead me to this display.

Enter size for this volume and set the name. Hit Create Volume button to start create the space.

Wow, really cool. You just need to copy and the command. It just works!

Step1 :

sudo mkfs.ext4 -F /dev/disk/by-id/scsi-0DO_Volume_skripsi

mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1966080 inodes, 7864320 blocks
393216 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=4294967296
240 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000

Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.

Step 2 :

sudo mkdir -p /mnt/skripsi; sudo mount -o discard,defaults /dev/disk/by-id/scsi-0DO_Volume_skripsi /mnt/skripsi; echo /dev/disk/by-id/scsi-0DO_Volume_skripsi /mnt/skripsi ext4 defaults,nofail,discard 0 0 | sudo tee -a /etc/fstab

Check if mounted

mount

/dev/vda1 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/home/usertmp_donotdelete on /tmp type ext4 (rw,noexec,nosuid,loop=/dev/loop0)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sda on /mnt/skripsi type ext4 (rw,discard)

Wow, in less than 5 minutes the job gets done and everyone happy 🙂

Thank You DigitalOcean, good work.

How to install php 5.2.17 on CentOS 6.9

Long time no see 🙂 . Being busy with a few machines that got EOL phase. Yes, many legacy app require PHP 5.2.17 but developer nor the company refuse to upgrade. Now, the machine also reach end of life (CentOS 5.11) . The only option available is upgrade the OS with CentOS 6 or CentOS 7.

I use VPS to simulate the process and write it here for documentation purpose, lets get start!

Upgrade to latest CentOS 6

yum update

Install required files

yum install gcc make httpd-devel libxml2-devel bzip2-devel openssl-devel curl-devel gd-devel libc-client-devel libmcrypt-devel libmhash-devel mysql55-devel aspell-devel libxslt-devel nano wget

download php 5.2

wget http://museum.php.net/php5/php-5.2.17.tar.gz 
tar -zxvf php-5.2.17.tar.gz
cd php-5.2.17

Configure

./configure --prefix=/usr/local/php52 --with-apxs2=/usr/sbin/apxs --with-config-file-path=/usr/local/lib/php52/ --disable-posix --enable-bcmath --enable-calendar --enable-exif --enable-fastcgi --enable-ftp --enable-gd-native-ttf --enable-libxml --enable-magic-quotes --enable-mbstring --enable-pdo --enable-soap --enable-sockets --enable-wddx --enable-zip --with-bz2 --with-curl --with-curlwrappers --with-freetype-dir --with-gd --with-gettext --with-jpeg-dir --with-kerberos --with-libxml-dir --with-libxml-dir --with-mcrypt --with-mhash --with-mime-magic --with-mysql --with-mysqli --with-openssl --with-openssl-dir --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pic --with-png-dir --with-pspell --with-sqlite --with-ttf --with-xmlrpc --with-xpm-dir --with-xsl --with-zlib --with-zlib-dir

Collection off problems occured during install

problem 1 :

configure: error: libjpeg.(a|so) not found.

solution

ln -s /usr/lib64/libjpeg.so /usr/lib/libjpeg.so

problem 2 :

configure: error: libXpm.(a|so) not found.

solution

ln -s /usr/lib64/libXpm.so /usr/lib/libXpm.so

problem 3 :

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

solution

yum install epel-release
yum install libmcrypt-devel

problem 4 :

configure: error: Please reinstall libmhash – I cannot find mhash.h

solution

yum install libmhash-devel

problem 5 :

configure: error: Cannot find MySQL header files under yes.

solution

yum install mysql-server mysql-devel
ln -s /usr/lib64/mysql /usr/lib/mysql

problem 6 :

configure: error: libpng.(a|so) not found

solution

ln -s /usr/lib64/libpng.so /usr/lib/libpng.so

Install php 5.2.17

make && make install

….
………
Installing PEAR environment: /usr/local/php52/lib/php/
[PEAR] Archive_Tar – installed: 1.3.7
[PEAR] Console_Getopt – installed: 1.2.3
[PEAR] Structures_Graph- installed: 1.0.3
[PEAR] XML_Util – installed: 1.2.1
[PEAR] PEAR – installed: 1.9.1
Wrote PEAR system config file at: /usr/local/php52/etc/pear.conf
You may want to add: /usr/local/php52/lib/php to your php.ini include_path
Installing PDO headers: /usr/local/php52/include/php/ext/pdo/

Edit httpd.conf

Make sure you have these lines in httpd.conf

nano /etc/httpd/conf/httpd.conf

LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so
AddType application/x-httpd-php .php .phtml

Start Apache and mysql service

service httpd start
service mysqld start

Make permanent service

chkconfig --level 35 httpd on
chkconfig --level 345 mysqld on

Firewall Setting

iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
service iptables save
service iptables restart

Done.

How to update your own Invoice Ninja to latest version

My bad for neglecting so many Invoice Ninja version from latest installation (version 3.2), when I log in I see this message :

A new version of Invoice Ninja is available. You’re running v3.2.0, the latest is v3.4.2

But actual download link lead me to 3.5.1 ( at the time of writing) which make confuse on which path should I choose for updating method :

  1. Update to 3.4.2 first then update to 3.5.1 or
  2. Update to the latest (3.2 to 3.5.1)

Well, Invoice Ninja provide support docs for the case. You can see it here.

But, it would be nice to try it first with dummy server to convince myself and preparing for unexpected issue that might occur.

Lets get start!

  1. Log in to vps server as root

  2. Checking path and ownership

cd /srv/users/serverpilot/apps

ls -l

total 99608
drwxrwxr-x+ 12 serverpilot serverpilot 4096 Jul 7 08:04 invoice
drwxr-xr-x+ 3 serverpilot serverpilot 4096 Jul 7 02:56 invoice_old
-rw-rw-r–+ 1 root root 101977765 Apr 2 20:33 ninja-v3.2.0.zip

ls invoice

CONTRIBUTING.md artisan composer.json gulpfile.js resources
Gruntfile.js bootstrap composer.lock package.json server.php
LICENSE bower.json config phpspec.yml storage
README.md c3.php database phpunit.xml tests
app codeception.yml docs public vendor

as you see from the above result :

path : /srv/users/serverpilot/apps/invoice

ownership : serverpilot (for user and group)

3. Download shell script and save it to a file

copy and paste from ‘raw paste data’ More

How to install ioncube loader on easyengine + php 7

I need to test chat engine from arrowchat and as usual I try to document the process in this blog. Arrowchat provide trial for 10 days. This version encrypted with ioncube and the server need to use ioncube loader.

I learn the hard way just to try arrowchat install display 🙂

ee site create chat.score.com --mysql --php7

Remove php 5.6 from system

ee stack remove --php

Check running php process :

ps ax | grep php

1068 ?        Ss     0:00 php-fpm: master process (/etc/php/7.0/fpm/php-fpm.conf)

Copy file .so

ls /usr/lib/php/

20121212  20131226  20151012  20160303  7.0  php-helper  php-maintscript-helper  php7.0-fpm-reopenlogs  session-clean

ls /usr/lib/php/20160303/

igbinary.so  imagick.so  memcache.so  memcached.so  msgpack.so  redis.so  xdebug.so

Send ioncube loader

scp Downloads/ioncube/ioncube_loader_lin_7.0.so root@ip:/root

mv /root/ioncube_loader_lin_7.0.so /usr/lib/php/20160303/

php.ini add in last one :

nano nano /etc/php/7.0/fpm/php.ini

zend_extension = /usr/lib/php/20160303/ioncube_loader_lin_7.0.so

restart nginx and friends

ee stack restart

PHP5.6-FPM is not installed
Restart : nginx     [OK]
Restart : php7.0-fpm[OK]
Restart : mysql     [OK]
Restart : postfix   [OK]

Upload arrowchat

scp Downloads/arrowchat_trial_v2.0.1.zip root@ip:/root
mv /root/arrowchat_trial_v2.0.1.zip .

cat ../ee-config.php

<?php
define(‘DB_NAME’, ‘chat_score_com’);
define(‘DB_USER’, ‘chat_score_com’);
define(‘DB_PASSWORD’, ‘yMlgjwRHUDpQv23’);
define(‘DB_HOST’, ‘localhost’);

tail -f ../logs/error.log

2017/04/18 03:34:56 [error] 2404#0: *28 FastCGI sent in stderr: “PHP message: PHP Fatal error:  The file /var/www/chat.score.com/htdocs/arrowchat/index.php was encoded by the ionCube Encoder for PHP 5.0 and cannot run under PHP 7.0.
Please ask the provider of the script to provide a version encoded with the ionCube Encoder for PHP 5.6. in Unknown on line 0” while reading response header from upstream, client: 36.77.133.96, server: chat.score.com, request: “GET /arrowchat/ HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9070”, host: “chat.score.com”

Reinstall php 5.6

ee stack install --php

Remove php 7.0

ee stack remove --php7

PHP 7.0 not supported.
Are you sure you to want to remove from server.
Package configuration will remain on server after this operation.
Any answer other than “yes” will be stop this operation :  yes
Removing packages, please wait…
Successfully removed packages
PHP5.6-fpm found on system.
Verifying and installing missing packages,

Reupload ioncube for php 5.6

scp Downloads/ioncube/ioncube_loader_lin_5.6.so root@ip:/root

mv /root/ioncube_loader_lin_5.6.so /usr/lib/php/20151012/

edit php.ini

nano /etc/php/5.6/fpm/php.ini

zend_extension = /usr/lib/php/20151012/ioncube_loader_lin_5.6.so

Restart nginx

ee stack restart --nginx

Restart : nginx     [OK]

Update php version to old one

ee site update chat.score.com --php7=off

Summary :

If you want to try arrowchat then you’ll need make sure that you use php 5.6 🙂 . NO php 7 support at this moment.

How to setup your own Invoice Ninja server with $2.5/mo budget

My friend ask me to test Invoice Ninja on my server. This software is very popular since you can do many things with invoice. This software made with Laravel 5.2 and I’ve test it ‘hard way’ in my vps .I think I can share simpler way to get this software run in affordable vps.

This documentation using Vultr vps smallest server and serverpilot free account. In nutshell, you have great invoice software with free control panel 🙂

Lets get start!

Setup VPS Server

VPS provider is Vultr. They provide the plan with pricing $2.5/month.

I use Ubuntu (14.04 64 bit) with following specs : 512MB and 20GB SSD storage.

After hit deploy button write down these information :

  1. Ip address
  2. username (root)
  3. password for vps server

Setting URL for access Invoice Ninja

I use Simple Zone Editor from my cpanel hosting to set A record for subdomain http://ninja.hostingformula.net

update :

I change my dns manager to cloudflare.

$ dig ns hostingformula.net

; <<>> DiG 9.9.5-3ubuntu0.13-Ubuntu <<>> ns hostingformula.net
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 47657
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;hostingformula.net.        IN    NS

;; ANSWER SECTION:
hostingformula.net.    84500    IN    NS    naomi.ns.cloudflare.com.
hostingformula.net.    84500    IN    NS    dom.ns.cloudflare.com.

;; Query time: 4528 msec
;; SERVER: 108.61.10.10#53(108.61.10.10)
;; WHEN: Tue Apr 04 05:52:45 UTC 2017
;; MSG SIZE  rcvd: 102

For cloud flare user just assign A record to vps ip address.

This url is not working yet but we’ll working on it 🙂 More

Step by Step Install Guide for Setup Publishing and Collaborate Documents on VPS

My friend who work on library came and asked me to install some component for their test server that will be base of publishing and collaborate documents. He already try the guide provided by Flowpaper but might be confuse on some steps that might be out of date.

He use free vps that located on Japan (actually its free $20 from Vultr) to try the guide but failed on swftools section. I use his vps and change a little bit the procedure on Ubuntu 14.04 64 bit LTS.

Here the steps : ( I log in as root)

Compiler and friends

apt-get update
apt-get upgrade
apt-get install build-essential

Verify its exist

gcc -v
make -v

Create Linux swap in two steps

Check current swap size

free -m

total       used       free     shared    buffers     cached
Mem:           488        427         61          0         13        346
-/+ buffers/cache:         66        421
Swap:            0          0          0

Install swap maker shell script

wget https://raw.githubusercontent.com/Cretezy/Swap/master/swap.sh -O swap

Create 2G swap

sh swap 2G

Welcome to Swap setup script! This script will automatically setup a swap file and enable it.
Root access is required, please run as root or enter sudo password.
Source is @ https://github.com/Cretezy/Swap

Setting up swapspace version 1, size = 2097148 KiB
no label, UUID=e1418ff5-1126-48d8-ac50-d6dd80427752
/swapfile   none    swap    sw    0   0

Done! You now have a 2G swap file at /swapfile

Check it

free -m

total       used       free     shared    buffers     cached
Mem:           488        428         59          0         14        348
-/+ buffers/cache:         66        422
Swap:         2047          0       2047

Install php5

apt-get install php5 unzip

Install pdftk

apt-get install pdftk

swftools

apt-get install swftools

Install pdf2json

mkdir pdf2json

cd pdf2json

wget -c https://github.com/flexpaper/pdf2json/releases/download/v0.68/pdf2json-0.68.tar.gz

tar xvzf pdf2json-0.68.tar.gz

./configure

make && make install

 

Test flowpaper

cd /var/www/html/

wget -c https://flowpaper.com/GPL/FlexPaper_2.3.6.zip

unzip FlexPaper_2.3.6.zip

cd /var/www/html/php/config/

chmod 777 config.ini.nix.php

chmod -R 777 /var/www/html/pdf

Setting admin etc

enter location of pdf folder and add

/usr/share/swftools

as path of swftools

Done.

Step by Step Install PHP 7 on latest Centos 7 VPS

This title taken from my friend question who want to teach him about install latest php version (current version is 7.0.12) but also need to do it in simple copy and paste way 🙂

I use Vultr $20 instance that will become a server for my friend (he is ios programmer that need lamp server for his project).

Lets get start!

Check available memory

free -m

total        used        free      shared  buff/cache   available
Mem:           1839          89        1331          16         418        1599

Create Swap

Create 4GB swap because the vps instance use 2GB memory : (in general swap space is twice of memory) More

How to transfer self hosted vps wordpress to cpanel hosting

Another case for hostingformula presented by my brother 🙂 . He use vps for his blog that backed by wordpress. Not critical blog actually. He use it for daily ramblings and so on. Unfortunately his vps expire and he already get cpanel hosting for his next place. He ask me to transfer his blog as soon as possible.

The plan for his blog are :

Request for ssh access

Many cpanel hosting support ssh but this feature not enabled by default. You have to open a ticket and ask for activate ssh access for your cpanel account. Note : every hosting company have different policy including ssh port. Usually its not 22 but you ask for exact port for sure.

Use scp

My brother cpanel hosting is very limited in space. He’s current use around 400 MB and his cpanel hosting space is 500 MB. Very tight huh 🙂 . Scp come for rescue in this case. The exact command for scp transfer from vps to cpanel :

scp -P 24579 -r wp-content usernamecpanel@ipaddress:.

24579 is ssh port  (your webhosting ssh port is vary)

-r is recursive mode transfer

wp-content ; wordpress heavily use wp-content folder to store plugins, uploaded image, backup etc. I need only this folder as I can download latest wordpress code from wordpress.org .

Fix Permission

Many cpanel hosting use suphp . You’ll need to fix permisson for folder (755) and files (644) or you’ll get annoying error message when you access your wordpress blog.

Quick commands :

find wordpress_folder/ -type d -print0 | xargs -0 chmod 0755

find wordpress_folder/ -type f -not -name “*.pl” -not -name “*.cgi” -not -name “*.sh” -print0 | xargs -0 chmod 0644

Done. The plan is complete now 🙂

Maybe I’ll let my brother to do it himself now and I’ll check his work.

Bonus Plan

To avoid downtime he need to set cloudflare account and activate it for dns only. When everything is fine then he can activate proxy function.

How to Install Multiple PHP version (PHP 5.2, PHP 5.5, PHP 5.6 and PHP 7) in single VPS with Ubuntu 16.04

I need to test the effect of new plugin on new development stage while still preserve production setting. Not in high traffic domain and I also want to learn new framework called phalcon php. Since I want to support newest ubuntu server I came with my requirement list :

  1. Must be able to run on newest Ubuntu (I’m aware about 16.04 LTS)
  2. Must be able to run old PHP version (the latest of 5.2 release is 5.2.17). Even this version is no longer supported by php.net but a few products still rely on this version.
  3. I want to learn Phalcon PHP version 2.0.x .
  4. I also want to compare it with latest version of Phalcon PHP version 2.1.x
  5. Newest PHP version 7 also needed

The list translated into plan :

5.2 -> 5.2.17
5.5 -> 5.5.32 -> phalcon 2.0.10 (latest)
5.6 -> 5.6.18 -> phalcon 2.1 (latest)
7.0 -> 7.0.3

Well, I use Vultr since this vps working well for me for long time and also support iso (yes, I use Ubuntu 16.04 server daily build). (EU) Frankfurt, DE chosen as vps location for this server. 64 bit OS (Xenial Server).

ubuntu16

I also pointing A record for these sub domain. More

How to install PHP 7 GA on CentOs Server

One of blogger in my town came and ask me to help him with his server. Actually his server is enough to handle his wordpress blog but he don’t know what to do. I suggest him to upgrade his server or reinstall server to support latest PHP 7. I told him that newest PHP is twice fast as legacy PHP that he use. I promise to show him the steps and put it public. Maybe other blogger need and find it useful too.

Lets get start!

I use DigitalOcean VPS (1GB package) – You get free $10 if you’re new user.

Choose CentOS 6.7 64 bit with 1 GB memory.

Login to vps and install :

# curl -O https://centminmod.com/installer.sh && chmod 0700 installer.sh && bash installer.sh

Wait till you see # sign . Follow by type

# centmin More

Install PHP 7 and Apache22 on DragonFlyBSD 4.2.4

Using current machine but get faster performance by only upgrade software is a good offer. That feel happen to me when I hear about php 7 release. Being curious I decide to use latest dragonflybsd (at this moment 4.2.4) as pilot project for new hosting infrastructure platform.

Lets get start!

# uname -a

DragonFly php7.hostingformula.net 4.2-RELEASE DragonFly v4.2.4-RELEASE #6: Sun Aug 9 13:25:14 EDT 2015 [email protected]:/usr/obj/home/justin/release/4_2/sys/X86_64_GENERIC x86_64

# pkg info

bind-tools-9.10.2P3 Command line tools from BIND: delv, dig, host, nslookup…
ca_root_nss-3.19.2 Root certificate bundle from the Mozilla Project
cdrtools-3.00_2 CD/DVD/BluRay and ISO-9660 image creation and extraction tools
curl-7.43.0_2 Non-interactive tool to get files from FTP, GOPHER, HTTP(S) servers
cvsps-2.1_1 Create patchset information from CVS
expat-2.1.0_2 XML 1.0 parser written in C
gettext-runtime-0.19.4 GNU gettext runtime libraries and programs
git-2.4.6 Distributed source code management tool
idnkit-1.0_5 Library to handle internationalized domain names
indexinfo-0.2.3 Utility to regenerate the GNU info page index
isc-dhcp42-server-4.2.8_1 ISC Dynamic Host Configuration Protocol server
krb5-1.13.2_2 Authentication system developed at MIT, successor to Kerberos IV
libxml2-2.9.2_3 XML parser library for GNOME
pkg-1.5.5 Package manager More

VPS run out of space after apt-get upgrade

Yes, updraft plus plugin complain about space left. Needed 24 MB but less than that available.

Quick search lead me to problem that occur after apt-get upgrade.

# df -H

Filesystem Size Used Avail Use% Mounted on
/dev/vda1 16G 15G 296M 99% /
udev 385M 13k 385M 1% /dev
tmpfs 79M 254k 79M 1% /run
none 5.3M 0 5.3M 0% /run/lock
none 393M 0 393M 0% /run/shm

 

# apt-get install -f

Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages were automatically installed and are no longer required:
linux-headers-3.2.0-93-generic-pae linux-headers-3.2.0-88-generic-pae linux-headers-3.2.0-90-generic-pae linux-headers-3.2.0-85-generic-pae linux-headers-3.2.0-70
linux-headers-3.2.0-72 linux-headers-3.2.0-73 linux-headers-3.2.0-74 linux-headers-3.2.0-80 linux-headers-3.2.0-75 linux-headers-3.2.0-76 linux-headers-3.2.0-82
linux-headers-3.2.0-77 linux-headers-3.2.0-83 linux-headers-3.2.0-84 linux-headers-3.2.0-79 linux-headers-3.2.0-90 linux-headers-3.2.0-85 linux-headers-3.2.0-91
linux-headers-3.2.0-86 linux-headers-3.2.0-92 linux-headers-3.2.0-87 linux-headers-3.2.0-93 linux-headers-3.2.0-88 linux-headers-3.2.0-89
linux-headers-3.2.0-82-generic-pae linux-headers-3.2.0-77-generic-pae linux-headers-3.2.0-72-generic-pae libluajit-5.1-common linux-headers-3.2.0-89-generic-pae
linux-headers-3.2.0-91-generic-pae linux-headers-3.2.0-86-generic-pae libluajit-5.1-2 linux-headers-3.2.0-83-generic-pae linux-headers-3.2.0-80-generic-pae
linux-headers-3.2.0-75-generic-pae linux-headers-3.2.0-73-generic-pae linux-headers-3.2.0-70-generic-pae linux-headers-3.2.0-92-generic-pae
linux-headers-3.2.0-87-generic-pae linux-headers-3.2.0-84-generic-pae linux-headers-3.2.0-79-generic-pae linux-headers-3.2.0-76-generic-pae
linux-headers-3.2.0-74-generic-pae
Use ‘apt-get autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
root@install:/var/log# apt-get autoremove
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
libluajit-5.1-2 libluajit-5.1-common linux-headers-3.2.0-70 linux-headers-3.2.0-70-generic-pae linux-headers-3.2.0-72 linux-headers-3.2.0-72-generic-pae
linux-headers-3.2.0-73 linux-headers-3.2.0-73-generic-pae linux-headers-3.2.0-74 linux-headers-3.2.0-74-generic-pae linux-headers-3.2.0-75
linux-headers-3.2.0-75-generic-pae linux-headers-3.2.0-76 linux-headers-3.2.0-76-generic-pae linux-headers-3.2.0-77 linux-headers-3.2.0-77-generic-pae
linux-headers-3.2.0-79 linux-headers-3.2.0-79-generic-pae linux-headers-3.2.0-80 linux-headers-3.2.0-80-generic-pae linux-headers-3.2.0-82
linux-headers-3.2.0-82-generic-pae linux-headers-3.2.0-83 linux-headers-3.2.0-83-generic-pae linux-headers-3.2.0-84 linux-headers-3.2.0-84-generic-pae
linux-headers-3.2.0-85 linux-headers-3.2.0-85-generic-pae linux-headers-3.2.0-86 linux-headers-3.2.0-86-generic-pae linux-headers-3.2.0-87
linux-headers-3.2.0-87-generic-pae linux-headers-3.2.0-88 linux-headers-3.2.0-88-generic-pae linux-headers-3.2.0-89 linux-headers-3.2.0-89-generic-pae
linux-headers-3.2.0-90 linux-headers-3.2.0-90-generic-pae linux-headers-3.2.0-91 linux-headers-3.2.0-91-generic-pae linux-headers-3.2.0-92
linux-headers-3.2.0-92-generic-pae linux-headers-3.2.0-93 linux-headers-3.2.0-93-generic-pae
0 upgraded, 0 newly installed, 44 to remove and 1 not upgraded.
After this operation, 1425 MB disk space will be freed.
Do you want to continue [Y/n]? y
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_TIME = “id_ID.UTF-8”,
LC_MONETARY = “id_ID.UTF-8”,
LC_ADDRESS = “id_ID.UTF-8”,
LC_TELEPHONE = “id_ID.UTF-8”,
LC_NAME = “id_ID.UTF-8”,
LC_MEASUREMENT = “id_ID.UTF-8”,
LC_IDENTIFICATION = “id_ID.UTF-8”,
LC_NUMERIC = “id_ID.UTF-8”,
LC_PAPER = “id_ID.UTF-8”,
LANG = “en_US.UTF-8”
are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database … 642426 files and directories currently installed.)
Removing libluajit-5.1-2 …
Removing libluajit-5.1-common …
Removing linux-headers-3.2.0-70-generic-pae …
Removing linux-headers-3.2.0-70 …
Removing linux-headers-3.2.0-72-generic-pae …
Removing linux-headers-3.2.0-72 …
Removing linux-headers-3.2.0-73-generic-pae …
Removing linux-headers-3.2.0-73 …
Removing linux-headers-3.2.0-74-generic-pae …
Removing linux-headers-3.2.0-74 …
Removing linux-headers-3.2.0-75-generic-pae …
Removing linux-headers-3.2.0-75 …
Removing linux-headers-3.2.0-76-generic-pae …
Removing linux-headers-3.2.0-76 …
Removing linux-headers-3.2.0-77-generic-pae …
Removing linux-headers-3.2.0-77 …
Removing linux-headers-3.2.0-79-generic-pae …
Removing linux-headers-3.2.0-79 …
Removing linux-headers-3.2.0-80-generic-pae …
Removing linux-headers-3.2.0-80 …
Removing linux-headers-3.2.0-82-generic-pae …
Removing linux-headers-3.2.0-82 …
Removing linux-headers-3.2.0-83-generic-pae …
Removing linux-headers-3.2.0-83 …
Removing linux-headers-3.2.0-84-generic-pae …
Removing linux-headers-3.2.0-84 …
Removing linux-headers-3.2.0-85-generic-pae …
Removing linux-headers-3.2.0-85 …
Removing linux-headers-3.2.0-86-generic-pae …
Removing linux-headers-3.2.0-86 …
Removing linux-headers-3.2.0-87-generic-pae …
Removing linux-headers-3.2.0-87 …
Removing linux-headers-3.2.0-88-generic-pae …
Removing linux-headers-3.2.0-88 …
Removing linux-headers-3.2.0-89-generic-pae …
Removing linux-headers-3.2.0-89 …
Removing linux-headers-3.2.0-90-generic-pae …
Removing linux-headers-3.2.0-90 …
Removing linux-headers-3.2.0-91-generic-pae …
Removing linux-headers-3.2.0-91 …
Removing linux-headers-3.2.0-92-generic-pae …
Removing linux-headers-3.2.0-92 …
Removing linux-headers-3.2.0-93-generic-pae …
Removing linux-headers-3.2.0-93 …
Processing triggers for libc-bin …
ldconfig deferred processing now taking place

# df -H

Filesystem Size Used Avail Use% Mounted on
/dev/vda1 16G 12G 4.1G 74% /
udev 385M 13k 385M 1% /dev
tmpfs 79M 254k 79M 1% /run
none 5.3M 0 5.3M 0% /run/lock
none 393M 0 393M 0% /run/shm

 

Wow, huge saver 🙂

Fix Crawl 404 Error on Google Search Console

I just find out that one of my blog got hacked. The intruder put a file in wp-content directory and cause 404 error .

crawl_hacked_page

Wow, huge one (77,630) error.

What I’ve done to fix this error :

  1. Delete the page ; xx-data.php
  2. Select all error from google search console and click ‘Mark as Fixed’
  3. Request xx-data.php removal from Google index

haacked_page

Let see if I see another error. Will update this post soon.

Fix MySQL 113 error

Yesterday I got 113 error code from MySQL when I try to test access it from network.

The machine have 2 lan cards (192.168.103.254 and 192.168.1.89). Both of them are active and I can ping it.

# mysql -ualam -p -h 192.168.103.254
Enter password:
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘192.168.103.254’ (113)
# mysql -ualam -p -h 192.168.1.89
Enter password:
ERROR 2003 (HY000): Can’t connect to MySQL server on ‘192.168.1.89’ (113)

After see the major.io post about MySQL error codes . I find out that the problem might came from firewall.

Check current firewall state :

# cat /etc/sysconfig/iptables

# Generated by iptables-save v1.3.5 on Thu Aug 13 13:13:27 2015
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [389671:206304610]
:RH-Firewall-1-INPUT – [0:0]
-A INPUT -p tcp -m tcp –dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp –dport 8082 -j ACCEPT
-A INPUT -p tcp -m tcp –dport 80 -j ACCEPT
-A INPUT -j RH-Firewall-1-INPUT
-A INPUT -i eth0 -p tcp -m tcp –dport 3306 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp –dport 3306 -j ACCEPT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp –icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p esp -j ACCEPT
-A RH-Firewall-1-INPUT -p ah -j ACCEPT
-A RH-Firewall-1-INPUT -d 224.0.0.251 -p udp -m udp –dport 5353 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp –dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp –dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state –state RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state –state NEW -m tcp –dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT –reject-with icmp-host-prohibited
COMMIT
# Completed on Thu Aug 13 13:13:27 2015

Well, this line :

-A INPUT -j RH-Firewall-1-INPUT

is the source of problem. Edit the order of rule and restart iptables.

# mysql -ualam -p -h 192.168.1.89
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6152
Server version: 5.1.58-log MySQL Community Server (GPL) by Utter Ramblings

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql>

Mission accomplish 🙂

Cpanel tip : Speed up your wordpress with proper PHP version

I don’t have much money for using expensive web hosting or vps or dedicated server for my wordpress blog. Is there any way to speed it up without touch plugin or something else?

Well, using cache is the best way to achieve blazing fast wordpress but one trick I found is using proper PHP version.

Yes, using latest PHP version is dead simple way to make wordpress faster.

By default cpanel user don’t get latest version, for example in my cpanel I see this :

php-cpanel1

For latest PHP version you can refer to php.net site :

php-cpanel2As you can see there are 3 version :

  1. PHP 5.6.11
  2. PHP 5.5.27
  3. PHP 5.4.43

Since I use cpanel I can not compile nor install latest PHP version as I used to using VPS but I can use closest version to 5.6.11.

Click “select php version” under software and services menu.

php-cpanel3

By default native php (the ones that come with server operating system) will be shown.

php-cpanel4

Choose 5.6 from drop down and click save as current.

php-cpanel5

Of course you can choose extensions. Only use the one that you use. For example if you only use mysql then you need to disable pgsql (postgresql) from extension.

How do I know if I already use PHP 5.6?

Create new file using file manager facility and save it as coba.php with these lines :

<?php

phpinfo();

?>

save and open from web browser. If you see like this one then your previous configuration is working well.

php-cpanel6

Testing PHP 7 on Centos 7

PHP 7 already kick the door with its beta2 while HHVM shadow it 🙂

I want to test it with CentOS 7 minimal installation and $5 quick vps installation let me in.

# yum update

# yum -y install nano

# nano /etc/yum.repos.d/php7-nightly.repo

put these lines (from zend).

[zend-php7]
name = PHP7 nightly by Zend Technologies
baseurl = http://repos.zend.com/zend-server/early-access/php7/repos/centos/
gpgcheck=0

# yum -y install lynx httpd php7-nightly

# cp /usr/local/php7/libphp7.so /etc/httpd/modules/

# systemctl enable httpd.service

# systemctl restart firewalld.service

# echo '<?php phpinfo();?>' > /var/www/html/info.php

# systemctl start httpd.service

Test

php7-nightly

Update : Recommended guide for production PHP 7 on CentOS server, click here.

How to enable phalcon php in cpanel shared hosting

Long time not see you guys 🙂 . Being busy with new toys called Phalcon PHP . Yes, this tool is very awesome in my opinion and I use it with my vps. Since this blog also run in vps so I just surprise when I see PhalconPHP also supported in cpanel hosting that I also use.

Yes, namecheap also enable PhalconPHP in their shared hosting package.

How do I know if PhalconPHP work in my cpanel?

Create simple file :

Login to cpanel and click ‘File Manager’ -> New File

phal1

Enter these lines :

<?php
phpinfo();
?>

save the file and access it online.

By default you will not see PhalConPHP extension enabled.

Change PHP version and enable PhalCon PHP extension for Cpanel

Click “Select PHP version”

phal3

Select PHP 5.5 and set this version as current.

Then choose ‘phalcon’ from extension supported list.

phal2

 

Click save.

Then you have working Phalcon PHP support.

Current usage in my namecheap account.

phal4

 

Time to fly with phalcon 🙂

For vps, you refer to this post. (install multiple php on ubuntu 16.04 vps).