Showing posts with label 4. Setting up working environment. Show all posts
Showing posts with label 4. Setting up working environment. Show all posts

Sunday, February 17, 2008

Installing MySQL

After setting up the computer and installing the Web server, you’re ready to install MySQL. You need to install MySQL before installing PHP because you may need to provide the path to the MySQL software when you install PHP.

But before installing MySQL, be sure that you actually need to install it. It might already be running on your computer, or it might be installed but not running. For instance, many Linux distributions automatically install MySQL.
Here’s how to check whether MySQL is currently running:
  • Linux/Unix/Mac: At the command line, type the following: ps –ax ,The output should be a list of programs. Some operating systems (usually flavors of Unix) have different options for the ps command. If the preceding does not produce a list of programs that are running, type man ps to see which options you need to use. In the list of programs that appears, look for one called mysqld.
  • Windows: If MySQL is running, it will be running as a service. To check this, choose StartControl PanelAdministrative ToolsServices and scroll down the alphabetical list of services. If MySQL is installed as a service, it will appear in the list. If it’s currently running, its status displays Started.
Even if MySQL isn’t currently running, it might be installed but just not started.
Here’s how to check to see whether MySQL is installed on your computer:
  • Linux/Unix/Mac: Type the following: find / -name “mysql*” If a directory named mysql is found, MySQL has been installed.
  • Windows: If you did not find MySQL in the list of current services, look for a MySQL directory or files. You can search at StartSearch. The default installation directory is C:\Program Files\MySQL\MySQL Server version number for recent versions or C:\mysql for older versions. If you found MySQL in the service list, as described, but it is not started, you can start it by highlighting MySQL in the service list and clicking Start the Service in the left panel.
If you find MySQL on your computer but did not find it in the list of running programs (Linux/Unix/Mac) or the list of current services (Windows), here’s how to start it:
  • Linux/Unix/Mac:
    • Change to the directory mysql/bin. This is the directory that you should have found when you were checking whether MySQL was installed.
    • Type safe_mysqld & When this command finishes, the prompt is displayed.
    • Check that the MySQL server started by typing ps -ax. In the list of programs that appears, look for one called mysqld.
  • Windows:
    • Open a Command Prompt window. In Windows XP, choose Start>All ProgramsAccessories Command Prompt.
    • Change to the folder where MySQL is installed. For example, type cd C:\Program Files\MySQL\MySQL Server 5.0. Your cursor is now located in the MySQL folder.
    • Change to the bin subfolder by typing cd bin. Your cursor is now located in the bin subfolder.
    • Start the MySQL Server by typing mysqld—install.
The MySQL server starts as a Windows service. You can check the installation by going to the service list, as described previously, and making sure that MySQL now appears in the service list and its status is Started.

If MySQL isn’t installed on your computer, you need to download it and install it from www.mysql.com. The Web site provides all the information and software that you need.

Wednesday, February 13, 2008

How to pick a web hosting?

A Web hosting company provides everything that you need to put up a Web site, including the computer space and all the Web site software. You just create the files for your Web pages and move them to a location specified by the Web hosting company.

About a gazillion companies offer Web hosting services. Most charge a monthly fee (often quite small), and some are even free. (Most, but not all, of the free ones require you to display advertising.) Usually, the monthly fee varies depending on the resources provided for your Web site. For instance, a Web site with 25Mb of disk space for your Web page files costs less than a Web site with 100Mb of disk space.
When looking for a place to host your Web site, make sure that the Web hosting company offers the following:
  • PHP and MySQL: Not all companies provide these tools. You might have to pay more for a site with access to PHP and MySQL; sometimes you have to pay an additional fee for MySQL databases.
  • A recent version of PHP: Sometimes the PHP versions offered aren’t the most recent versions. As of this writing, PHP 6 is close to being released. However, you may have trouble finding a Web hosting company that offers PHP 6. In fact, you may find that most Web hosting companies still offer PHP 4, although I hope that will change over time. It is worth the time to find a Web hosting company that offers at least PHP 5, if not PHP 6. Some Web hosting companies offer PHP 4 but have PHP 5 or 6 available for customers who request it.
