Friday, January 8, 2010

Installing PHP, Mysql and Apache to start working with PHP

Installing PHP

First, extract the PHP package ( php-4.3.10-Win32.zip ). I extracted the package in the directory where Apache was installed ( C:\Program Files\Apache Group\Apache2 ). Change the new created directory name to php ( just to make it shorter ). Then copy the file php.ini-dist in PHP directory to you windows directory ( C:\Windows or C:\Winnt depends on where you installed Windows ) and rename the file to php.ini. This is the PHP configuration file and we'll take a look what's in it later on.

Next, move the php4ts.dll file from the newly created php directory into the sapi subdirectory. Quoting from php installation file you can also place php4ts.dll in other places such as :

* In the directory where apache.exe is start from ( C:\Program Files\Apache Group\Apache2 \bin)
* In your %SYSTEMROOT%\System32, %SYSTEMROOT%\system and %SYSTEMROOT% directory.
Note: %SYSTEMROOT%\System32 only applies to Windows NT/2000/XP)
* In your whole %PATH%


Modifying Apache Configuration

Apache doesn't know that you just install PHP. We need to tell Apache about PHP and where to find it. Open the Apache configuration file in C:\Program Files\Apache Group\Apache2\conf\httpd.conf and add the following three lines :

LoadModule php4_module php/sapi/php4apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

The first line tells Apache where to load the dll required to execute PHP and the second line means that every file that ends with .php should be processed as a PHP file. You can actually change it to anything you want like .html or even .asp! The third line is added so that you can view your php file source code in the browser window. You will see what this mean when you browse this tutorial.

Now restart Apache for the changes to take effect ( Start > Programs > Apache HTTP Server 2.0.50 > Control Apache Server > Restart ) . To check if everything is okay create a new file, name it as test.php and put it in document root directory ( C:\Program Files\Apache Group\Apache2\htdocs ). The content of this file is shown below.

phpinfo();
?>

phpinfo() is the infamous PHP function which will spit out all kinds of stuff about PHP and your server configuration. Type http://localhost/test.php on your browser's address bar and if everything works well you should see something like this :



Installing MySQL

First extract the package ( mysql-4.0.18-win.zip ) to a temporary directory, then run setup.exe. Keep clicking the next button to complete the installation. By default MySQL will be installed in C:\mysql.

Open a DOS window and go to C:\mysql\bin and then run mysqld-nt --console , you should see some messages like these :
C:\mysql\bin>mysqld-nt --console
InnoDB: The first specified data file .\ibdata1 did not exist:
InnoDB: a new database to be created!
040807 10:54:09 InnoDB: Setting file .\ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
040807 10:54:11 InnoDB: Log file .\ib_logfile0 did not exist: new to be created

InnoDB: Setting log file .\ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
040807 10:54:12 InnoDB: Log file .\ib_logfile1 did not exist: new to be created

InnoDB: Setting log file .\ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
040807 10:54:31 InnoDB: Started
mysqld-nt: ready for connections.
Version: '4.0.18-nt' socket: '' port: 3306

Now open another DOS window and type C:\mysql\bin\mysql

if your installation is successful you will see the MySQL client running :

C:\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

Type exit on the mysql> prompt to quit the MySQL client.

Now let's install MySQL as a Service. The process is simple just type mysqld-nt --install to install the service and net start mysql to run the service. But make sure to shutdown the server first using mysqladmin -u root shutdown

C:\mysql\bin>mysqladmin -u root shutdown

C:\mysql\bin>mysqld-nt --install
Service successfully installed.

C:\mysql\bin>net start mysql

The MySQL service was started successfully.


C:\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.18-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>


Modifying PHP Configuration File ( php.ini )

PHP stores all kinds of configuration in a file called php.ini.You can find this file in the directory where you installed PHP. Sometimes you will need to modify this file for example to use a PHP extension. I won't explain each and every configuration available just the ones that often need modification or special attention.

Some of the configurations are :

1. register_globals
2. error_reporting and display_errors
3. extension and extension_path
4. session.save_path
5. max_execution_time

register_globals

Before PHP 4.2.0 the default value for this configuration is On and after 4.2.0 the default value is Off. The reason for this change is because it is so easy to write insecure code with this value on. So make sure that this value is Off in php.ini.

error_reporting and display_errors

