Setup your own apache sever with php and mysql, the easiest way using XAMPP

Many php developers find it difficult to test and debug their php scripts on their web host’s server, as it consumes much needed time, but what if you had your own PC turned into an apche server with the latest version of php and mySql? Manual installation of apache and php and their configuration to meet your needs is not an easy task, but with Apache Friends XAMPP , the task becomes as simple as installing a software or extracting a zip archive! XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use – just download, extract and start. .

XAMPP (current version 1.7.1 ) includes :

  1. Apache HTTPD 2.2.11
  2. MySQL 5.1.33
  3. PHP 5.2.9
  4. Openssl 0.9.8i
  5. phpMyAdmin 3.1.3.1
  6. Webalizer 2.01-10
  7. FileZilla FTP Server 0.9.31
  8. SQLite 2.8.15
  9. Zend Optimizer 3.3.0
  10. Mercury Mail Transport System v4.62

How to install?

XAMPP currently comes in 3 variations :

Installer : as simple as installing a software

ZIP Archive: just extract and use

Self-extracting ZIP archive

The choice is yours, i downloaded Self-extracting ZIP archive as it is very small in size and convenient to install.

Using the Self-extracting ZIP archive, extract all the contents to a top level directory in your hard drive, eg: C:/xampp

Now to manage your Apache and mySql services, open the XAMPP control Panel located at xampp/xampp-control.exe . Click on “start” button next to Apache to start your server, now open your browser and go to http://localhost/ , you should now see the XAMPP splash screen , that means your server is now working fine and you are all ready to run your php code on your PC. To run your php scripts, place all your files in xampp/htdocs directory and then call http://localhost/yourscript.php where yourscript.php is the name of your file.

Default passwords

The default user for mysql is root and password is “” , that means no password

So connect to the databse using php you can use mysql_connect("localhost","root","");

you can also change your mySql username and password here is how

Installing WordPress using XAMPP

You can even set up a fully functional “local” wordpress blog on your PC, you can use it to test and debug your wordpress themes and plugins in live. To get started, download wordpress and place the wordpress directory in xampp/htdocs

folder, now go to http://localhost/wordpress/ where wordpress is your wordpress blog directory and follow onscreen instructions

But before going further, you will have to manually create a database in mySql for your wordpress blog, to create a new database go to http://localhost/phpmyadmin/ and create a new database with thw name of your choice,
now back to wordpress installation, enter the name of the database you just created in the database field, for usename enter “root” and leave the password field blank and submit. If everything goes fine, you will now be prompted for a title for you blog. Hooray!
your local wordpress blog is now ready, copy the password generated and login to the admin area, happy “local” blogging :).

Installing XAMPP on your USB stick

Now this is the best part of XAMPP, you can even install XAMPP right on your USB drive! It can come really useful in situations like when you have to demonstrate to your client a site that uses php and mySql
on his PC. to install XAMPP on your USB drive, simply extract XAMPP to your USB stick instead of your hard drive and enjoy!

 

How to display a notice to your ie6 users using only css

This is year 2009 and not 1999, it is now time to move a step forward and shun internet explorer 6. Instead of trying to make your site work in internet explorer 6 and waste your precious time you should now consider to politely ask your ie6 visitor to upgrade. There are many ways to do so, but the simplest one i could come up with was using a css hack to display a particular div in ie6 and hide it in other browsers. The trick is to use ie6’s interpretation of _display as display .
Here is the code :

'
// CSS

#ie6_only {
//Hide it from good browsers
display:none;

//only ie6 will interpret it as display! others wont
_display:block;
}

// XHTML
<div id="ie6_only">
Your notice to ie 6 users here
</div>
'


Thats all! quite simple, isnt it? much simpler than using javascript or php to detect the browser and take action accordingly.
However you should position the div at such a place and in such a way that it is clearly visible.
You must also be polite in your notice and here is one example :

Dear visitor!
You are using an outdated browser that is not compatible with web standards,
You must consider upgrading to a different browser or a newer version of Internet Explorer to improve your web experience and enhance your online security and privacy
ThankYou

Further, you may consider becoming a supporter of NET magazine’s anti-ie6 campaign at http://www.bringdownie6.com

 

WordPress Commercial Theme directory goes live…