Other considerations when choosing a Web hosting company are
  • Reliability: You need a Web hosting company that you can depend on —one that won’t go broke and disappear tomorrow, and one that isn’t running on old computers, held together by chewing gum and baling wire, with more downtime than uptime.
  • Speed: Web pages that download slowly are a problem because users will get impatient and go elsewhere. Slow pages could be a result of a Web hosting company that started its business on a shoestring and has a shortage of good equipment — or the Web hosting company might be so successful that its equipment is overwhelmed by new customers. Either way, Web hosting companies that deliver Web pages too slowly are unacceptable.
  • Technical support: Some Web hosting companies have no one available to answer questions or troubleshoot problems. Technical support is often provided only through e-mail, which can be acceptable if the response time is short. Sometimes you can test the quality of the company’s support by calling the tech support number, or test the e-mail response time by sending an e-mail.
  • The domain name: Each Web site has a domain name that Web browsers use to find the site on the Web. Each domain name is registered for a small yearly fee so that only one Web site can use it. Some Web hosting companies allow you to use a domain name that you have registered independently of the Web hosting company, some assist you in registering and using a new domain name, and some require that you use their domain name. For instance, suppose that your name is Lola Designer and you want your Web site to be named LolaDesigner. Some Web hosting companies will allow your Web site to be LolaDesigner.com, but some will require that your Web site be named LolaDesigner.webhostingcompanyname.com, or webhostingcompanyname.com/ ~LolaDesigner, or something similar. In general, your Web site will look more professional if you use your own domain name.
  • Backups: Backups are copies of your Web page files and your database that are stored in case your files or database are lost or damaged. You want to be sure that the company makes regular, frequent backup copies of your application. You also want to know how long it would take for backups to be put in place to restore your Web site to working order after a problem.
  • Features: Select features based on the purpose of your Web site. Usually a hosting company bundles features together into plans — more features equal a higher cost. Some features to consider are
    • Disk space: How many MB or GB of disk space will your Web site require? Media files, such as graphics or music files, can be quite large.
    • Data transfer: Some hosting companies charge you for sending Web pages to users. If you expect to have a lot of traffic on your Web site, this cost should be a consideration.
    • E-mail addresses: Many hosting companies provide you with a number of e-mail addresses for your Web site. For instance, if your Web site is LolaDesigner.com, you could allow users to send you e-mail at me@LolaDesigner.com.
    • Software: Hosting companies offer access to a variety of software for Web development. PHP and MySQL are the software that I discuss in this book. Some hosting companies might offer other databases, and some might offer other development tools such as FrontPage extensions, shopping cart software, and credit card validation.
    • Statistics: Often you can get statistics regarding your Web traffic, such as the number of users, time of access, access by Web page, and so on.
One disadvantage of hosting your site with a commercial Web hosting company is that you have no control over your development environment. The Web hosting company provides the environment that works best for it — probably setting up the environment for ease of maintenance, low cost, and minimal customer defections. Most of your environment is set by the company, and you can’t change it. You can only beg the company to change it.

The company will be reluctant to change a working setup, fearing that a change could cause problems for the company’s system or for other customers. Access to MySQL databases is controlled via a system of accounts and passwords that must be maintained manually, thus causing extra work for the hosting company. For this reason, many hosting companies either don’t offer MySQL or charge extra for it. Also, PHP has myriad options that can be set, unset, or given various values.

The hosting company decides the option settings based on its needs, which might or might not be ideal for your purposes. It’s pretty difficult to research Web hosting companies from a standing start —a search at Google.com for “Web hosting” results in almost 400 million hits.

The best way to research Web hosting companies is to ask for recommendations from people who have experience with those companies. People who have used a hosting company can warn you if the service is slow or the computers are down often. After you gather a few names of Web hosting companies from satisfied customers, you can narrow the list to the one that is best suited to your purposes and the most cost effective.

Saturday, February 9, 2008

A company Web site

When the Web site is run by the company, you don’t need to understand the installation and administration of the Web site software at all. The company is responsible for the operation of the Web site. In most cases, the Web site already exists, and your job is to add to, modify, or redesign the existing Web site. In a few cases, the company might be installing its first Web site, and your job is to design the Web site. In either case, your responsibility is to write and install the HTML files for the Web site. You are not responsible for the operation of the Web site.

You access the Web site software through the company’s IT department. The name of this department can vary in different companies, but its function is the same: It keeps the company’s computers running and up to date. If PHP or MySQL or both aren’t available on the company’s Web site, IT needs to install them and make them available to you.