Set the value to error_reporting = E_ALL during development but after production set the value to error_reporting = E_NONE .

The reason to use E_ALL during development is so you can catch most of the nasty bugs in your code. PHP will complain just about any errors you make and spit out all kinds of warning ( for example if you're trying to use an uninitialized variable ).

However, after production you should change the value to E_NONE so PHP will keep quiet even if there's an error in your code. This way the user won't have to see all kinds of PHP error message when running the script.

One important thing to note is that you will also need to set the value of display_erros to On. Even if you set error_reporting = E_ALL you will not get any error message ( no matter how buggy our script is ) unless display_errors is set to On.

extension and extension_path

PHP4 comes with about 51 extensions such as GD library ( for graphics creation and manipulation ), CURL, PostgreSQL support etc. These extensions are not turned on automatically. If you need to use the extension, first you need to specify the location of the extensions and then uncomment the extension you want.

The value of extension_path must be set to the directory where the extension is installed which is PHP_INSTALL_DIR/extensions, with PHP_INSTALL_DIR is the directory where you install PHP. For example I installed PHP in C:\Program Files\Apache Group\Apache2\php so the extensions path is :

extension_path = C:/Program Files/Apache Group/Apache2/php/extensions/

Don't forget to add that last slash or it won't work

After specifying the extension_path you will need to uncomment the extension you want to use. In php.ini a comment is started using a semicolon ( . As an example if you want to use GD library then you must remove the semicolon at the beginning of ;extension=php_gd2.dll to extension=php_gd2.dll

session.save_path

This configuration tells PHP where to save the session data. You will need to set this value to an existing directory or you will not be able to use session. In Windows you can set this value as session.save_path = c:/windows/temp/

max_execution_time

The default value for max_execution_time is 30 ( seconds ). But for some scripts 30 seconds is just not enough to complete it's task. For example a database backup script may need more time to save a huge database.

If you think your script will need extra time to finish the job you can set this to a higher value. For example to set the maximun script execution time to 15 minutes ( 900 seconds ) you can modify the configuration as max_execution_time = 900

PHP have a convenient function to modify PHP configuration in runtime, ini_set(). Setting PHP configuration using this function will not make the effect permanent. It last only until the script ends.

That's it, now you have Apache, PHP and MySQL installed and running smoothly.

Monday, October 19, 2009

sakshieducation

Sakshieducation is a site which is maintaining by a student.This guy providing all programming hacking web-designing and networking video tutorials , materials and model papers for different companies. He is also giving links to good ebooks.he is really rocking man!!! he is also giving some good tips & tricks related to computers. SakshiEducation providing complete details about all the engineering colleges in india . He is also giving the latest info about the government jobs.

So, plz visit this site...

http://www.sakshieducation.info

Saturday, October 10, 2009

Best option to earn money with your Blog

Today blogging has became one of the easiest and best way of earning money in internet.We no need to invest money initially, by writing whatever we like, in our blogs we can earn. Some professional bloggers earning more than $1000 per month by writing articles in their blogs.

There are different options for a blogger to earn money from their blogs.
1.advertisements
2.paid blogging
3.writing reviews


1.Advertising:

We can earn money by displaying the ads by different ad networks like Google adsense, yahoo search marketing, adbrite , etc etc....
For this purpose we need to apply for those ad networking sites . If our blog qualifies their criteria then they will pay us some amount for displaying their ads in our blogs.

2.Paid Blogging/Writing Reviews:

This is another important kind of earning money. In this case, we need to apply our talent. Because we have to write content specified by the client/our paid blogging customer.They will tell us what to write,how to write everything.. They are paying from $3-$250 for every post. It depends upon various factors like our blog popularity and the way we write, quality etc etc..

Sites which are providing this facility are blogadvertisingstore , paying post etc etc..

To earn money from your blog, first what you should do is to register your blog and submit those blogs to various web directories like yahoo , google , Wikipedia or dmoz or yahoo directory.

Today blog advertising has became very famous and easiest way of earning money . So, guys keep blogging and earn while you learn..

Friday, October 9, 2009

listening to music online

Listening to Music Online Advantages & Problems

Reduces distribution & production cost - Companies can reduce production & distribution moving from creating music and distributing on physical media such as CDs or cassettes.

Promotions made easy - Record companies can simply create a web site for the artist and allow sample downloads of the artist.

Direct sales to customers via the Web - Customers can buy and start downloading their favorite tracks straight away from artist or record company web sites.

The above are only a few advantages and disadvantages for the music enthusiast (you), artist and record companies.

Music made portable MP3 compresses files to a manageable size, MP3 lets you take your music pretty anywhere either on a portable or car player.
Turns your computer into a jukebox - You can easily store, manage and play MP3 files with graphically visual player on your computer making it into juke box of your favourite tracks.

Share MP3 files easily - Because of the size of MP3 files you easily transfer either via physical (CD-r) or electronically (over the Internet).

Easy to create custom CDs - With your collection of MP3 files you can make custom CDs of your favourite tracks.

Easy to transfer over the Internet - With slower Internet speeds, MP3 files makes it easier to transfer.

Music quality lower than CD quality - Even with higher birate used to encode your MP3 files but still not as good as CD quality sound.

Publish and distribute your own music instantly over the Internet - You can record & mix your music using a computer and easily publish and distribute your music without spending thousands of dollars for packaging and promoting you are your music.

Promoting your music online Promoting your music online can be achieved in several ways posting MP3 files on a website, newsgroup, or sharing them through files sharing networks (Napster like programs).

Main Uses and misuses of Listening to music online

Listening to music online will have both advantages and disadvantages too...

The distribution of music on the Internet has become extremely simple, and with the advances in audio formats together with increasing Internet speed, it is now possible to download not only songs but entire albums. However the combination of music and the Internet has caused a great controversy. Simplistically, the issue of Internet music distribution concerns three groups of people… the Internet users who download music, the organizations and individuals who distribute music through Internet sites, and lastly the artists and their record companies, record manufactures and music stores.

As the Internet users generally argue, Internet music distribution has numerous advantages. Even novice Internet users can now access the virtually any songs ever written in a matter of seconds. This can all be done from the personal computer and is far more practical for people than the previous means. The Internet features virtually every types of music that exists and every artist providing the means for people to broaden their musical horizons. It provides people who live in remote places a change to actually purchase music from a virtual music community and also the opportunity for all people to listen to a song before the decision to purchase it. The Internet is especially good news for the less famous artists who most likely can afford any other means to expose their music to the public.

On the other hand though, as the famous artists and their loyal defenders are arguing, this form of music distribution has plenty of disadvantages. For starters it has been estimated that over eighty percent of all music downloaded is done so illegally. Unfortunately as it seems, illegal downloading of songs from the Internet has turned into a fairly casual and frequent type of crime, and a recent poll shows that most young people believe lying and speeding to be worse offences. One of the reasons for this is that it has never really been punished, and it has become difficult for ordinary people to tell the difference between right and wrong regarding this issue. However it all comes down to copyright law, as the body of exclusive rights protecting artist’s work from being copied without their authorization. The real issue is that they are not receiving their royalties, because obviously when you download a song for free neither the artists or the record companies receive a cent.

Perhaps it all happened so fast it has taken this long to react, but recently artist have been lashing out in attempts to sue music distributing and file-swapping Internet sites, in one case demanding a hundred thousand for each song illegally copied. On one hand we have the argument that it is wrong to base and industry on theft like this, but on the other it is the people performing the illegal acts that should be punished and not the technology. The publicity and media attention from these court cases seems to be making the artist less popular, but is actually beneficial to the Internet sites who subscribe to the point of view that even bad publicity is good publicity… and their success is proof of that.

If I were asked to give an opinion, I would say that in a perfect world all music should be free. I might have been sympathetic toward the artists, but I can recognise that their concerns are based largely on their own greed. The reality of this situation is that Internet music is making music in general more popular, and figures have proven that there has been no decline in music sales at all. It is obvious to me that not every song downloaded for free would otherwise have been bought, and if anything this is a form of free publicity, which does not affect the already excessive income of famous artists at all. Personally I see this issue similar to the issue of the Internet itself. Was it wrong for us to create the means for people to act so illegally and not get caught, or do the benefits of the Internet outweigh the disadvantages? It doesn’t really matter now because it’s already too late to turn back. Our responsibility now is to deal with the situation and force the law to actually catch up and adapt to illegal music distribution over the Internet.
What to do next is up to you.. Take a right decision ...