Sunday, August 22, 2010

Wordpress installation



Wordpress  installation

If you can host multiple domains with your hosting company,
I recommend using a totally separate domain for your blog.
At the very least you will need a subdomain.

Verify that your web hosting company supports the following programs.

    PHP version 4.2 or greater
    MySQL version version 4.0 or greater
    The Apache mod_rewrite module

You must also have an FTP program of some sort for uploading your files.
This will also allow us to change permission on files as needed.

I fully recommend using a hosting company that uses a Linux based server.
This may also be listed as Unix or Apache.I do not recommend using a Windows based server.

If you are unsure of the server used by your hosting company, you can determine this by doing a header check of your domain. Insert the URL of your site and click submit. The information returned will include the server type.

Getting Started with MySQL
 
Setup your MySQL database from within your control panel, or in some cases you will need to contact  your host to set it up. SAVE the following information:

    Database Name
    User Name
    Password
    Host Name

Download and Configure WordPress

Download Link


Unzip the file using command below

#unzip latest.zip
Inside the WordPress folder is a file named wp-config-sample. Change that file name to wp-config.

Open the same file that you just renamed. Within that file you will see the following:

define('DB_NAME', 'wordpress'); // The name of the database
define('DB_USER', 'username'); // Your MySQL username
define('DB_PASSWORD', 'password'); // ...and password
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value 

We will be changing some of this information to include your database information.

Insert Your MySQL Database Information

When you previously set up the MySQL database you would have been provided with the following information:

    The name of the database
    The MySQL database username
    The password of the database
    The database host (in some cases)

We need to change the default information in the wp-config to include your information. The following will cover those changes line by line. Do not remove the single quotes.

    define('DB_NAME', 'wordpress'); // The name of the database    

Change the highlighted area of the line above to the actual name of your database that you were given when you set up the database.  

    define('DB_USER', 'username'); // Your MySQL username

Change the highlighted area above to the username you were given when you set up the database.    

    define('DB_PASSWORD', 'password'); // ...and password

  Change the highlighted area of the line above to the password you were given when you set up the database.

    define('DB_HOST', 'localhost'); // chance you won't need to change.

    If you were given information for the database host, you will likely need to change the highlighted area of the line above to the data you were given when you set up the database. If you were not given this information it is very likely you can leave this set to localhost.

Once you have completed the above, SAVE the changes you have made.

Begin the WordPress Installation


To begin the WordPress installation, you will need to run the WordPress installation script by accessing the wp-admin/install.php file from your browser window.


When you click the First Step link, another new window will open.

    Enter the name you have selected for your blog.
    
    Enter your email address and double check it before continuing.
    
    Place a check in the box for I would like my blog to appear in search engines like Google and Technorati. (This is important!)A
    
    Click "Continue to Second Step".


Once you have followed the instructions on each new window, your blog will be created automatically for you.
Make sure to save the user name and password provided. 

That's it for the basic WordPress installation. You are ready to log in!

Useful websites for webhosting

To find the domain's registrar information and Name servers

-->who.is


-->adminchange.com


-->centralops.net

To find who is hosting the domain

-->whoishostingthis.com

To find the domains DNS records are fine?

-->intodns.com


-->www.checkdns.net/quickcheckdomainf.aspx



Network Utilities Site

-->yougetsignal.com


-->aruljohn.com

Wednesday, August 18, 2010

PHP Url file-access disabled

If your PHP installation is secure and you try to include a file using an absolute path or a remote file then you will face this issue. For example …

<?
include ("http://www.somedomain.com/file.php");
?>

will result in you seeing this PHP error when viewing the page in your browser …

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/user/public_html/page.php on line xx

The reasons for disabling PHP include for remote files is clear – to do so would leave your coding open to cross site scripting attacks (XSS attacks). This is the method by which someone of malintent would inject their own code into yours, such malicious code is usually crafted to conduct a DoS (Denial of Service) or DDoS (Distributed Denial of Service) attack both of which would cause server downtime. Other injections could include alternative page content, such as a ‘Hacked by some Hackers’ type of announcement across your web page(s).

Alternate method to include the remote URL in PHP file is to use the function file_get_contents().  
 
Add this,


<?
$a = file_get_contents("http://www.somedomain.com/file.php");
echo ($a);
?>

instead of

<?
include ("http://www.somedomain.com/file.php");
?>

For this code you did not need to enable URL file-access in the server

Another alternative is using require_once function

<?
require_once($_SERVER['DOCUMENT_ROOT'].'file.php');
?>
 

In the above two alternatives file_get_contents() worked for me. Give first priority to the file_get_contents() function.



 

Monday, August 16, 2010

Grep Command

The Linux grep command is used to extract lines of data from files or extract data from other Linux commands by using a pipe. When using the Linux grep command, there are many ways you can extract or print lines. You can use standard text to grep or you can use regex patterns.

The basic grep syntax is  

grep [options] [pattern] [file|files].

grep -R, grep -r, grep --recursive ==> used to grep files recursively in other directories.


grep -n  ==> displays the output with the line number

grep -i  ==> to ignore case while grep

grep -v  ==> returns all other data except the argument given.