PHP and MySQL have many options, but IT might not understand the best options — and might have options set in ways that aren’t well suited for your purposes. If you need PHP or MySQL options changed, you need to request that IT make the change; you won’t be able to make the change yourself. For instance, PHP must be installed with MySQL support enabled, so if PHP isn’t communicating correctly with MySQL, IT might have to reinstall PHP with MySQL support enabled. For the world to see the company’s Web pages, the HTML files must be in a specific location on the computer. The Web server that delivers the Web pages to the world expects to find the HTML files in a specific directory.

The IT department should provide you with access to the directory where the HTML files need to be installed. In most cases, you develop and test your Web pages in a test location and then transfer the completed files to their permanent home. Depending on the access that IT gives you, you might copy the files from the test location to the permanent location, or you might transfer the files via FTP (File Transfer Protocol), which is a method of copying a file from one computer to another on a network.

In some cases, for security reasons, the IT folks won’t give you access to the permanent location, preferring to install the files in their permanent location themselves.

To use the Web software tools and build your dynamic Web site, you need the following information from IT:
  • The location of Web pages: You need to know where to put the files for the Web pages. IT needs to provide you with the name and location of the directory where the files should be installed. Also, you need to know how to install the files — copy them, FTP them, or use other methods. You might need a user ID and password to install the files.
  • The default filename: When users point their browsers at a URL, a file is sent to them. The Web server is set up to send a file with a specific name when the URL points to a directory. The file that is automatically sent is the default file. Very often the default file is named index.htm or index. html, but sometimes other names are used, such as default.htm. Ask IT what you should name your default file.
  • A MySQL account: Access to MySQL databases is controlled through a system of account names and passwords. IT sets up a MySQL account for you that has the appropriate permissions and also gives you the MySQL account name and password.
  • The location of the MySQL databases: MySQL databases need not be located on the same computer as the Web site. If the MySQL databases are located on a computer other than that of the Web site, you need to know the hostname (for example, thor.companyname.com) where the databases can be found.
  • The PHP file extension: When PHP is installed, the Web server is instructed to expect PHP statements in files with specific extensions. Frequently, the extensions used are .php or .phtml, but other extensions can be used. PHP statements in files that don’t have the correct extension won’t be processed. Ask IT what extension to use for your PHP programs.
You will interact with the IT folks frequently as needs arise. For example, you might need options changed, you might need information to help you interpret an error message, or you might need to report a problem with the Web site software. So a good relationship with the IT folks will make your life much easier. Bring them tasty cookies and doughnuts often.

Finding a Place to Work

To create your dynamic Web pages, you need access to a Web site that provides your three software tools (see the preceding section). All Web sites include a Web server, but not all Web sites provide MySQL and PHP. These are the most common environments in which you can develop your Web site:
  • A Web site put up by a company on its own computer: The company — usually the company’s IT (Information Technology) department — installs and administers the Web site software. Your job, for the purposes of this book, is to program the Web site, either as an employee of the company or as a contractor.
  • A Web site hosted by a Web hosting company: The Web site is located on the Web hosting company’s computer. The Web hosting company installs and maintains the Web site software and provides space on its computer where you can install the HTML (HyperText Markup Language) files for a Web site.
  • A Web site that doesn’t yet exist: You plan to install and maintain the Web site software yourself. It could be a Web site of your own that you’re building on your own computer, or it might be a Web site that you’re installing for a client on the client’s computer. How much you need to understand about the administration and operation of the Web site software depends on the type of Web site access you have. In the next few sections, I describe these environments in more detail and explain how you gain access to PHP and MySQL.

The Required Tools

To put up your dynamic Web site, you need to have access to the following three software tools:
  • A Web server: The software that delivers your Web pages to the world
  • MySQL: The RDBMS (Relational Database Management System) that will store information for your Web database application
  • PHP: The scripting language that you’ll use to write the programs that provide the dynamic functionality for your Web site
 
breast-cancer diabetes-informa... weight-losse lung-mesotheliom... eating-disorders medical-billing php-and-mysql skin-cancer medical-health astronomy-guide cancer-diseases health insurance seo-news-2008 forex3003 lawyer-lookingforalawyer earnmoneyonline-earn forexautotrading-forex forex-trade forextrading forex-trading-forex-trading-08 searchingforcancertreatment adsense jiankang8008 beauty-girl forex5005