Cheap|Bargain|Low cost dedicated Linux|CentOs servers

2012/12/12 26 comments

Several days trying to find a reliable dedicated linux server and found a lot of offers, but these are the best according to monthly fees and Gb RAM:

  • kimsufi/ovh 2Gb => 15$
  • 2Gb => 20$
  • sagonet 2Gb => 24$
  • server4you 4Gb => 30$
  • 8Gb => 38$
  • 4Gb => 38$
  • 1and1 2Gb => 40$
  • sagonet 4Gb => 50$
  • 4Gb => 50$
  • serverpronto 2Gb => 50$
  • 2Gb => 50$
  • hostinganddesigns 1Gb => 50$
  • dinahosting 2Gb => 52$
  • 16Gb => 65$
  • godaddy 2Gb => 78$
  • 4Gb => 80$
  • 2Gb => 90$
  • serverbeach 4Gb => 130$
  • hostgator 4Gb => 175$

I hope you find this data useful. If you know a company offering better prices, please, let me know. Thanks!


PHP time function, ISO 8601

2012/10/09 1 comment

This is a PHP time function according to the output format specified by ISO 8601 (yyyy-mm-dd hh:mm:ss):

function time_iso8601() {
$timearray = getdate(time());
return sprintf("%04d-%02d-%02d %02d:%02d:%02d", $timearray['year'], $timearray['mon'], $timearray['mday'], $timearray['hours'], $timearray['minutes'], $timearray['seconds']);

Categories: PHP, Snippets of Code Tags: , , ,

PHP function to convert seconds into human readable format: months, days, hours, minutes, …

2012/08/25 7 comments

This is a simple PHP code that converts a number of seconds into a string according to the following format: M d h m s.

function seconds2human($ss) {
$s = $ss%60;
$m = floor(($ss%3600)/60);
$h = floor(($ss%86400)/3600);
$d = floor(($ss%2592000)/86400);
$M = floor($ss/2592000);

return "$M months, $d days, $h hours, $m minutes, $s seconds";

Number of months is an approx calculation supposing months are 30 days long.

Categories: PHP, Snippets of Code

NOW() function in SQLite

2012/08/14 1 comment

NOW() function does not exist in SQLite. Instead use datetime(‘NOW’,’localtime’) as in the example:

<?prepare("SELECT datetime('NOW','localtime') AS now");
if (!$result) { echo "\nError SQLite::errorInfo(): "; print_r($dbsqlite->errorInfo()); }
$data = $result->fetchAll();
$now_SQLite = $data[0][0];
$dbsqlite = NULL;
echo "\nSQLite Time: " . $now_SQLite;

Categories: PHP, Snippets of Code Tags: , , , ,

How to install PHP 6 on CentOS 6

2011/11/08 Leave a comment

How to install PHP6 on CentOS6: These are the Linux commands required to install latest PHP source code into a CentOS 6 LAMP server, and several useful libraries as: GD, Curl, Tidy, JSON, SQLite, PSpell, …

yum install wget
wget ""
tar -jxvf php-trunk-201111071530.tar.bz2
cd php-trunk-201111071530
yum groupinstall "Development Tools"
yum install libxml2 libxml2-devel
yum install httpd-devel
yum install pcre pcre-devel
yum install bzip2 bzip2-devel
yum install gmp gmp-devel
yum install tidy libtidy libtidy-devel
yum install curl libcurl libcurl-devel
yum install libjpeg libjpeg-devel
yum install libpng libpng-devel
yum install libXpm libXpm-devel
yum install freetype freetype-devel
yum install aspell aspell-devel

./configure –build=x86_64-unknown-linux-gnu –host=x86_64-unknown-linux-gnu –target=x86_64-redhat-linux-gnu –program-prefix= –prefix=/usr –exec-prefix=/usr –bindir=/usr/bin –sbindir=/usr/sbin –sysconfdir=/etc –datadir=/usr/share –includedir=/usr/include –libdir=/usr/lib64 –libexecdir=/usr/libexec –localstatedir=/var –sharedstatedir=/var/lib –mandir=/usr/share/man –infodir=/usr/share/info –cache-file=../config.cache –with-libdir=lib64 –with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d –disable-debug –with-pic –disable-rpath –without-pear –with-bz2 –with-exec-dir=/usr/bin –with-freetype-dir=/usr –with-png-dir=/usr –with-xpm-dir=/usr –enable-gd-native-ttf –without-gdbm –with-gettext –with-gmp –with-iconv –with-jpeg-dir=/usr –with-openssl –with-pcre-regex=/usr –with-zlib –with-layout=GNU –enable-exif –enable-ftp –enable-magic-quotes –enable-sockets –enable-sysvsem –enable-sysvshm –enable-sysvmsg –with-kerberos –enable-ucd-snmp-hack –enable-shmop –enable-calendar –with-sqlite3 –with-libxml-dir=/usr –enable-xml –with-system-tzdata –with-apxs2=/usr/sbin/apxs –with-mysql –with-gd –disable-dom –disable-dba –without-unixODBC –disable-pdo –disable-xmlreader –disable-xmlwriter –disable-phar –disable-fileinfo –enable-json –with-pspell –disable-wddx –with-curl –disable-posix –disable-sysvmsg –disable-sysvshm –disable-sysvsem –enable-mbstring –with-mysqli –with-tidy

make install
sed -i ‘/^LoadModule php5_module/ s/^/#/’ /etc/httpd/conf/httpd.conf
service httpd restart

What is Web 3.0?

2011/10/25 3 comments

What is Web 3.0? Web 3.0 is a compound of new technologies:

Web 3.0

Web 3.0

  • RIA: (Rich Internet Application) is the new elements to build stylish fancy-looking websites. Using HTML5, Javascript (AJAX and frameworks) Adobe Flash, Microsoft Silverlight, new websites are going to improve its visual impact becoming very “Cool”.
  • Mobile: Android and IPhone are leaders in this new trend and voice interfaces (Speech recognition and TTS, Text To Speech) are going to make very easy to interact in the Web.
  • Semantic Web: There are 3 related but different technologies that may be called SemWeb:
  • SemWeb::NLP: Using Natural Language Processing, Search Engines will try to figure out the meaning of a query and match it against the meaning of the unstructured text inside webpages. This technology will increase the relevancy of the search engines results, but very few people takes seriously this option because it requires a great Artificial Intelligence effort to make it real.
  • SemWeb::New Tags: RDFa, Microformats and Microdata will make more explicit to machines data about the author of a website, the document, your geolocation, etc. This technology will make easier to find you and all your related staff with one click.
  • SemWeb::Ontologies: Through new standards like RDF, OWL, SPARQL big databases will be online and “queriable”. This technology will let you book a flight without effort thanks to automated agents that will do the boring job.
  • Cloud Computing: Transferring your phone or computer Operative System to Internet (WebOS), will let you forget about installing and upgrading your software. Everything (even your data) will be on the Net ready to be used.

The consequences of reaching this new technology stage will be the following, in my humble opinion:


  • Cooler than ever web sites and applications. Stylish interfaces and fancy visuals.
  • Easier to participate in Internet. Everybody will be able to upload content in the Web just pressing a button in the phone. A picture or a sound recorded will become part of the Web instantly. Twitter will explode.
  • Personalization: As Web applications will always know your profile, thanks to all these new technologies, login will no be needed anymore, and all the contents sent to you will be filtered according to your profile.


  • Lost of privacy: every web application will know who you are.
  • Network dependency: your favorite phone or computer application will not run under bad signal reception.
  • More standards, less creativity. Author’s contents will be restricted to what standards consider right to do. If your data don’t fix into mainstream ontologies, forget about sharing it.
  • Lost of control: If you book a flight for tomorrow, maybe your flight will take off today. A stack of automated agents will care to avoid that happen. Will you trust them?
  • Lost of quality in contents: Billions of phone users uploading funny pictures and weird sounds to the Web may imply a drastic reduction of the quality of Web contents.

Well, I would like to hear your opinions too.

A Web Search Engine, SQL or NOSQL?

2011/08/23 1 comment

I am trying to build a Web Search Engine with modest resources and targets. Just using one dedicated server running on LAMP environment I would like to reach the target of indexing 5 million web pages, limited to one language (Spanish), and deploying search results in less than 0.1 seconds.

Probably the most important strategy to consider in this enterprise is how to store the information. Search results speed and insertion times depend on it. I find there are two main options to consider: An SQL engine and a NOSQL engine.

In either case I am implementing both on MySQL. In the first case relational structure of MySQL is in use, meanwhile in second case I use MySQL simply as an store engine, capable of saving records and serving them to a client.

In the first case, SQL orthodoxy tells us to create a table for storing pages, another one for storing keywords and finally a big one to store the instance of a keyword on a page. We may call that table as “keypag”. Considering we are indexing 5 million web pages that contain an average of 100 distinct words each one, it means a cardinality of 500 millions for keypag.

In the second case, NOSQL schema, we just need one table called “keywords” with a row for every possible keyword on the corpus (the set of crawled web pages). We may apply here an estimation of cardinality for this table around 1 million rows, taking into account than we are dealing with just one language, and filtering contents through a dictionary before indexing. Table keywords has a big field (around 60 Kbytes long) that contains the ordered matches in web pages for that keyword. Around 100 URLs and snippets can be stored on that field.

In SQL schema, a search means an SQL query returning between 10 and 100 rows from a table “keypag” that has a cardinality around 1 billion. In NOSQL schema, a search means an SQL query returning just one row from a table “keyword” that has a cardinality around 1 million.

So, theoretically we could expect best search performance in NOSQL than in SQL schema. Doing some benchmarks, we may proof that to be correct. Let’s see the resulting graphs:

* SQL performance (someone should reach 1 billion rows if patient enough. I stopped at 11 millions):

* NOSQL performance:

Pink dots represent the time it takes to MySQL to resolve a search query in miliseconds. Blue dots represent how may inserts per second is capable of doing MySQL.