SpotVPS First Impressions

After the unfortunate incident last week with NordicVPS, I decided to look for a new VPS host. As usual, I went to lowendbox and get the reviews in webhostingtalk. It’s there where I stumbled upon a promo from SpotVPS. As it turns out, SpotVPS is a low-cost VPS offering of ComfortHost.NET.

And who are they? Here’s what they say about themselves.

ComfortHost.NET have been here since 2004 offer high quality web hosting solutions. All SpotVPS nodes are fully owned hardware and are colocated. All servers used by SpotVPS have been bought with internal cash. Our only monthly cost for these servers are the actual colocation. We are financially healthy and profitable since day one. We are NOT going out of buisness any time soon. We are in it for the long run!

ComfortHost on http://www.webhostingtalk.com/showthread.php?t=1110770

Here’s the plan that I got.
$6.99/mo Ultimate Plan
Memory: 2048mb (2gb)
HD Space: 50gb (50,000mb)
Bandwidth: 1,000gb (1TB)
Monthly Price: $6.99/mo
Setup Fee: FREE!
FREE GIGABIT PORT – FREE WEEKLY BACKUPS – FREE HARDWARE RAID
Location: Orlando, FL at DimeNOC
Test IP Address: 72.29.87.105

2GB RAM for $6.99. That’s sweet. Want to try it yourself? ORDER NOW

Word of caution,though. This plan (and all other dirt-cheap vps that I know of) comes with very limited support. You are usually given your VPS, IP and OS install and you have to do the rest. I installed mine with NGiNx, PHP, MySQL and it’s already up and running for 7 days straight now.

Here’s the result of the test I made on my VPS.

[root@vps ~]# dd if=/dev/zero of=test bs=64k count=16k conv=fdatasync
16384+0 records in
16384+0 records out
1073741824 bytes (1.1 GB) copied, 14.9939 seconds, 71.6 MB/s

[root@vps ~]# wget cachefly.cachefly.net/100mb.test
--2011-11-24 18:10:35-- http://cachefly.cachefly.net/100mb.test
Resolving cachefly.cachefly.net... 205.234.175.175
Connecting to cachefly.cachefly.net|205.234.175.175|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 104857600 (100M) [application/octet-stream]
Saving to: `100mb.test'

100%[==============================================================================================================================>] 104,857,600 66.8M/s in 1.5s
2011-11-24 18:10:36 (66.8 MB/s) - `100mb.test' saved [104857600/104857600]

I’ll try to come up with a review together with my other hosting providers. :)

Incoming search terms:

  • spotvps
  • cachefly vps
  • comforthost spotvps
  • spotvps coupon
  • spotvps net
  • vps cachefly test
  • vps wget 10 mb test file

LAMP Install on VPS : CentOS5+Apache+MySQL+suPHP

Here’s the work-in-progress instructions for setting up a LAMP. It’s been sitting on my draft for ages and I have to publish it because a few of my friends need it.

**** NOTE : If you notice, it’s still a draft. It came from a number of sources but these are the steps I use. So I know it works. **********

[Read more...]

Incoming search terms:

  • centos 5 lamp install
  • setup proftpd vps centos
  • stop suphp
  • suphp configuration centos apache
  • suphp lamp
  • touch /var/lock/subsys/proftpd
  • vps centos how to instyall php version 5
  • yum -y mysql
  • yum install php3
  • yum upgrade apache centos

Automatically Convert Emails to NoSpam

To prevent spam comments on one of the sites that I maintain, I send for approval any comment with at least one URL or email address in it. In that way, manual spammers will find no incentive on leaving comments on the site. At the same time, email addresses left by commenters will not be displayed in the site until it is sanitized. However, the amount of comments in the site in question is so many and manually sanitizing comments with emails is becoming a pain.
[Read more...]

Incoming search terms:

  • emailsafe jquery
  • \ [a-z0-9][a-z0-9_-]*

Upgrading to PHP 5.3 for CentOS

I wanted to try WordPress 3.2 beta but realized that it requires at least PHP 5.2 and I’m still with 5.1.6 (the one that comes with CentOS). Here’s what I got from the interwebs.

Step 1: Get webtatic PHP 5.3 Repository
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

Step 2: Update PHP
yum --enablerepo=webtatic update php

Step 3: Verify PHP version
php -v

Expected result should be like below

PHP 5.3.6 (cli) (built: Mar 19 2011 08:30:07)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

*** NOTE ***
Though webstatic stated that the repository is created for CentOS 64bit, it still worked for my 32-bit installation.

Source:

http://www.webtatic.com/packages/php53/

Incoming search terms:

  • webtatic php 5 3
  • centos 5 7 php 5 3 repo
  • php53 centos webstatic
  • repo webstatic
  • repository php 5 3 9 on centos 6
  • update php 5 1 to 5 3 centos 64bit
  • update php 5 3 webstatis
  • update php to 5 3 centos 64 bit
  • upgrade php 5 3 centos64
  • use webstatic php webtatic

