Moving users folder and create symlink

Today I got “error, can not write” message on the bottom of my blog. I think its temporary since I often see the message before (with bluehost).

This afternoon I got another message that confirm me if the message is not usual one. The message is sign of storage full. Yes, the blog move to vps and after checking the status :

# df -H
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       8.4G  7.9G     0 100% /
none            4.1k     0  4.1k   0% /sys/fs/cgroup
udev            511M  4.1k  511M   1% /dev
tmpfs           105M  410k  104M   1% /run
none            5.3M     0  5.3M   0% /run/lock
none            522M     0  522M   0% /run/shm
none            105M     0  105M   0% /run/user
/dev/vdb1        22G   47M   20G   1% /data
# cd /

My VPS utilize 100% of / partition (I thought soft limit is there) and lead me to error message.

I forgot if this VPS use two drive : /dev/vda1 for operating system and /dev/vdb1 for data storage.

To fix the problem I just need to move content from /dev/vda1 to /dev/vdb1

# mv /srv/users/ /data/
# ln -s /data/users /srv/
# ls -l /srv/

total 0
lrwxrwxrwx 1 root root 11 Jun 15 14:56 users -> /data/users

Checking current status now :

# df -H

Filesystem      Size  Used Avail Use% Mounted on
/dev/vda1       8.4G  3.6G  4.4G  46% /
none            4.1k     0  4.1k   0% /sys/fs/cgroup
udev            511M  4.1k  511M   1% /dev
tmpfs           105M  410k  104M   1% /run
none            5.3M     0  5.3M   0% /run/lock
none            522M     0  522M   0% /run/shm
none            105M     0  105M   0% /run/user
/dev/vdb1        22G  4.7G   16G  24% /data
#

The service working well now 🙂

WordPress Hack – Manual Cleanup

Hacked wordpress is pain but after get it restored you must cleanup manually a few aspects for optimum performance. To make sure you follow Google rules you can use Google webmaster tools to detect the mess.

Check Crawl Errors

Google Bot will tell error they found during scanning process.

Click Errors then check every aspects (desktop, smartphone and feature phone)

crawl_error

Clean Up

Soft 404 mean Google think its not exist but its do exist.

wordpress_tags

As you see from the picture. WordPress tags put ‘un relevant’ content for your blog.

To get rid of this tags :

1. Login to wordpress

2. Click Tags under Post section

3. Check the box and delete un related tags manually.

Mark as Fixed

Some links might respond slow then Google bot think it doesn’t exist. Check it manually by visit the link and click “mask as fixed” when you’re done.

WordPress Featured Image

“I already upload photo for my post but I see blank display on our website”. That question came from my friend who work as webmaster. He is responsible for updating the news on the office website. I promise to take a look and tell you the answer. Actually I was buying time to figure out what caused the problem.

The site has been running for more than 2 years and no significant problems during this period. That changed only version of wordpress.  I think the reason why the picture features running on the website of my friend’s office was not functioning properly is wordpress.

After look around finally I can reproduce the problem and came back with answer 🙂

How to get wordpress featured image work

Simple, create new post, add post title then fill the content. For featured image you must choose it manually from editor menu.

wordpress_featured_image

This method also work on image slider aka carousel (many theme use it).

I can’t see Featured Image section

Click “Screen Options” to enable it.

How to install OpenBSD in VPS using custom iso

My friend came up with question about OpenBSD. He ask me about possibility of install OpenBSD remotely and continue to manage it for different purpose. I promise to help but due to time constraint I can not visit his house and teach him. I decide to make this post for him but I hope this simple guide will also help others that might face similar problem.

I use vps service from Vultr for this guide since I can use my existing credit and also quick setup process.

Others series that related to custom iso vps :

Upload OpenBSD iso to VPS server

I use Australia for VPS server location so I use nearest OpenBSD mirror close to Australia (Internode amd64 OpenBSD 5.5). This tutorial use OpenBSD 5.5 but you can change the iso file (I’ll update latest iso list when OpenBSD release new version).

Update on May 12 2015:

