How to create Virtual Hosts PHP | Apache ?

Focus

Web Developer should have a requirement to work on various environment . Some projects are in plain php, some are in Framework like CodeIgniter, Symfony .. These all need different configuration and sometime need to use htaccess mode rewrite etc.

Those need to be in root folder.

We can access each  project like

http://accommodationcheap.oi

http://iwordzo.oi

http://helloplot.oi

simultaneously without altering any configurations each time we use. So different htaccess can run simultaneously with the hostname.

How can i add Virtual Host and Virtual Directory ?

  1. Search for “hosts” in your system folder

Creating Virtual Hosts

2. Edit this file using notepad

Add the following lines

127.0.0.1    localhost
::1                   localhost
127.0.0.1   wordzo.oi
127.0.0.1   accommodationcheap.oi
127.0.0.1   helloplot.oi

Description

127.0.0.1 This is  the default ip address of local host

Ip address followed by domain name you want to use

you can add google.com as domain name and when u type google.com on your browser it will show your local site. It wont display actual google site .

For the development purpose i have added .oi extension. You can use your own extension.

3. open you httpd.conf located at apache folder with notepad or any other simple text editor

Append this code to your httpd.conf


#Virtual Host Directory Settings for wordzo

NameVirtualHost wordzo.oi:80

<VirtualHost wordzo.oi:80>
DocumentRoot E:/Project/iwordzo
ServerName wordzo.oi

# Other directives here

</VirtualHost>

#Vitual Directory Settings for Accommodationcheap.in

NameVirtualHost accommodationcheap.oi:80

<VirtualHost accommodationcheap.oi:80>
DocumentRoot E:/Project/accommodationcheap
ServerName accommodationcheap.oi

# Other directives here

</VirtualHost>

#Virtual Directory Settings for Helloplot.com

NameVirtualHost helloplot.oi:80

<VirtualHost helloplot.oi:80>
DocumentRoot E:/Project/helloplot
ServerName helloplot.oi

# Other directives here

</VirtualHost>

4. Restart your apache

5. That’s it :)

You can browse your localhost sites using

http://accommodationcheap.oi

http://iwordzo.oi

http://helloplot.oi

Note: These settings are for Windows machine

Reference Links

http://httpd.apache.org/docs/1.3/vhosts/name-based.html

Tagged with: , , , , , , ,
Posted in domains, Featured, PHP, Programming, Project Managament, Projects

Basic Linux Commands | usefull for a webdeveloper

List Directory

shell>ls

Find a file or directory

shell>find filename

Edit a File 
shell>vi filename.txt

Then file will be open,
if you want to save that file
then
1. press Esc
2. Type ":" (colon)
3. Type "wq" (w- write,q - quit) | Type "q!" (quit without save/write )
 

Mysql Prompt

shell>mysql -u username -p databasename

Then give password

MSQL Dump or database backup with command prompt

shell>mysqldump -u username -p databasename > backup/backupfile.sql

Then give password

[username] – this is your database username
[password] – this is the password for your database
[databasename] – the name of your database
[backupfile.sql] – the file to which the backup should be written.

Output file (databasedump) will be in “backup” folder

Mysql Database restore

shell>mysql - u username -p databasename < backup.sql
then give password

If your database already exists

shell>mysqlimport -u username -p databasename backup.sql
then give password

How to set WRG permission to a folder recursively

shell>chmod -R 777 directoryname

How to compress or zip a directory 
shell>tar -zcvf backup/12-11-2010.tar.gz foldername/
  • -z: Compress archive using gzip program
  • -c: Create archive
  • -v: Verbose i.e display progress while creating archive
  • -f: Archive File name
shell>tar -zxvf backup/12-11-2010.tar.gz foldername/
  • -x: Extract

Advanced linux commands

shell>df -i

This will return the disc statistics

Filesystem            Inodes   IUsed   IFree IUse% Mounted on
/dev/sda3            59736064  104526 59631538    1% /
/dev/sda1              26104      41   26063    1% /boot
tmpfs                 217771       1  217770    1% /dev/shm

Tagged with: , , , , , , , , , , , , ,
Posted in database, Featured, Misk, Mysql

How to Turn Your iPhone Into a Mobile Office

Blackberries used to be the phone of choice for business people. However, with major companies like Bank of America and Citigroup considering switching to the iPhone, the tide is starting to turn in favour of Apple. So with that in mind, here are a couple of apps that will let your turn you phone into a mobile office that can read documents, record memos and even manage conference calling at the touch of a button.

Quick Mobile Office Suite

Quick Mobile Office Suite is a great app that will let you view Microsoft Office, Excel, Powerpoint and PDF files. This means you can receive an email, download and view the attachment and then send a message in response, all from your iPhone. Even better you can now create and edit Word and Excel documents. The app’s interface works nicely making word processing a great new feature of your new mobile iPhone office. Apple’s voice memo system is another good way to work on the go. The app comes built in with all new iPhones and allows you to record sounds and voice memos. It’s very easy to share the memos as you can send them instantly by email or even text message. This app should prove particularly popular with journalists and people who conduct lots of meetings on the go.