Shopping Cart Always Empty

After using suPHP on my Apache webserver and NGINX on another server, I realized that my cart systems are no longer working. Here are the symptoms I noticed.

  1. AJAX Carts does not display items
  2. When clicking checkout, the cart becomes empty
  3. After clicking update, the cart becomes empty

If you look at the symptoms, you’ll notice that every time you move to another page of your website, the cart is emptied. It only mean that the session data is not being saved. And with that, you’ll have to check your PHP save_path session settings in PHP.INI. Most often than not, the current value is /etc/php/sessions. You’ll have to check the folder permission. On my case, the folder is owned by root and the group is apache.
[Read more...]

Incoming search terms:

  • shopping carts always show empty
  • suphp session save_path
  • value session save_path is empty wordpress

NGINX – 502: Bad Gateway

One of my VPS on NordicPVS went down today and after restarting, I got a number of weird errors. Apparently, the contents of my VPS were wiped-out. Though I managed to solve most of the problems (mostly by restoring the backup), I kept getting the 502: Bad Gateway error. I told myself that this can’t happen because I restored the whole system from the backup already.

After going through a checklist, I found out that PHP CGI is not running. All I had to do is jumpstart it and everything is working as before.

/etc/init.d/php_cgi start

[Read more...]

Incoming search terms:

  • nginx bad gateway
  • 502 bad gateway nginx solved
  • 502 bad gateway nginx wordpress
  • nginx 502 bad gateway wordpress
  • wordpress nginx 502
  • phpfog bad gateway nginx
  • virtualmin nginx bad gateway
  • vps 502 bad gateway
  • vtiger nginx bad gateway
  • woirdpress login 502 bad gateway

Datetime value to string in PHP

This one escapes me everytime I need which results to much googling. The function is to convert SQL datetime value to human-readable format.


/* 
*   Converts the likes of '2010-08-01 14:57:15' to 'August 1, 2010, 2:57 pm' 
*/  
$datetime_value ="2010-08-01 14:57:15";
echo date(  "F j, Y, g:i a", strtotime( $datetime_value ) );  

Here’s another example which you will see on some of my templates.

<?php echo date('Y-m-d', strtotime('next month')); ?>

For more formats, go head to PHP Doc.

Reference:

http://php.net/manual/en/function.date.php

Incoming search terms:

  • php date to string
  • php datetime tostring
  • date to string php
  • php datetime to string
  • datetime tostring php
  • datetime to string php
  • php convert date to string php
  • php convert date tostring
  • php date time value
  • convert date to string in php

How to Get Apache & PHP version in Shell

Aside from using phpinfo(), you can also use some shell commands to view the apache or php versions you are using.

NOTE: This is in CentOS 5.
[Read more...]

Incoming search terms:

  • php version shell
  • apache versione php shell
  • shell php version
  • shell httpd version apache
  • shell aktuelle version php
  • se your phpversion shell
  • php version in apache shell
  • php get version from shell
  • linux shell apache version
  • how to get php version

Adding New Array Key in PHP

In adding a new array key, we’ll need to know two array functions called array_key_exists and array_merge.

First, let’s take a look at array_keys. It’s a function that returns an array containing the keys of an array.

<?php
$a = array("foo"=>"1","bar" => "2");
$keys = array_keys($a);

print_r($keys);
?>

Second, of course, is array_merge. As the name implies, it just merge the two array.

<?php
$a = array("foo" => "1", "bar" = "2");
$b = array("name" => "Juan", "gender" => "male");
$c = array_merge($b, $a);

print_r($c);
?>

So here’s the final code we have.

<?php
$a = array("foo" => "1", "bar" = "2");
// keys to be added
$b =array("name" => "Juan");
$c =array("gender" => "male");

$a = array_merge($a, $b, $c);

print_r($a);

?>

The code above is too simplistic ( we didn’t even use the array_keys function) but if you are not certain with the keys you of the array to be merged, then this functions become handy. Example as below.

<?php
$a = array("foo" => "1", "bar" = "2");
/* let's say $b comes from a function that returns
array with (i.e, array("name" => "Juan", "gender" => "male"))
*/
$b = my_function_ret_array();

$keys = array_keys($b);
foreach($keys as $key){
if(array_key_exists($key, $a){
$a[$key] = $b[$key];
}
else {
$a = array_merge($a, array($key => $b[$key]));
}
}

print_r($a);

?>

Again, I must remind my readers that there might be better way of doing this. It all depends on the situation and for the time being, this is the functions I used. If you want to suggest a new one, please share it in the comment box.

Incoming search terms:

  • php new array
  • add new key to array php
  • $array_key mysql
  • php array add new
  • php array create new key
  • php array insert new key
  • php array new
  • php array new key
  • php create new key in array
  • php new key in array

How to Find PHP.INI Path

If you can’t find it in /etc/php.ini, then you have to use ssh and execute the command below.
php -i | grep php.ini

The command will return something like
Configuration File (php.ini) Path => /etc/php.ini