skip to Main Content
+971 55 881 1725 hmimthiaz @ imthi.com

Symfony: Adding custom route by code during runtime

During development we always come across situation where you need to add custom routes based on some settings based from the user. In this case we cannot use any of the standard methods like annotation and configuration files in symfony.

In this case you need to use a services and hooks to inject your custom route rules during runtime.

1) In your bundles under Resources\Config\services.yml add the following

2) Now we need to create a class RoutingService.php

3) Now in your main routing.yml please include these lines

4) Once you are done please make sure you clear cache both env

5) Now the custom route should be loaded in.. Please make sure if you add more routes make sure the cache is cleared.

WHM / cPanel – Compile PHP 5.3 to work with PHP 5.2

This is one of major issue lot of web masters face now. As PHP 5.2 has reached end of life we are forced to seek options to migrate and test PHP applications in PHP 5.2 and 5.3. Raj COO from WebHostRepo.com has posted a nice blog post on how to achieve this.

Running PHP 5.3 along with PHP 5.2.x in cPanel servers.webhostrepo

I did all the steps as mentioned on the blog post except for one, I had a lengthier configure statement 😉

Install ZendGuardLoader

Edit /usr/local/php53/lib/php.ini and add these lines to end

Happy migration 😉

Compile PHP 5.3.19 on CentOS 6.3 with Curl 7.28

new-php-logo

For this installation I choose CentOS 6.3 minimal version. You can download the ISO from the mirrors or direct download it from SYNc yourself. Once the CentOS installation is completed make sure you are connected to Internet to update the latest libraries.

 

Note: These steps are done assuming you are logged in as root user

1. Please update the available updates for the OS and restart

2. Install EPEL (Extra Packages for Enterprise Linux) so that you can get all the needed libraries for compiling PHP

3. Install Development Tools – Detailed User Guide

4. Install MySQL Database client

5. Install the following libraries which are required for different modules in PHP. Please make sure all the dependencies are met before installation

6. For this installation I planned to use the latest version of curl so I had to my custom curl compilation

7. Download and compile PHP 5.3.19

8. Copy php.ini

9. Edit Apache conf check if “LoadModule” is present else add it.

LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so

10. Set handler for Apache to handle PHP files

11. If you are not planning to install ZendGuardLoader skip to step 13 else make sure you have disabled SElinux. Detailed instructions

12. Install ZendGuardLoader

Edit /usr/local/php-5.3.19/lib/php.ini and add these lines to end

13. Restart you apache and you are set

It took a great deal of time to make this work and with lot of trial and errors. If anyone finds a better way to compile please do share it with me. All the best 😉

VirtualBox web interface with phpVirtualBox

This weekend I had some time to spend with VirtualBox. VirtualBox is a cross-platform virtualization application. This helps you to run various operating system as virtual machine. This is the concept that is adapted by most of the companies which offer us cloud computing. Recently I came to know that VirtualBox has built in Web service with which we can control the virtual instances remotely. My immediate reaction was to search for some open source solution which uses web service of VirtualBox. phpVirtualBox came to rescue. It has full fledged features which can be use used to control VirtualBox installed in a server.

phpVirtualBox – An open source, AJAX implementation of the VirtualBox user interface written in PHP. As a modern web interface, it allows you to access and control remote VirtualBox instances. Much of its verbage and some of its code is based on the (inactive) vboxweb project. phpVirtualBox was created for people (like me) who prefer not to have to log in to their headless VirtualBox host to administer their virtual machines.



To make it work in Mac I had to install the latest beta version of phpVirtualBox (4.1-1b) for VirtualBox (4.1.2). The current stable version had some issues with authentication. However, phpVirtualBox has wiki which helps to install and configure the web application. If you encounter any issues please refer to common errors in phpVirtualBox wiki.

Happy journey with virtualization 🙂

Facebook Open Graph Meta WordPress Plugin

Today I wanted put Facebook Open Graph Protocol meta tags on my blog. I searched for a long time and I was not able to get a simple and working plugin for WordPress. So I decided to write my own. If you want use this plugin please make sure you replace the tag [REPLACE] with appropriate values.

This plugin is already activate on my blog. If anyone shares or likes a link from my blog it will have all full details on facebook 😉

Download Facebook Open Graph Meta WordPress Plugin

  • 1
  • 2
Back To Top