The Official WordPress Commercial Theme Directory has gone live today. The direcory is a part of the extend>themes section of wordpress.org. Though it is called “directory” right now it only lists some sites that provide commercial or premium wordpress themes licenced under our favorite GPL licence . The criteria for your site being included is quite simple.

To be included, you should:

* Distribute 100% GPL themes, including artwork and CSS.
* Have professional support options, and optionally customization.
* Your site should be complete, well-designed, up to date, and professional looking.
* Include a haiku about yourself to be included.

and send your details to themes@wordpress.com
Lets hope that they evolve further and start hosting commercial GPL themes themselves,

 

Scrap It – HTML scraps creator for Orkut

Scrap It is a simple light weight tool for quickly creating richly formatted cool looking scraps for Orkut. So if you are on Orkut and want to send your special friend a special scrap then just point your browser to http://www.dynamicguru.com/scrapit/ and enter your scrap in the form and hit submit, copy the code below the html template of your choice and paste in your friend’s scrapbook. Scrap It currently features only 6 templates, but stay tuned, more of them are on the way…:)

 

New theme!

If you are among the frequent visitors to my blog you will notice that i changed the blog theme today, this new theme is my own creation and the best part about it is the effects on the left sidebar, hover over a link to slide it towards right and click on a link category title to see it slide up, all thanx to the powerful jQuery.8) If you like the theme or want to point out a bug , drop a comment using the form below.

Update

I switched back to my previous Silver Theme . But this new theme is now available for download from the official wordpress theme directory.



Click here to download this theme
 

A problem with float and clear that drove me crazy!

Yesterday i had submitted this wordpress theme of mine to the official wordpress theme directory. I got a feedback from the guys there stating that my theme wasnt valid as it had some issues and they asked me to fix them and upload again. I was able to fix all the issues but one, ant that was : the gallery, when inserted in the post, streches out the gallery container div to around 600px! I looked at the source code of the gallery and found that the gallery was created using the dt and dl tags, and the dt containing the images was set to float to left using css and each row of dt containing images was separated out by a br styled to clear:both. This was the part of document which was causing trouble, the br tag, after clearing both side was pushing down the next row of images to at least around 600px, trying to fix this issue only had me panicking after hours of debugging,re-writing some styles and googling the solution out, but in vain :( . It was when i was almost exhausted and felt like my brain was going to give up and shutdown that i told myself to give it a last try , i just gave my content div (which was set to float to left and was the parent of the post div that was streching out) a fixed width of 740px, and hurray, to my amazement i found that the problem was solved!!! :D . I dont know what actually happened, what had the width of the parent element to do with the vertical stretchning of the gallery image rows. So if you have an explanation then please lemme know in the comments below.

 

Disguise/obfuscate your php code by base64 encoding it

If you are among the ones who give away free self written php scripts to everybody but want some way to stop script kiddies and newbies just copy-pasting and modifying your script or you just dont want code newbies to know the original code then this post is probably for you. The trick is to encode your php code as a string and then parse the encoded string as php code after decoding it. This trick is very commonly usede by developers. Though this trick cannot stop code copying but can discourage the viewer to a certain extent to copy the code.
Here is how to do it:

  1. Encode your code as string using any encoding method/functions . the most commonly used is base64_encode. You can even use Dynamicguru’s Online base 64 encoder and decoder to instantly convert your code to base64 format
  2. In your script file, decode the generated string using base64_decode function and assign it to a variable
  3. Now call the function eval() passing your decoded string as argument and you are done!

Example :

Consider the following piece of code :

'
<?php
echo "hello world";
?>
'


Now suppose you want to disguise the code and make it look un-interpretable , Encode it using our Online base 64 encoder and decoder . here is what the code looks like after encoding :

'
PD9waHANCmVjaG8gXCJoZWxsbyB3b3JsZFwiOw0KPz4= 
//Amazing isnt it?
'


Now call the eval() function :

'

eval(base64_decode("PD9waHANCmVjaG8gXCJoZWxsbyB3b3JsZFwiOw0KPz4= "));

//the above code is equal to :

<?php
echo "hello world";
?>
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
'

Note
This trick should not be used if you want to completely disguise your code, as anybody can go a step further and decode it using base64_decode function.

The eval fucntion evaluates a string as a php code and is of immense help in situations where you want a piece of code to be stored in a file / database and executed at a later time

Hope you enjoyed the post and learned something new and useful :D

 
2019 All rights reserved | Powered by WordPress
Back to top
Theme by dynamicguru.com