Powwownow conference call service

Powwownow conference call service is available through an iPhone app that makes it very easy to set up teleconferences on the move. The app is available free of charge from iTunes and allows you to create, view and invite people to phone conferences. The interface works very smoothly on the phone. With this app, the iPhone is now an ideal tool for conducting meetings while on the road. With these apps you can turn your iPhone into a mobile office capable of sending voice memos, creating documents and running teleconferences. But keep your eye on the App Store as new apps are constantly coming out, many of which are targeted at business people. This means the iPhone will continue to improve as a tool for business.

Posted in Misk

How To enable mod_rewrite on Xampp

Search For httpd.conf file and uncomment this line

#LoadModule rewrite_module modules/mod_rewrite.so

LoadModule rewrite_module modules/mod_rewrite.so

Restart your Server

create a .htaccess file on your server root

put this code

RewriteEngine On
RewriteBase /
RewriteRule ^contact-us$ index.php

Tagged with: , , ,
Posted in PHP, Programming

How Secure and Protected our Email Content In Gmail ?

I yesterday i noticed something on my Gmail Inbox.  Gmail is displaying my bank Account number in right of my inbox. I really wondered how secure our gmail content. Almost all my account is linked with gmail . So lot 0f password residing in it. Even though I am heard about Google Toilet i wont realize what they exactly meant.

Tagged with: , ,
Posted in security

Untitled

Google Maps has a wide array of APIs that let you embed the robust functionality and everyday usefulness of Google Maps into your own website and applications, and overlay your own data on top of them:
Maps JavaScript API

Embed a Google Map in your webpage using JavaScript. Manipulate the map and add content through many services.
Version 3 – Version 2
Maps API for Flash

Use this ActionScript API to embed a Google Map in your Flash-based web page or app. Manipulate the Map in three dimensions and add content through many services.
Learn more
Google Earth API

Embed a true 3D digital globe into your web page. Take your visitors anywhere on the Earth (even below the ocean) without leaving your web page.
Learn more
Static Maps API

Embed a fast and simple Google Maps image in your web page or mobile site without requiring JavaScript or any dynamic page loading.
Learn more
Web Services

Use URL requests to access geocoding, directions, elevation, and places information from client applications, and manipulate the results in JSON or XML.
Learn more
Maps Data API

View, store and update map data through Google Data API feeds, using a model of features (placemarks, lines & shapes) and collections of features.
Learn more

Posted in Misk

Creating XML-RSS Feed Using PHP MYSQL

I have been working to create crowler friendly rss feed for our website. I think it is very easy to build . But when i started coding it i got so many problems with xml and special charcters. I tried program for replacing special characters. But it wont work. Finally i used utf8_encode. It worked

$h=utf8_encode(clean_url($result['name']));
$d=utf8_encode(clean_url($result['discription']));

I have attached PHP Source code for XML Generator

feed.php

Right click on the above link and save target as …

Below function is used to clean all extra characters in the content.

function clean_url($text)
{
$text=strtolower($text);
$code_entities_match = array(‘>>’,'–’,'�’,'–’,'&’,'“’,'”’,'–’,'’’,'-’,'–’,'”‘,’!',’@',’#',’$',’%',’^',’&’,'*’,'(‘,’)',’_',’+',’{‘,’}',’|',’:',’”‘,’< ‘,’>’,'?’,’[',']‘,’\\’,';’,”‘”,’,',’.',’/',’*',’+',’~',’`',’=',’-',’ï’,'–’,”‘”,’O');

return str_replace($code_entities_match,”, $text);
}

To make an rss feed you need title, description and link

Sample RSS FEED format

<rss version=”0.91″>
  <channel>
    <title>XML.com</title>
    <link>http://www.xml.com/</link>
    <description>XML.com features a rich mix of information and services for the XML community.</description>
    <language>en-us</language>
       <item>
            <title>Normalizing XML, Part 2</title>
            <link>http://www.xml.com/pub/a/2002/12/04/normalizing.html</link>
             <description>In this second and final look at applying relational normalization techniques to W3C XML Schema data modeling, Will Provost discusses when not to normalize, the scope of uniqueness and the fourth and fifth normal forms.</description>
       </item>

    <item>
      <title>SVG’s Past and Promising Future</title>
          <link>http://www.xml.com/pub/a/2002/12/04/svg.html</link>
           <description>In this month’s SVG column, Antoine Quint looks back at SVG’s journey through 2002 and looks forward to 2003.</description>
    </item>
  </channel>
</rss>

also go through the source code attached

Tagged with: , , , , , , , , ,
Posted in PHP, SEO

How to configure cURL in xampp server

xampp server with default configuration can’nt run curl_init();

to make it work in xampp server we have to edit three files namely

1. php.ini(which is a configuration stting file).

2. php.ini-recommended(INI-DIST file)

3. php.ini-dist(INI-RECOMMENDED file)

open these files in notepad and search for ‘curl’ and remove ‘;’ symbol, save and close the files.

Remember to restart your server before running the application.

Tagged with: , , , , ,
Posted in PHP, Programming, Troubleshoot