OpenBSD 5.7 has released. You can use these iso :

  • 64 bit OpenBSD 5.7 iso, (http://ftp.openbsd.org/pub/OpenBSD/5.7/amd64/install57.iso)
  • 32 bit OpenBSD 5.7 iso, (http://ftp.openbsd.org/pub/OpenBSD/5.7/i386/install57.iso)

If you want to use 5.6 release then you can use this iso :

Enter the link on “remote URL” section.

How to install OpenBSD in VPS using custom iso - choose your openbsd iso location file

More

How to install NetBSD on Vultr using custom iso

Today I want to try custom iso feature that Vultr provide. This time I’ll use NetBSD since the size is small and meet Vultr standard (in their range upload size, at the moment its 5192MB max size ).

Preparation ISO file

At this time NetBSD already reach version 6.1 and I choose to download from master.

  • For NetBSD 6.1.5 iso (x86) click here.
  • For NetBSD 6.1.5 amd64 iso , click here.

For NetBSD legacy version:

  • For NetBSD 5.2.3 iso (amd64), click here.
  • For NetBSD 5.1.5 iso (x86), click here.

Click “My ISOs” link.

upload netbsd iso to vultr

Enter the address of iso file (I use NetBSD-6.1.4-amd64.iso) and click Upload button. More

How to migrate Fresh Store Builder to New Server : Digital Ocean way

In this era competition make everything better. Specially in hosting industry. I used to stick on provider host due to :

  1. Price (cheaper is better)
  2. Stability (good uptime is great)
  3. Fast network (low latency is one of signal I see).
  4. Good support (I love friendly and fast support).

Of course rare communication with support mean the service is great.

In this post I’ll show how to move Fresh Store Builder (FSB) from one host to another host. In this case I’ll move FSB I install on Vultr to Digital Ocean. (At the moment both provider give me good impression specially Digital Ocean that I use more than 1 year but Vultr also good since they backed up by Choopa who provide good online gaming infrastructure).

Lets get start migration process.

Create Droplet on Digital Ocean

I use closest location to UK (Vultr way). This time I choose Amsterdam.

fsb_do1

Ubuntu version also same 12.04 x64. More

Optimization Tips for Fresh Store Builder Owner

Last post about how to install Fresh Store Builder (FSB) under VPS using ServerPilot on Vultr lead me to a few things. One of them is optimization. Many FSB owner are non coder and non server folks.

A few things that they can do to optimize the store are :

1. Choosing closest server

If you targeting Amazon UK user then you might want to serve your UK customer using server that located in UK.

If you use Vultr server then you can use UK location.

vultr_server

If you use Digital Ocean then you can choose Amsterdam location.

digitalocean_server

2. Tweaking Server Setting

By default vps server configured by ServerPilot is more than enough for common task but they do provide a few ‘setting’ left for end user (vps owner).

You can check those aspects using gtmetrix page. For example hosting formula store I create yesterday. Gtmetrix score is here :

gtmetrix_hostingformula_store

A few notes from Yslow grade :

yslow_fsb

Click the recommendation for “add expire headers” and I see :

http://platform.twitter.com/widgets.js
https://apis.google.com/js/plusone.js
http://www.google-analytics.com/ga.js
http://connect.facebook.net/en_US/all.js#xfbml=1
https://twitter.com/i/jot?l=%7B%22_category_%22%3A%22tfw_client_event%22%2C%22language%22%3A%22en%22%2C%22client_version%22%3A%221.1%3Am%3Ac%22%2C%22widget_origin%22%3A%22http%3A%2F%2Fstore.hostingformula.net%2F%22%2C%22format_version%22%3A1%2C%22triggered_on%22%3A1401866628263%2C%22event_namespace%22%3A%7B%22client%22%3A%22tfw%22%2C%22page%22%3A%22button%22%2C%22section%22%3A%22share%22%2C%22action%22%3A%22impression%22%7D%7D
http://cdn.api.twitter.com/1/urls/count.json?url=http%3A%2F%2Fstore.hostingformula.net%2F&callback=twttr.receiveCount
https://apis.google.com/js/api.js
https://oauth.googleusercontent.com/gadgets/js/core:rpc:shindig.random:shindig.sha1.js?c=2

That resource is not located in my server and that’s why I can not set the expire from server.

Fortunately all other setting already defined by FSB in .htaccess file.

So far the result is good according to Pagespeed 🙂

Easy VPS for FreshBuilder Store : Vultr Way

I got client who order service for moving his fresh store builder store. He use shared hosting that use cpanel. He don’t want to use cpanel anymore and willing to pay no more than $6/month for his vps server.

I give him two options : using digitalocean or vultr and he choose vultr.

I decide to share experience to hostingformula.net reader on how to build great vps server for freshstore builder user  with minimum hassle 🙂

Create Server on Vultr

Vultr provide vps service start from $5 / month. Fresh Store Builder (FSB) user can use smallest server that Vultr  provide.

1. Login to Vultr and  create an instance

freshbuilder_vps1

Click Deploy New Instance More

Get FreeBSD box up on Vultr

My FreeBSD box on Vultr is up and ready to work. The process is fast too and I don’t have to wait for provisioning like other provider . The closest provider I ever try is Amazon EC2. Running FreeBSD on smallest memory (if I not wrong its 384 MB). In Vultr process is fast and clean :

After create an instance I got this view. Click Manage.

vultr_freebsd1

Looks like the install process use install script and you can see the process by click “view the console” link to get detailed view.

vultr_freebsd2

The process in console took around 4 minutes till I see login box .

vultr_freebsd3

I try to Ping the server

$ ping 108.61.241.143
PING 108.61.241.143 (108.61.241.143) 56(84) bytes of data.
64 bytes from 108.61.241.143: icmp_seq=1 ttl=49 time=279 ms
64 bytes from 108.61.241.143: icmp_seq=2 ttl=49 time=279 ms
64 bytes from 108.61.241.143: icmp_seq=3 ttl=49 time=297 ms
64 bytes from 108.61.241.143: icmp_seq=4 ttl=49 time=286 ms
64 bytes from 108.61.241.143: icmp_seq=5 ttl=49 time=304 ms
64 bytes from 108.61.241.143: icmp_seq=6 ttl=49 time=283 ms
64 bytes from 108.61.241.143: icmp_seq=7 ttl=49 time=302 ms
64 bytes from 108.61.241.143: icmp_seq=8 ttl=49 time=291 ms
64 bytes from 108.61.241.143: icmp_seq=9 ttl=49 time=290 ms
64 bytes from 108.61.241.143: icmp_seq=10 ttl=49 time=289 ms
64 bytes from 108.61.241.143: icmp_seq=11 ttl=49 time=279 ms
^C
— 108.61.241.143 ping statistics —
11 packets transmitted, 11 received, 0% packet loss, time 10011ms
rtt min/avg/max/mdev = 279.245/289.360/304.772/8.593 ms

Try SSH login

$ ssh [email protected]
The authenticity of host ‘108.61.241.143 (108.61.241.143)’ can’t be established.
ECDSA key fingerprint is 06:e1:93:2f:1e:cd:81:88:26:ab:c9:f4:70:d1:cc:e8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘108.61.241.143’ (ECDSA) to the list of known hosts.
Password for root@freebsd-4103:
FreeBSD 10.0-RELEASE (GENERIC) #0 r260789: Thu Jan 16 22:34:59 UTC 2014

Welcome to FreeBSD!

Before seeking technical support, please use the following resources:

o  Security advisories and updated errata information for all releases are
at http://www.FreeBSD.org/releases/ – always consult the ERRATA section
for your release first as it’s updated frequently.

o  The Handbook and FAQ documents are at http://www.FreeBSD.org/ and,
along with the mailing lists, can be searched by going to
http://www.FreeBSD.org/search/.  If the doc package has been installed
(or fetched via pkg install lang-freebsd-doc, where lang is the
2-letter language code, e.g. en), they are also available formatted
in /usr/local/share/doc/freebsd.

If you still have a question or problem, please take the output of
`uname -a’, along with any relevant error messages, and email it
as a question to the [email protected] mailing list.  If you are
unfamiliar with FreeBSD’s directory layout, please refer to the hier(7)
manual page.  If you are not familiar with manual pages, type `man man’.

Edit /etc/motd to change this login announcement.

root@freebsd-4103:~ #

Excellent!

root@freebsd-4103:~ # df -H
Filesystem            Size    Used   Avail Capacity  Mounted on
/dev/label/rootfs0     14G    755M     12G     6%    /
devfs                 1.0k    1.0k      0B   100%    /dev
root@freebsd-4103:~ # uname -a
FreeBSD freebsd-4103 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014     [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64
root@freebsd-4103:~ # cat /etc/rc.conf
# Auto-Enabled NICs from pc-sysinstall
ifconfig_vtnet0=”inet 108.61.241.143 netmask 255.255.255.0″
defaultrouter=”108.61.241.1″
hostname=”freebsd-4103″
sshd_enable=YES
root@freebsd-4103:~ # pkg info
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/freebsd:10:x86:64/latest, please wait…
Verifying signature with trusted certificate pkg.freebsd.org.2013102301… done
Installing pkg-1.2.7_2… done
If you are upgrading from the old package format, first run:

# pkg2ng
pkg-1.2.7_2                    Package manager
root@freebsd-4103:~ # pkg info
pkg-1.2.7_2                    Package manager
root@freebsd-4103:~ #
root@freebsd-4103:~ # top > tes
root@freebsd-4103:~ # cat tes
last pid:   809;  load averages:  0.15,  0.17,  0.12  up 0+00:19:23    14:04:30
19 processes:  2 running, 17 sleeping

Mem: 14M Active, 13M Inact, 38M Wired, 44M Buf, 659M Free
Swap: 2000M Total, 2000M Free

PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
795 root          1  20    0 86084K  6932K select   0:00   0.00% sshd
722 root          1  20    0 23980K  5348K select   0:00   0.00% sendmail
775 root          1  20    0 86084K  6928K select   0:00   0.00% sshd
798 root          1  20    0 23492K  3392K RUN      0:00   0.00% csh
778 root          1  21    0 23492K  3272K ttyin    0:00   0.00% csh
560 root          1  20    0 14424K  2056K select   0:00   0.00% syslogd
729 root          1  20    0 16520K  2148K nanslp   0:00   0.00% cron
809 root          1  20    0 19768K  2532K RUN      0:00   0.00% top
694 root          1  20    0 60816K  6416K select   0:00   0.00% sshd
766 root          1  52    0 14420K  1912K ttyin    0:00   0.00% getty
770 root          1  52    0 14420K  1912K ttyin    0:00   0.00% getty
768 root          1  52    0 14420K  1912K ttyin    0:00   0.00% getty
771 root          1  52    0 14420K  1912K ttyin    0:00   0.00% getty
773 root          1  52    0 14420K  1912K ttyin    0:00   0.00% getty
767 root          1  52    0 14420K  1912K ttyin    0:00   0.00% getty
772 root          1  52    0 14420K  1912K ttyin    0:00   0.00% getty
769 root          1  52    0 14420K  1912K ttyin    0:00   0.00% getty
451 root          1  20    0 13584K  4452K select   0:00   0.00% devd

Virtualization check :

root@freebsd-4103:~ # dmesg | grep -i virtual
CPU: Vultr Virtual CPU 2 (3392.31-MHz K8-class CPU)
sc0: VGA <16 virtual consoles, flags=0x300>
root@freebsd-4103:~ #

Good job vultr 🙂

 

 

 

 

FreeBSD VPS using KVM only $5/month

My first option when install vps server is always FreeBSD but due to budget I was ‘forced’ to choose Linux. Maybe openvz can’t handle FreeBSD and demand is low then you must go with provider that cost around $20 per box.  Compare $5 vs $20 to the box I choose $5 🙂

Lucky I got new provider that give KVM based solution called VULTR. The name is bit strange for me but I knew about choopa. Parent company that deliver vultr.

The website layout is looks like DigitalOcean and use the same virtualization (KVM). Signup process and utilization also close to DO and this approach is good for me as I don’t have to learn how to use it.

freebsd_$5

I’m so exciting with this opportunity and would recommend it to my friends who looking for cheap freebsd box.

I got one box and will update it with tutorial around FreeBSD.

See you soon 🙂

Ps : VULTR surprised me with promotion. I deposit $10 and they match it $10. So I got $20 for at least 4 month experiment using FreeBSD 10. Yippie!

Allow remote access to MySQL server from VPS

Today I have job for backup mysql to other server that specialize on mysql backup online. The job is easy but I think it worth to share for someone out there who want to do same thing 🙂

I’ll use my vps on DigitalOcean and MySQL backup service from mysqlbackuponline.

DigitalOcean

On DO side the steps are :

1. Create database

2. Grant “select” access to the database you want to backup (don’t forget to flush privileges). ex :

grant select on dbname.* to username@’126.220.63.%’ identified by ‘password’;

3. Open firewall access to mysql port, like this :

iptables -A INPUT -i eth0 -p tcp –destination-port 3306 -j ACCEPT

Check if the rule is exist :

# iptables -L -n

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  —  0.0.0.0/0            0.0.0.0/0           tcp dpt:3306

4. Edit /etc/mysql/my.cnf or /etc/my.cnf (position depend on your server operating system)

Make sure “bind-address” section is right. For me comment the line is enough.

5. Restart MySQL server

Mysqlbackuponline

On Mysqlbackuponline side the steps are :

1. Login to mysqlbackuponline

2. Click on + Add New MySQL server

3. Enter all requested information

4. Test Connection

Make sure connection work well “Test connection succeeded”.

backup_db

Test run the job :

11:27:43 AM
Started by a user
11:27:43 AM
Environment version 1.0.0.199
11:27:45 AM
Starting MySql backup…
11:27:45 AM
Using mode (MySQLTcpIpServer)
11:27:45 AM
Creating a backup of the database: backupdb
11:27:47 AM
Server version : 5.0.95
11:30:55 AM
Archived in 0.02 sec
11:30:55 AM
Archive size 66794 bytes
11:30:55 AM
The backup was saved successfully
11:30:55 AM
Backup state was saved (0.02 sec)
11:30:55 AM
Sending email…
11:30:56 AM
Email have been sent to [email protected]
11:30:56 AM
Job finished (Success)

Great service from mysqlbackuponline. Time to schedule it for daily backup.

How to set name server (ns) of your web hosting to a domain

You already buy a domain but forgot how to set name server or you switch to new hosting or you just bought a complete website and need to transfer to your hosting company then you need to know how to set name server.

Name Server Format

If you bought a hosting package (shared hosting or reseller hosting) then you should get email with details. Pay attention to these section :

(example below from certifiedhosting)

NEW ACCOUNT INFO
Domain:yourdomain.com
Username: username
Password: uniquepassword
Hosting Package: GEEK
Server IP: 205.196.23.70
Nameserver 1: DNS1.ICERTIFIED.NET
Nameserver 2: DNS2.ICERTIFIED.NET

Nameserver 1 and nameserver 2 is your friend.

Login to your Domain Registrar

I use namecheap as example. The interface is clean and easy to understand.

Click on “View” link near “number of domains in your account”.

set_dns_namecheap_1

Click Domain name followed by click “Transfer DNS to a Webhost”.

set_dns_namecheap_2

Choose “Specify Custom DNS Servers” and enter value of DNS Servers.

If your web hosting package list till 4 dns servers then you must enter all servers.

Click Save Changes.

Checking DNS Change

You can use intodns.com to track the change you made.

set_dns_namecheap_3

In general any changes to name server will be affected to all internet zone take time (3 days in average, no need to worry if you can not see anything during that moment).

 

Find out specific file (sql file) in vps

2014 is here and happy new year everyone 🙂 . As new year come I want to do ‘clean up’ for some vps and get rid from unused or old file that no longer useful on my vps server. Since the content handle by many side I can not delete many file and only able to delete sql file. The problem is I can not remember where I put the file?

Linux come with ‘find’ command and I can concentrate on “public_html” folder :

$ find public_html -name \*.sql -print
public_html/polling/dbdbd.sql
public_html/polling/pollingdb.sql
public_html/polling/dbdb/bukudb2.sql
public_html/polling/dbdb/bukudb.sql
public_html/home/cometchat/plugins/filetransfer/uploads/bpk.sql
public_html/reservasi/Addons/dbReservasi.sql
public_html/adminphp/scripts/upgrade_tables_mysql_4_1_2+.sql
public_html/adminphp/scripts/create_tables.sql
public_html/adminphp/scripts/create_tables_mysql_4_1_2+.sql
public_html/Hanz/elfinder-2.0-rc1/php/MySQLStorage.sql
public_html/hanz2/fig/figdb2.sql
public_html/hanz2/fig_old/figdb.sql

Wow, at least I know that garbage is exist.

Time to work now.

P.S : other useful command

$ncdu

ncdu 1.7 ~ Use the arrow keys to navigate, press ? for help
— /home/working/public_html ——————————————————
/..
5.4GiB [##########]  public_html2014.tar.gz
2.9GiB [#####     ] /picture
2.2GiB [####      ]/cover                                                                                                                    292.9MiB [          ] /Hanz
246.3MiB [          ] /hanz2

ncdu : NCurses Disk Usage

 

Migrating PHP 5.2.x application from Shared Hosting to VPS

Sorry for not post here for long time 🙂 . Getting busy with teaching and consulting make me forgot about this blog. Today I want to share about my experience dealing with php application that run well on 5.2 version. Client need to migrate it to dedicated server but I suggest to check it on vps first before deploy to dedicated server.

The aim of this job is to create a checklist around installation process, modules and others.

For OS I prefer to use Ubuntu server and I used to get it work for Ubuntu LTS (8.04, 10.04 and 12.04). Simply downgrade current PHP version to use Hardy Heron or 9.10 can save my day but now all those option no longer available since Ubuntu close it.

Further search lead me to Debian. Yes, Debian still give me access to Debian 5 repository where PHP 5.2 exist.

A few important things do before  create the server :

1. Choose cheap but good vps provider. I choose Digital Ocean with their $5/month package.

2, Pick Debian 6, 32 bit . (lighter than 64 bit).

3. Change source.list for these lines :

deb http://ftp.us.debian.org/debian squeeze main
deb http://security.debian.org/ squeeze/updates main
deb http://archive.debian.org/debian lenny main contrib non-free

4. Set priority of PHP only use Leny.

/etc/apt/preferences.d/lenny

Package: *
Pin: release n=lenny*
Pin-Priority: 100
Package: libapache2-mod-php5 php5-dev php5-common php5-curl php5-gd php5-mcrypt php5-mysql php5-cli php5-mhash php5-xsl php5-imap php$
Pin: release n=lenny*
Pin-Priority: 999

5. Install all related lamp package

#apt-get update
#apt-get clean#apt-get install libapache2-mod-php5 php5-common php5-curl php5-gd php5-mcrypt php5-mysql php5-cli php5-mhash php5-xsl php5-imap php5-xmlrpc php5-sqlite

#apt-get install mysql-server

6. Add cache ( I use eaccelerator)

#cd /root
#wget -c http://www.debiantutorials.com/static/eaccelerator-0.9.6.1.tar.bz2
#apt-get install php5-dev make

#rm /usr/lib/php5/build/ltmain.sh
#ln -s /usr/share/libtool/config/ltmain.sh /usr/lib/php5/build/ltmain.sh

#rm /usr/lib/php5/build/libtool.m4
#ln -s /usr/share/aclocal/libtool.m4 /usr/lib/php5/build/libtool.m4

#cd /usr/share/aclocal
#cat lt~obsolete.m4 ltoptions.m4 ltsugar.m4 ltversion.m4 >> libtool.m4

#cd eaccelerator-0.9.6.1/
#phpize
#./configure --without-eaccelerator-use-inode
#make
#make install

Configuration :

#nano /etc/php5/conf.d/eaccelerator.ini

extension=”eaccelerator.so”
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/var/cache/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=””
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

save.

#mkdir -p /var/cache/eaccelerator
#chmod 0777 /var/cache/eaccelerator
#/etc/init.d/apache2 restart

Check through phpinfo().

Extra step to protect from php shell alike : (editing php.ini)

disable_functions = dl , exec , passthru , pcntl_exec , pfsockopen , popen , posix_kill , posix_mkfifo , posix_setuid , proc_close , proc_open , proc_terminate , shell_exec , system , leak , posix_setpgid , posix_setsid , proc_get_status , proc_nice , show_source , escapeshellcmd

Done.

I can get php application work with 5.2 environment 🙂

Switch to PHP 5.4 on BlueHost

I want to learn laravel 4 and find starter kit using github that combine many class from others plus twitter bootstrap.

As traits available on php 5.4 I decide to find a host that support that version. As  I have account on Bluehost I decide to try it. Bluehost provide php 5.2, 5.3 and 5.4. By default you’ll see php 5.2 but you can enable other version. Here’s how to do that :

1. Login to bluehost cpanel

2. Find PHP Config

The option under Software/Services

change_php1

 

Choose PHP 5.4 (single php.ini) and click save settings.

 

change_php2

 

3. Try login via ssh

ssh access not provided by default. You need to request it first via support.

PHP cli will follow the setting. Here’s my login before change the version :

Using username “myacc”.
[email protected]’s password:
Last login: Sun May 12 20:54:42 2013 from 36.69.54.183
[email protected] [~]# php -v
PHP 5.2.17 (cgi-fcgi) (built: Oct 29 2012 18:51:17)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies
[email protected] [~]#

Here’s my login after change PHP version to PHP 5.4 :

Using username “myacc”.
[email protected]’s password:
Last login: Wed May 15 21:51:27 2013 from 180.242.6.211
[email protected] [~]# php -v
PHP 5.4.13 (cgi-fcgi) (built: Apr 5 2013 16:41:50)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
[email protected] [~]#

As simple as 123 🙂

How to check status of dns propagation

Common task when move to new web hosting is changing ns server supplied by hosting company.

ns1.domainname.com

ns2.domainname.com

You must enter those ns to domain control panel and wait. In case of web transfer after where you hired by someone or they little bit worry about the process you can educate them by using these tools :

  1. intodns.com ; this service will check latest ns server that work for a domain.
  2. free dns service ; you can use google public dns or opendns service.
  3. clean dns cache ; you can type ipconfig \flushdns under ms dos command prompt.

By use those tools you can show latest status of domain propagation. In case of slow respond from your dns given by your isp you can ask them to use no.2.

Happy transfering 🙂

A communication error occurred: “Operation timed out” Network Error (tcp_error)

A message came out when one “heavy” php script work :

Network Error (tcp_error)

 

A communication error occurred: “Operation timed out”
The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.
For assistance, contact your network support team.

Easy way to overcome this message is increase maximum execution time.

Create .htaccess file with this content :

php_value max_execution_time xxx

xxx in second, by default the value of this option is 30.

I try to change to 120 :

php_value max_execution_time 120

save the file and recheck it via phpinfo().

Upgrade and refresh WordPress file to do list

Today I move around 20 domain plus its content to new web hosting. Common process that should be accomplished :

On Old hosting account 

  1. Backup database
  2. Create archive of wordpress files + backup database
  3. Scp to new web hosting through ssh

On new hosting account

  1. Extract archive from scp
  2. Create database, user access to database and add user to newly created database.
  3. Import sql file (backup database) to new database.
  4. Edit wp-config.php 
  5. Edit ns record for domain and relax.

As I see on wp-config.php. This file not change from time to time. One of wp-config.php I see from old domain (registered on 2003) :

See that. No salt and no other option as I used to see on new install of wordpress. This file should be change to newest version. Simple way to do that is copy wp-config.php from newest installation and edit its content (specially credentials section). This word add more power and refresh the blog. I should add it to my to list from now on.

 

 

How many domain I can host for shared hosting account

That question came from my friend who decide to use paid hosting after get banned by free hosting provider.

My answer is : depend

If you have only one domain with huge traffic (term huge is more than 1k) then you’ll need to consider one account for one domain. But if you have around 100 uv / day for a domain then I suggest to host maximum 5 domain for one account.

Other factors need to concern are :

  1. Dynamic or static; dynamic type content like wordpress, joomla, drupal will consume more than static html.
  2. Number of process allowed; a few host will give you throttle that put your host in freeze mode. No more access to new visitor until big trafic go away.
  3. Cpu process; extensive resources also prohibited. Make sure to use minimum plugin and use 3rd party service like nrelate that store all related post of your blog on their server.
  4. Language version; people often unaware about php version they use on their shared hosting. Use newest but stable version like php 5.3.xxx
  5. CDN (content delivery network); use font from google, twitter bootstrap from cdn is faster then host it and serve it yourself.

 

Security Tips for Liberty Reserve

Liberty reserve (LR) is one of famous service supported by forex broker. Unlike paypal where you can claim or dispute when you have something wrong with your payment like hacked account or not finished business LR will not take care your claim.

Phishing is the most dangerous threat to LR until I see same page that looks like LR stole my friend money (yes, exact same url) . After investigate and doing a few check I have conclusion about new problem.

DNS Hijack

To prevent yourself from DNS hijack you just need to observe these factors :

1. Always use HTTPS

LR use Amazon aws for load balancing their www page but when you click “login” link you must see https. If you don’t see it then do not proceed to log in.

2. Always use secure DNS

I prefer opendns or google public dns to make sure I get the latest and up to date entry of dns.

Open DNS use : 208.67.222.222 and 208.67.220.220

Google use : 8.8.8.8 and 8.8.4.4

This lesson cost more than $1000 for my friend. He use dns provided by isp and redirect to fake LR page and stole his money from legitimate address but  fake content.

Beware.