Install Ruby 1.9.2 on Ubuntu

By | July 30, 2020

As you all know Ruby is one of the most popular programming language on the web. It is recommended to install ruby 1.9.2 instead of 1.8.x I tried to install ruby from the package manager on Ubuntu, but ruby 1.9.2 is not there in the repo. So, I am going to show you how to… Read More »

How to Check System Load in Php on Linux

By | August 8, 2020

System load System load is a measure of how busy the system is running the processes. Higher system load simply means more processes are running and more are waiting to be run. When coding php applications, it sometimes is useful or necessary to find the current load on the server/system. For example if you want… Read More »

How to enable encoded forward slash in path-info in mvc or CodeIgniter app urls

By | May 16, 2023

Path Info Urls When using path info data , the urls of codeignitor apps or your custom mvc frameworks looks something like this example.com/index.php/controller/method/param1/param2 or example.com/controller/method/param1/param2 The path info data can be used to specify which class and method should be invoked on server application. Forward slash in parameter Sometimes it might so happen that… Read More »

Install php xdebug profiler on ubuntu

By | April 7, 2010

Install Xdebug Install the packages from synaptic package manager sudo apt-get install php5-dev php5-xdebug Configure php to use xdebug extension Locate the path to xdebug.so file martin@martin-dev:/$ find / -name 'xdebug.so' 2> /dev/null /usr/lib/php5/20060613/xdebug.so An alternative command to find the xdebug.so file is using dpkg and grep as follows $ dpkg -L php5-xdebug | grep… Read More »

Cgi bin directory for each user in Apache

By | May 9, 2020

This page http://httpd.apache.org/docs/2.2/howto/cgi.html describes how to give each user his own cg-bin directory. The following lines should be added to the Apache configuration file http.conf : <Directory /home/*/public_html/cgi-bin> Options ExecCGI SetHandler cgi-script </Directory> Along with this there are some more points to be kept in mind. If you .htaccess file has a section like this… Read More »

How to use “path info” with PATH_INFO / ORIG_PATH_INFO in Apache Php Setup

By | May 15, 2023

The PATH-INFO is the extra path data that follows the name of a script (or servlet) in the URL. Its different from query string. Here is a classic example: https://www.examples.com/index.php/some/path?a=b Now, over here we are actually invoking the script index.php only. However also providing some path-info data “/some/path”, which is then followed by the query… Read More »

How to List foreign keys in Mysql

By | November 14, 2023

information_schema The following query will list out the foreign keys in mysql. It finds it out from the information_schema database. select concat(table_name, '.', column_name) as 'foreign key', concat(referenced_table_name, '.', referenced_column_name) as 'references' from information_schema.key_column_usage where referenced_table_name is not null; The output is a clean table listing out all foreign keys from all databases +———————–+————-+ |… Read More »

Create foreign key using Phpmyadmin

By | May 9, 2020

The innodb storage engine supports foreign keys in Mysql. To create foreign keys in phpmyadmin : 1. Convert both tables into innodb, if they are not already. 2. View the structure of the table which will have a foreign key. Make the referencing field an INDEX. 3. Now come back to structure view and click… Read More »

Create AutoIncrement column/field in Apache Derby

By | July 6, 2009

While creating a table a particular column / field can be made autoincrement as : CREATE TABLE students ( id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), name VARCHAR(24) NOT NULL, address VARCHAR(1024), CONSTRAINT primary_key PRIMARY KEY (id) ) ; The value of an autoincrement column increments automatically with… Read More »

PHP redirect – go back to previous page

By | September 1, 2023

To go back to the previous page the superglobal variable $_SERVER can be used. $_SERVER[‘HTTP_REFERER’] has the link to the previous page. So to redirect simply : // Method to go to previous page function goback() { header("Location: {$_SERVER['HTTP_REFERER']}"); exit; } goback();