Dummies guide to LAMP setup on linux :)

Hello everyone,


Recently I came across several nifty apt-get commands that quite handy and if used properly can be a life saver while setting up LAMP stack on your system.


Step 1 : One line LAMP setup on linux -

  1. sudo apt-get install lamp-server^



Step 2 : Setup phpMyadmin to manage your mysql databases -

  1. sudo apt-get install phpmyadmin



Step 3 : Setup xdebug and integrate with php5 installation -

  1. sudo apt-get install php5-xdebug



Step 4 : Setup cURL -

  1. sudo apt-get install php5-curl



After the above command finishes installing curl do the following -

  1. cd /etc/php5/conf.d/
  2. sudo gedit xdebug.ini



After opening the file in gedit, add the following lines at the end of the file then save and close it.

  1. xdebug.remote_enable=On
  2. xdebug.remote_host="localhost"
  3. xdebug.remote_port=9000
  4. xdebug.remote_handler="dbgp"



The following step is helpful for those who later want to integrate andorid SDK, because only Sun JDK is supported when running the android SDK app, is handy if you use it.


Step 5 : Setup sun -

  1. sudo apt-get install sun-java6



Step 6 : Enable Rewrite Module for PHP -

  1. a2enmod rewrite





The above will do a smooth install of a functioning LAMP server on the system :D , comments and queries are always welcomed.


thanks,

faisal ahmed

web application developer
web: http://www.faisalbd.com/
email: thephpx(at)gmail(dot)com

Share

Google Oauth2 library for CodeIgniter framework

Hello everyone,

I am back with google oauth2 integration library this time. Before you use the google oauth2 library you must have a google application registered so that you have access to api client id and client key which you will need to use it.

Also the redirect url must match your application location. Otherwise google does not provide access to the api. So, best way to test the code is to test it on a live site.

I am not going to go through the code here as I have commented the code well enough for you to understand :)

For any extra query feel free to comment.

DOWNLOAD THE LIBRARY

thanks,

faisal ahmed

web application developer
web: http://www.faisalbd.com/
email: thephpx(at)gmail(dot)com

Share

Codeigniter: Helper for template library dynamic view partial loading

Hello everyone,

I have recently been in quick-fire blogging mode. After playing with the superb template library developed by Phil Sturgeon.

The following template helper is the outcome of tweaking that makes life easier while setting up view partials and calling them inside the layout dynamically. The helper also has an add-on use which gives user the option to use region specific partial loading.

Controller:

welcome.php

$partial_list[]['region'] = 'left';
$partial_list[]['name'] = 'category';
$partial_list[]['view'] = 'partial_category';
$partial_list[]['region'] = 'right';
$partial_list[]['name'] = 'login_box';
$partial_list[]['view'] = 'partial_login';

/* following functionautomatically sets the partials
* based on the above array and also passes $partial_list
* variable to the view.
*/

/*
* make sure the pareser helper is loaded before
* calling this function
*/

setup_partials($partial_list);

$this->template->set_layout('home_layout');
$this->template->build('home_view');


Layout:

home_view.php

<html>
<head>
	<title><?php echo $template['title'];?></title>
</head>
<body>
	<div class="left">
		/* Will show only partials with region set as left */
		<?php show_partials('list', 'left', $partial_list, $template); ?>
	</div>
	<div class="mid"><?php echo $template['body'];?></div>
	<div class="right">
		/* Will show only partials with region set as right */
		<?php show_partials('list', 'right', $partial_list, $template);?>
	</div>
</body>
</html>

Detail about the usage can be found in the actual helper file, also feel free to comment here and I will try my best to help out.

Download Helper:

DOWNLOAD PARSER HELPER

thanks,

faisal ahmed

web application developer
web: http://www.faisalbd.com/
email: thephpx(at)gmail(dot)com

Share

Setup xdebug on LAMPP

I am assuming the reader already has LAMPP setup and running on their Linux. First step towards setting up xdebug is to download LAMPP development package add-on from the apache-friends website. After the compressed file is download navigate to the folder where the TAR file is located using linux terminal and the type in -

export PATH=/opt/lampp/bin:$PATH

sudo tar xvfz xampp-linux-devel-1.7.4.tar.gz -C /opt

The above overwrites the existing LAMPP setup and includes the add-ons. After the files are overwritten, type in the following command.

/opt/lampp/bin/pecl update-channels

The above updates the PECL channels and prepares it for PECL based xdebug installation. After the above line is executed type-in:


/opt/lampp/bin/pecl install Xdebug

The above line sets up Xdebug in the existing LAMPP setup and at the 3rd or 4th last line of you will see the location of the xdebug.so files location given, note it down. The location may look something similar to this – “/opt/lampp/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so

Now we have to update the php.ini file to include the xdebug settings. You will find the file in “opt/lampp/etc/” open it by typing -

sudo gedit opt/lampp/etc/php.ini

Add the following lines at the very end of the file and save it.


zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so
xdebug.profiler_output_dir = “/tmp/xdebug/”
xdebug.profiler_enable = On
xdebug.remote_enable=On
xdebug.remote_host=”localhost”
xdebug.remote_port=9000
xdebug.remote_handler=”dbgp”

After the file is saved restart LAMPP by typing in -

sudo opt/lampp/lampp restart

To verify goto http://localhost/ after the server is restarted and you will see Xdebug table showing the xdebug settings.

let me know if you come across any issues during the setup process.

~ thephpx

Share

My Zen-Environment for WAMP development

Hello everyone,

Every developer has there very own zen settings so do i :) . Today I am going to writing about the stuffs I use while I am at development. If you have any better alternatives or suggestions to these applications please feel free to come forward :)

My preferred application development platform includes the following -

Local Work-Station/Laptop:

Central Repository Server Applications:

  • WAMP – for basic windows, apache, mysql, php server on central repository
  • Free SMTP -  for SMTP server on the central repository
  • KpyM Telnet/SSH Server – for SSH access to my central repository
  • VisualSVN – for SVN repository server management at central repository

That is the whole host of applications that are involved in my development process which I find very helpful and agile. I work on two-stage development, my local workstation/laptop and then to my central repository where I host my SVN repositories and also live demos.

The two stage method has so far proven extreamly helpful, specially if you have a VPS account where you are at your will to install applications.

I hope this one helps you setup your zen environment :p.

take care,

- thephpx

Share