Archive for April, 2007

40Part IPHP: The (Web hosting compare) BasicsBefore you can beginBefore you

Wednesday, April 25th, 2007

40Part IPHP: The BasicsBefore you can beginBefore you can install PHP on any platform, you need: .A server or workstation with enough RAM for your OS. .A Unix, Mac OS X, or Windows operating system installed. .A working, dedicated Internet connection if you are running a production site; and/orinstallation on an intranet for a development site; or neither if you are running a totallystandalone PHP setup (although without an Internet connection, you must find anothersource for the necessary software packages). Help for these prerequisites is beyond the scope of this book. You might want to look at thefollowing sources for networking information: .World of Windows Networking (www.wown.com) .Linux Documentation Project (www.linuxdoc.org/HOWTO/HOWTO-INDEX/howtos.html) If you plan to install PHP on Windows, you ll also need: .A working PHP-supported Web server. Under previous versions of PHP, IIS/PWS was theeasiest choice because a module version of PHP was available for it; but PHP now hasadded a much wider selection of modules for Windows. .A correctly installed PHP-supported database (if you plan to use one) .The PHP Windows binary distribution (download it at www.php.net/downloads.php) .A utility to unzip files (search http://download.cnet.comfor PC file compressionutilities) Apache2 and PHPApache is probably the Web server most commonly used with PHP and MySQL so commonthat the acronym LAMP has emerged to describe precisely this combo (Linux Apache MySQLPHP). At the moment, both Apache and PHP are in the middle of major releases and unfortu- nately there are reasons why the two upgrades may be incompatible. The main change in the huge architectural update of Apache2 is thread-safety. In Apache1, eachserver request spawned a separate child process. This has one huge advantage if one processfails, it will not crash the whole server. However, it also leads to perceived inefficiencies on someoperating systems, particularly Windows although in many cases, particularly Linux, Apache2 isnot more efficient than Apache1. Unfortunately, a lot of PHP extensions cannot easily be made thread-safe and probably neverwill. The PHP development team, therefore, has gone on record recommending against anupgrade to Apache2 in a production environment. This recommendation will, in turn, slow theadoption of Apache2 by preventing people from finding bugs so they can be fixed. It s unclear ifthis recommendation will change. So here s the bottom line: Most PHP users do not need to upgrade to Apache2. Users of high- load production systems may be risking a total httpd crash if one thread goes down. PHP perfor- mance is unlikely to be improved on Linux, although it may be on Solaris or Windows. If you dochoose to upgrade to Apache2, prefork mode is far safer than multithreaded mode, although itdoesn t offer much performance gain over Apache1.05
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision professional web hosting services

Best web hosting - 39Chapter 3Getting Started with PHPCompromise solutionsOf course, outsourcing

Wednesday, April 25th, 2007

39Chapter 3Getting Started with PHPCompromise solutionsOf course, outsourcing and self-hosting are actually poles on a continuum. Several compromisesolutions exist that attempt to offer the best of both worlds. ColocationColocationmeans you crate up your server machine and ship it to the hosting company, whowill hook up your machine to its network and monitor it for you. You are responsible for pur- chasing, licensing, insuring, installing, configuring, and maintaining all software and hard- ware, except the uninterruptible power supply. The host does not mess with your box at all, beyond the occasional reboot for which it generally charges you extra. If you want anytechnical support whatsoever, you must either go to the location yourself or pay hundreds ofdollars an hour for the staff s gentle ministrations and if you re in a colocation situation, chances are good that you re using products for which they have no training. Dedicated serverA dedicated serveris just what it sounds like: The hosting service will buy a server, fit it out to your tastes (on your dime, of course), and hook it up to its network; then all the processorcycles belong to you. Generally, you get technical support with your service. This is muchmore secure than a shared server environment and relatively cost-effective for a midsize site. If you have the administrative chops to run your own server remotely, and more than just ahandful of clients, this option is extremely cost-effective. A lot of the pitfalls of self-hosting still apply, most notably security, which becomes a broader, more difficult discipline every day. A very wise man once said, If security is important to you, unplug your network cable. Not an encouraging maxim to be sure, but this should be a factor perhaps even the main factor in deciding on any option that requires you toadminister your own server. Outsource production, self-host developmentThis option involves two complete setups: an outsourced production siteand an identical in- house development serveror servers. Dividing things up this way can offer the best of bothworlds, letting someone else take the emergency pager messages in the middle of the nightwhile still enjoying the intimacy of playing on your very own server. If you re located in anarea with limited connectivity choices, this option can be a lifesaver. It is also one of the best choices for larger sites with more developers. Installing PHPIf you ve decided to completely outsource PHP hosting and know a competent sysadmin toperform all workstation installs, feel free to skip the rest of this chapter. We are bound, how- ever, to recommend that you install your own software at first, even if it s only on your per- sonal development machine, so that you have more exposure to and understanding of thedevelopment environment, as well as creating a safe place to test your work without jeopar- dizing the security and functionality of production systems. Caution05
Note: In case you are looking for affordable and reliable webhost to host and run your business application check Vision ftp web hosting services

38Part IPHP: The BasicsAlthough finding a good Web (Msn web hosting)

Tuesday, April 24th, 2007

38Part IPHP: The BasicsAlthough finding a good Web hosting service sometimes seems as difficult as finding a life- long mate, there are now listing resources to make it easier: .www.od-site.com/php .www.webhostingtalk.com/ .www.ispcheck.comPay special attention to the user comments, good and bad. Ask your friends and colleaguesabout their experiences. Search the PHP user list archives people occasionally make rec- ommendations and comment on bad experiences they ve had. Probably the single most contentious post-signup issue is throughput. Be wary of the phraseunlimited traffic/bandwidth/hits. Recall the query of the wise middle-aged baseball managerwhen the elderly team owner offered him the job for life: Whose life are we talking about? Analogously, a level of bandwidth that would never be tested by Joe s Epic Poetry AppreciationSite is probably not going to feel quite so roomy to a Web site featuring free streaming video ofscantily clad supermodels. Before you sign up for any deal, you need to assess where you regoing to fall on this continuum. Be extra careful of the amount of disk space that comes with your service plan, especially ifyou have a large or graphics-heavy site. If you exceed the limit, you will generally be chargedexorbitant rates for every fraction of a megabyte of extra space per month. One thing thatcontributes to this problem is log files; delete them or download them to some cheaperform of storage on a regular basis. How to guesstimate your bandwidth needs: 1GB of traffic per month is equal to 100,000views of files averaging 10K (including graphics, text, ads unless they re third-party served, everything measuring from a client, not the server). You do the arithmetic. The self-hosting option: Pros and consSelf-hosting is becoming a realistic option for more sites as the price of connectivity goes down. It s the ultimate in command and control, and it offers substantial security advantages if youhave the expertise to take advantage of them. Running your own setup means problems getsolved faster because you don t have to waste time hanging on a tech support line, and manyjust feel it s more fun. There s just no substitute for being able to put your hands on the actualserver machine whenever you want. Remember that if you have unusual, objectionable, or cutting-edge needs, you may be forced to serve your own site whether you want to or not. On the flip side, self-hosting requires tons more work and can be quite a bit more expensive, especially for the smallish-to-midsize site. Plus, a self-hosted site is going to be only as goodas your available skill set. So if no one on your team knows much about security, you canexpect to have security problems (although, at least, you ll be aware of your weaknesses, unlike the false comfort that comes when your hosting service fails to inform you that theirsecurity expert quit three months ago). More existentially, you have no one to blame but yourself if things go wrong. If you can lookyourself in the mirror every morning and think It s all on me and I feel great, you have thenecessary self-confidence for self-hosting. TipCaution05
Note: In case you are looking for affordable webhost to host and run your web application check Vision http web server services

Top ten web hosting - 37Chapter 3Getting Started with PHPIf you re in one

Tuesday, April 24th, 2007

37Chapter 3Getting Started with PHPIf you re in one of these categories, you need to mention it up front you ll just get the bootanyway once they find out. Chances are good that you won t get to do much shoppingaround if you can find any hosting situation, grab it before they change their minds andlook for a better deal later. Finally, we must mention the most important negative factor of all: the frustration and anxietycaused by a bad hosting experience. Words cannot describe the teeth-grinding, stomach- churning, scream-suppressing state of existence caused by your site crashing just whenyou ve been featured on Slashdot, thereby making you look like a total technoposer as wellaslosing all the good pub you so richly deserve. That s not even mentioning more common problems such as lost e-mail, disappearing DNS, unexplained site outages, deleted databases (this actually happened to us once), lack of back- ups, suffering through an hour-long telephone wait just to talk to some tech supportie who snever been within ten feet of a server, never getting a response to your polite e-mails, andbeing overbilled for the privilege (not that we re bitter, and anyway our lawyer says we can tname any names). Bottom line:If you choose hosting, you do so at your own peril. Always be ready to make aquick getaway, which might entail eschewing the cheapest or most fully featured deal in favorof one without long-term contracts and/or prepayments. Conversely, don t be an utter jerkwhen you deal with the employees of your hosting company. If you ve never outsourced host- ing before, take the time to understand the difference between things you can legitimatelyblame on the Web host (bad tech support) and things that are basically Acts of Fate (Internettraffic in your entire metro area goes out). The detailsIf you ve decided on the hosting option, you will enjoy a plethora of choices in today s mar- ketplace. Novice shoppers should be aware, however, that the term ISP(or even Web host) can mean almost anything these days. Table 3-1 provides a guide to the specializations and their most appropriate uses. (The com- panies mentioned are intended as examples only; this does not constitute an endorsement orrecommendation of their services.) Table 3-1: Varieties of ISPsType of ISPKeywordsPHP UsersConsumer ISPHome DSL, cable modemHome self-hosting of small sites(Earthlink, RoadRunner) Free Web hostFree Web hosting under Small sites, often in exchange for certain circumstancesshowing adsCommercial Web hostingWeb hosting, virtual hosting, Most outsourced sitescolocation, dedicated serverSite developmentDesign, promotion, custom Sites that want to outsource Web development, consultingdevelopment as well as hostingAccess providerT-1, DS-3, commercial DSLSelf-hosters(UUNet)
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision mysql hosting services

36Part IPHP: The (Kids web site) BasicsThere s no cozier feeling than

Tuesday, April 24th, 2007

36Part IPHP: The BasicsThere s no cozier feeling than the one you get just before you fall asleep, knowing that somepoor schmo at your ISP will be getting the pager message in the middle of the night if some- thing goes wrong with your site. Lurking crackers, downed power lines, munged backuptapes all that is your host s headache now. Especially for developers who have little experience with system-administration issues, outsourcing can be a major time saver. Web hosting is also extremely cost effective in most situations. PHP on Linux or one of theBSDs is almost ridiculously inexpensive and widely available. Currently, only a few companiesoffer PHP on an NT server platform, and some of them can be pricey. As the Miracles so eloquently urge, You better shop around (shop, shop ooh). The badOf course, there can be some serious disadvantages to Web hosting. Most of these have to do with control. When you go ISP, you re basically a guest in someoneelse s house and have to play by his rules. Maybe you re a welcome paying guest, a veritableparlor boarder but the fact remains that when you live in someone else s establishment, youcan t just strip down to your undies and lipsync your way through a high-volume version of Proud Mary on the dining-room table whenever you feel like it. People are trying to eat, pal. A few years ago, the most central issue for PHP was module versus CGI. PHP runs best andfastest as a module (in other words, built into the Web server itself rather than running as aseparate process). Almost everyone prefers to use the module version if possible. Some ISPsprefer to run the CGI version of PHP, however, because it s much simpler to administer safelyon a shared Web server. Thankfully, as more Web hosting services set up shop, it s much easier to find one that will give you the module. Currently, the biggest problem with outsourced PHP hosting is the nonavailability of otherprograms. Obviously, ISPs have a strong incentive to control the programs you are allowed torun on their servers. However, a lot of a PHP s value comes from its job as a glue between various services and protocols. It can be extremely frustrating to be prevented from runninga common and useful utility, such as ImageMagick or HTML Tidy, because your Web hostwon t allow you to run unauthorized binaries or link to libraries outside your home directory. Also, ISPs generally are not going to give you a choice of which version of PHP to use. Sometimes they can be quite strict in which extensions they ll build for you, and sometimesthey can be very slow to upgrade to a new major release. Therefore, some PHP packages even potentially some of the code in this book, if your host is a late adopter of PHP5 willnot run for you unaltered. A good rule of thumb is: The more common your needs are, the more possible and appropri- ate it is to outsource your hosting. The more oddball and/or bleeding-edge your needs are, the more you re going to be pushed to host your own whether you want to or not. Of coursethe unspoken realpolitik addendum to this is: The bigger you are and the more money youhave to spend, the more weight you have available to throw around. A few factors will make it considerably more difficult for you to find a hosting service: .Generally objectionable content (hate, porn) .Unsolicited mailings (aka spam) .Content that attracts crackers (security info) .Potentially legally actionable content .Need for unusual server-side hardware, OS, or software .Need for super-high bandwidth, especially if unpredictable05
Note: If you are looking for high quality webhost to host and run your jsp application check Vision christian web host services

Web hosting bandwidth - Getting Startedwith PHPIn this chapter, we ll discuss the

Monday, April 23rd, 2007

Getting Startedwith PHPIn this chapter, we ll discuss the pros and cons of the various Webhosting options: outsourcing, self-hosting, and various compro- mises. Then we ll give detailed directions for installing PHP and finishwith a few tips on finding the right development tool. By the end ofthe chapter, you should be ready to write your first script. Hosting versus DIYThe first major decision you need to make is: Who will host your PHP- enabled Web site you or a Web hosting service? Also, will you needa separate development setup; if so, who will host it? If you ve alreadymade these decisions (and knew what you were doing), feel free toskip right to the installation section of this chapter, Installing PHP. The ISP optionRemote hosting is a very popular option as a large number of companies probably the vast majority of Webhosts today offerPHP-enabled Web sites. These are some basic pros and cons to keepin mind. The goodOutsourced hosting has a lot of advantages. The ISP will (in theory) handle many of the crucial technical and administrative details nec- essary to keep a site running, such as: .Hardware .Software upgrades .InterNIC registration, IP addressing, DNS .Mail servers (POP/IMAP and SMTP) .Bandwidth .Power supply .Backups .Security33CHAPTER …In This ChapterDeciding to outsourceor self-hostFinding the right ISPAvoiding commonhosting pitfallsInstalling PHPChoosing a PHPdevelopment tool …
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision web design programs services

33Chapter 2Server-Side Web ScriptingBut (Web domain) enough rhetoric! Now that

Monday, April 23rd, 2007

33Chapter 2Server-Side Web ScriptingBut enough rhetoric! Now that you have a firm grasp of the differences between client-sideand server-side technologies, you can get on to the practical stuff. In Chapter 3, we show youhow to get, install, and configure PHP for yourself (or find someone to do it for you). SummaryTo understand what PHP (or any server-side scripting technology) can do for you, having afirm grasp on the division of labor between client and server is crucial. In this chapter, wework through examples of plain, static HTML; HTML with client-side additions such asJavaScript and Cascading Style Sheets; and PHP-generated Web pages as viewed from boththe server and the client. Client-side scripting can be visually attractive and quickly responsive to user inputs, but any- thing beyond the most basic HTML is subject to browser variation. Static client-side scriptsalso require more developer time to maintain and update, because pages cannot be dynami- cally generated from a constantly changing datastore. Server-side programming and scriptinglanguages, such as PHP, can connect databases and other servers to Web pages. Since version 4, PHP differs architecturally from some other server-side tools and even fromPHP3. PHP is now dynamically compiled, which makes it faster at runtime. Since PHP4, thescripting engine, Zend, has also been separate from the scripting language (PHP). …
Note: If you are looking for cheap webhost to host and run your apache application check Vision apache web hosting services

Apache web server - 32Part IPHP: The BasicsRecent developments in programming languages

Monday, April 23rd, 2007

32Part IPHP: The BasicsRecent developments in programming languages are increasingly blurring the differencebetween programmingand scripting. PHP, for example, definitely uses most of the samecontrol structures as other programming languages do. Fully interpreted HTML-embeddedlanguages such as ASP, however, are still considered to be on the scripting side of the line, whereas separately compiled binaries are a definite mark of programming. But because PHPsince version 4 is dynamically compiled, it s officially a real programming language anddon t let anyone tell you otherwise. This change accounts for much of the screaming speedof PHP nowadays, which moves into the same class as Perl. What Is Server-Side Scripting Good for? The client looks good, but the server cooks good. What server-side scripting lacks in eye- candy sex appeal, it more than makes up for in sheer usefulness. Most Web users probablyinteract with the products of server-side scripting on a daily, if not an hourly, basis. One category of things that server-side scripting just absolutely can t help you with is real- time, 3-D shoot- em-ups. The more immediately responsive and graphics-intensive a projectneeds to be, the less suitable (and capable) PHP is for it. At the moment, the Web is simplytoo slow a channel for these purposes (although broadband users are changing that). On the other hand, server-side scripting languages such as PHP perfectly serve most of thetruly useful aspects of the Web, as such as the items in this list: .Content sites (both production and display) .Community features (forums, bulletin boards, and so on) .E-mail (Web mail, mail forwarding, and sending mail from a Web application) .Customer-support and technical-support systems .Advertising networks .Web-delivered business applications .Directories and membership rolls .Surveys, polls, and tests .Filling out and submitting forms online .Personalization technologies .Groupware .Catalog, brochure, and informational sites .Games (for example, chess) with lots of logic but simple/static graphics .Any other application that needs to connect a backend server (database, LDAP, and soon) to a Web serverPHP can handle all these essential tasks and then some. Note04
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision j2ee hosting services

31Chapter 2Server-Side Web Scripting Just forFun: the story (Yahoo free web hosting)

Monday, April 23rd, 2007

31Chapter 2Server-Side Web Scripting

Just forFun: the story of an accidentalrevolutionaryLinus Torvalds and David Diamond
Red HatLinux 7.2 BibleChristopher Negus
The HackerEthicPekka Himanen
Rebel Code: Linux and the Open Source revolutionGlynMoody
This particular page isn t significantly more impressive to look at than the plain HTML ver- sion at the beginning of the chapter. Passing one different variable, however, results in theautomatic generation of any number of unique pages in this case, pages listing the booksby criteria other than the author s last name without any further work. If we add some newbooks about another company to the database, these lists automatically get updated toreflect the new data on each subsequent page load. As you can see from these two different source-code listings, you cannot view server-sidescripts from the client. All the heavy lifting happens before the code gets shoved down thepipe to the client. After emerging from the Web server, the code appears on the other end asnormal HTML and JavaScript, which also means that you can t tell which server-side script- ing language was used unless something in the header or URL gives it away (which usually isthe case, as the page you are requesting often ends with .jspor .php). These scripts, inci- dentally, were written in PHP using the MySQL database as back end; you can learn all aboutthese techniques in Part II of this book. Server-side or Client-side? There are client-side methods and server-side methods to accomplish many tasks. When sendinge-mail, for example, the client-side way is to open up the mail client software with a pread- dressed blank e-mail message after the user clicks a MAILTO link. The server-side method is tomake the user fill out a form, and the contents are formatted as an e-mail that gets sent via anSMTP server (which very well could be the same machine as the server-side script is executingon). You can also choose between client methods and server methods of browser-sniffing, form-validation, drop-down lists, and arithmetic calculation. Sometimes you see subtle butmeaningful differences in functionality (server-side drop-downs can be assembled dynamically; client-side cannot) but not always. How to choose? Know your audience. Server-side methods are generally a bit slower at runtimebecause of the extra transits they must make, but they don t assume anything about your visitor sbrowser capabilities and take less developer time to maintain. These qualities make them goodfor mass-market and educational sites. If you re one of the lucky few developers who s absolutelypositive that your visitors all have up-to-date browsers and good throughput, you can feel free togo wild with the scripting and graphics. Finally, remember that you can use PHP to generate bothstatic HTML and JavaScript thus enjoying the best of both worlds, as we explain in Chapter 38.04
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision best web hosting services

30Part IPHP: The Basics// if it s not the (Web site layout)

Sunday, April 22nd, 2007

30Part IPHP: The Basics// if it s not the first (null) option, go thereif( site >= 1 ) { top.location = form.elements[i].options[site].value; } // and then reselect the null (it functions as a label) form.elements[i].selectedIndex = 0; } //–>

TechBiz
BookGuide


HOME

More
Groups

Linux
BSD
Apache
PHP


Books About Linux


Originally the hobby of aFinnish university student, Linux (aka Gnu/Linux) is now thefastest-growing operating system on the planet.

Note: If you are looking for best quality webspace to host and run your tomcat application check Vision shared web hosting services