Tuesday 4 August 2015

Setting up LAMP WordPress on Amazon AWS EC2 Ubuntu



Because of our earlier exposure to Ubuntu we have been always comfortable working on it because of this when we had to recently setup WordPress site for our customer on Amazon Web Services Ubuntu was the first choice. Most of the content on the web is more for Amazon’s flavour of Unix because of which some steps can become cause problems.

Problems I encountered were:
  • Wrong version of PHP got installed by default PHP apt-get package manager command.
  • Wrong version of MySQL got installed by MySQL default apt-get package manager command.
  • Above things lead to PHP page not showing up on browser.

Although these issues got resolved quite quickly when I found that version incompatibility was the major issue, had to uninstall MySQL & reinstall 5.5 version.

Following commands & steps were followed to complete Apache, MySQL, PHP & WordPress installation:

Apache:
apt-get install httpd

PHP:
apt-get install php5-gd
apt-get install apache2 php5 libapache2-mod-php5

Check PHP:
php -r ‘echo “\n\nYour PHP installation is working fine.\n\n\n”;’

MySQL:
apt-get install mysql-server
apt-get install php5-mysql
apt-get install mysql-client-core-5.5

/etc/init.d/mysql status
/etc/init.d/mysql start
/etc/init.d/apache2 restart

MySQL db:
mysql -u root -p

WordPress:
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
Add your db details to: ~/wordpress/wp-config.php

PHP Package Manager – Composer for Laravel Projects



At Logitia we came across PHP Package Manager – Composer while experimenting with Laravel 5. Needless to say we totally were enchanted by its ease of use and capabilities. We had used node.js package manager NPM in the past for our various Cordova – Ionic projects and found Composer to be almost as easy to use. With support of packagist.org (packagist- main Composer repository) it was easy to find required modules and then manually add them to composer.json or provide command line argument. Version dependency was also easy to manage with packagist & composer combination.
Greatest benefit for us was that it made setup on a new machine very simple, just running composer install, composer update would sync up the machine with all dependencies. New developer would just download code from our BitBucket repository using SourceTree and sync dependencies with Composer. That’s it and he would be good to go.
I especially like the Composer logo, the composer seems to be so much into it :-)

WhatsApp not to provide Public API


It seems WhatsApp will not be providing developers any API to write apps on top of it. This is contrary to Facebook’s approach towards its own messenger service which its trying to develop into full fledged gaming, messaging, etc platform. How will this leave WhatsApp to compete with ever growing Telegram messenger which I personally prefer ?
This also limits user experience to only what Facebook/WhatsApp can imagine and develop, all the development creativity out there gets no role to play in the progress of WhatsApp which is quite sad. In Telegram I use Bots which are developed using its API, they provide quite exciting features, also it provides interface on all platforms rather than just web based interface on desktop.
The race is on I guess, probably it could be Facebook’s internal strategy to curtail growth of WhatsApp, who knows :)

Laravel 5.1



Very excited about Laravel 5.1, we have been using Laravel 5 for sometime now. One of our major project is built in Larvale 5. We primarily used these Laravel capabilities:
  • Handling ajax and restful requests
  • Built-in, as well as sentry based authentication and role-based authorization
  • SMTP, Sendgrid and Mandrill based emails
  • Complex form request validations and custom error messaging
  • Laravel tinker tool, collections, query and schema builders, Eloquent ORM, database seeding and test data generation using PHPFaker
  • Complex blade templating using inheritance and sections
  • Flash messaging with popup bootstrap dialogs for better error messages
  • File upload and downloads to local as well as S3 data stores
  • PDF generation using blade templates
  • Datagrid Integration with Laravel (either using jQuery datagrids or custom datagrid components like Cartalyst datagrids),
  • Data caching using Redis and file based caches
  • Laravel scheduler for job scheduling and Laravel command bus
  • Unit & Integration testing using PHPUnit
  • AWS deployments using EC2 and S3
Now in Laravel 5.1 Commands are being renamed as Jobs, we used Commands to build our scheduled jobs which cron executed. Jobs seems to be a better name as it is more intuitive but it also means we’ll have migration overhead.
We had tough time getting SMTP based mail working, finally had to settle for Mandril HTTP based mail service, would need to check whether this works better/easier now. Although I suspect it might not be as such Laravel issue.
Another addition is better documentation which it kind of overwhelming because Laravel documentation combined with laracasts was already amongst the best. I did not have any wish list for documentation on top of that if it has been made better then I am very pleasantly surprised.