Home

For Dummies HTML, XHTML and CSS, 2nd Edition

image

Contents

1. Rename index php to index php old or something similar It s still there if you want it but now there s no index page and Apache simply gives you a list of files and folders in the current directory Figure 1 3 shows my local host directory as I see it through the browser E index of Mozilla Firefox Jol Ele Edt View History Bookmarks Tools Help OD x a Gene vy a Pe O andex of Index of Name Last modified Size Description B index off html 20 Dec 2009 00 00 44 index off php 20 Dec 2009 00 00 256 E practice php 25 Jan 2010 14 42 138 xampp 20 Dec 2009 00 00 Apache 2 2 14 Win32 DAV 2 mod_ssi 2 2 14 OpenSSL 0 9 81 mod_autoindex color PHP 5 3 1 mod_apreq2 20090110 2 7 1 mod_perl 2 0 4 Perl v5 10 1 Server at localhost Port 80 You typically don t want users to see this ugly index in a production server but I prefer it in a development environment so that I can see exactly what s on my server After everything is ready to go I put together index html or index php pages to generate more professional directories Generally you want to have subdirectories to all your main projects I added a few others for my own use including xfd which contains all the code for this book If you want to display the XAMPP welcome screen after you remove the index php program simply point your browser to http localhost xampp Book VIII Chapter 1 SI9M3S Jno ueue 876
2. wbs El ino Ebe E us ica 5 E re Do D cout lime Regiter Tronsfer Check all uncheck all Dew OvcomaO sce Ocz Over O moti O e Ode On E aharnsbooks cor O O z O name O cc we Oe O comms O org uk O meuk C Oa Oou Oasa E neta O onn O aen E comen O neren E oroen E O com w C oratu E idv tw Setup New Account I year 9 95 yr ja Request Transfor s on COU limit 4 1 year O 9 95 yr a st Transfer Service In tse Available A sharnizbocks org 1year g s 95 yr w Domains 2 8 E S 3 37 m 7 253 sharnabooks we by i yenr 4 50 yr N 5 29 _ 6 If the domain name is available to register and you want to own it purchase it immediately If a domain is available to transfer it means that somebody else prob ably owns it Don t search for domains until you re ready to buy them Unscrupulous people on the Web look for domains that have been searched and then buy them immediately hoping to sell them back to you at a higher price If you search for a domain name and then go back the next day to buy it you often find that it s no longer available and must be transferred I ve also seen people offer to sell you a domain they do not own buy it up and sell it at a huge markup Figure 1 16 Registering the domain name Managing Data Remotely 8 9 1 7 Register the domain The domain purchase process involves regis
3. Chapter 1 for a review of other server side languages A data server Many of your programs work with data and they need some sort of application to deal with that data The most common data server in the open source world is MySQL This data package is free powerful and flexible The data server is also running in the background all the time You have to configure PHP to know that it has access to MySQL A mail server If your programs send and receive e mail you need some sort of e mail server The most popular e mail server in the Windows world is Mercury Mail and Sendmail is popular in the world of Unix and Linux You probably won t bother with this item on a home server but you should know about it when you re using a remote host Book VIII Chapter 1 SI9M3S Jno ueue 872 Creating Vour Own Server with XAMPP An FIP server Sometimes you want the ability to send files to your server remotely The FTP server allows this capability Again you proba bly don t need this item for your own machine but you definitely should know about it when you use a remote host phpMyAdmin There s a command line interface to MySQL but it s lim ited and awkward The easiest way to access your MySQL databases is to use the phpMyAdmin program Because it s a series of PHP programs it requires a complete installation of PHP MySQL and Apache but nor mally you install all these things together anyway Creating Vour O
4. Creating Your Own Server with KAMPP 8 73 XAMPP installation is pretty painless Simply download the installer and respond to all the default values I oom If you use Vista or Windows 7 you may want to change where the package is installed because the program files directory causes problems for some users Running XAMPP After you install XAMPP you can manage your new tools with the XAMPP Control Panel Figure 1 1 shows this program in action EJ XAMPP Control Panel pplication Woe scrip eL amiat Modules Eort Check Sve Apache Running _ Stop Admin Explore Osve MySql Running Stop Admin scm Figure 1 1 Sve FileZilla stat Refresh XAMPP Svc Mercury astat Ghe Control romet exit Panel XAMPP for Windows Versior a allows Windows 5 1 Build 2 Platform 2 Service Pack 2 you to turn features on and off Some components of XAMPP PHP for example run only when they re needed Some other components Apache and MySQL are meant to run con stantly in the background Before you start working with your server you need to ensure that it s turned on You can choose to run Apache and MySQL as a service which means that Book VIII the program is always running in the background This arrangement is con Chapter 1 venient but it slightly reduces the performance of your machine I generally turn Apache on and off as I need it and leave MySQL running as a service z because I h
5. If a Web server stops working anybody trying to reach the pages on that server is out of luck This is why Web servers frequently run Unix or Linux because these operating systems tend to be especially stable Servers must have specialized software The element that truly makes a computer a server is the presence of Web server software Although several options are available only two dominate the market Apache and Microsoft IIS Parts of a client side development system A development system is made up of several components lf you re program ming on the client using XHTML CSS and JavaScript you need the follow ing tools Web browsers You need at least a couple of browsers so that you can see how your programs behave in different ones Firefox is especially useful for Web developers because of its numerous available extensions Browser extensions Consider adding extensions to Firefox to improve your editing experience Web Developer Firebug and HTML Validator are extremely helpful Text editor Almost all Web development happens with plain text files A standard text editor should be part of your standard toolkit I prefer ar Understanding Clients and Servers 871 Notepad for Windows and prefer VI or Emacs for other operating systems Integrated Development Environment Komodo Edit and Aptana Studio are specialized text editors with added features for Web programming They understand all the main Web la
6. of permission for each file Each of the permissions is a Boolean true or false value Read permission The file can be read Typically you want everybody to be able to read your files or else you wouldn t put them on the Web server Write permission The file can be written changed and deleted Obviously only you should have the ability to write to your files Execute permission Indicates that the file is an executable program or a directory that can be passed through Normally none of your files is considered executable although all your directories are Using FTP to manage your site Most of the work is done on a local machine and then sent to the server in a big batch That s how I did everything in this book The standard Web based file management tools are pretty frustrating when you want to effi ciently upload a large number of files Figure 1 10 Configuring the FTP server Managing a Remote Site 885 Fortunately most hosts have the FTP File Transfer Protocol system avail able FTP is a client server mechanism for transferring files efficiently To use it you may have to configure some sort of FTP server on the host to find out which settings username and password you should use Figure 1 10 shows the Freehostia Control Panel with this information displayed E Free Hostia Mozilla Firefox Jeg Ele Edt wex Hetory pookmarks Tools Help C x Fil frech T ia ac x 94355 aE c fs Xx
7. 13 11 10 06 09 03 13 21 10 06 09 03 13 11 03 13 11 19 06 09 93 13 11 10 06 09 03 13 21 Name ve Options Sze a Perms Lact Accezz0d 10 06 05 03 13 11 Reload Delete j Copy Move Downoad LTopkevel Permission it Change https ep Fecha comjmembers Rlemanager2jeclt le php7path 6zFwnwSkZFaharnebooks netsk2F dszFbock_l9kiFchater_2 42Faflename bahxXaGuibHctmnnbwWa Bch 7 K DOCTYPE html PUBLIC W3C DID XHTML 2 0 Serict EN http wew w3 org TR xhtmli DID xhtmli strict dtd gt lt html xmlas e http www w3 org 1999 xhtml gt lt head gt lt meta http equive Content Type contence text html chi lt oxWheelad html gt lt Fixed the firat paragraph to give it an end tag gt lt titlesThe Oxen and the Wheels lt title gt lt head gt lt bedy gt lt h1 gt The Oxen and che Wheels lt ni gt lt h2 gt From Aesop s Faplesc h2 gt lt p gt 0 8859 1 gt A pair of Oxen were drawing a heavily loaded wagon along a miry country road They had to use all their strength to pull the wagon but they did not complain lt p gt lt p gt The Wheels of the wagon were of a different sort Though the task they had to do was very light compared with that of the Oxen they creaked and groaned at every turn The poor Oxen pulling with all their might co draw the wagon through che deep mud had their ears filled with ne loud complaining of the Wheel
8. 9 Remember to renew your domain registration Domain name registration isn t expensive typically about 10 per year but you must renew it or risk losing it Managing Data Remotely Web sites often work with databases Your hosting service may have fea tures for working with MySQL databases remotely You should understand Book VIII Chapter 1 SI8M3S Jno ueue 8 92 Managing Data Remotely Figure 1 17 You often have to create a database outside of phpMy Admin how this process works because it s often slightly different from working with the database on your local machine Creating your database Often a tool like the one shown in Figure 1 17 allows you to pick a defined database or create a new one Gree Hostia Mozilla Firefox m x Ele Edt wew History Bookmarks Tools Help Co cecx a ric fetore waa S Bee Pg E Free Hostia Welcome Andy fz Free Hostia Control Panel Site Management t mail Options Home S Logout andharso 10 293210 S GS a Egin Iv CPintra Visit Store Change theme Live Stats Help Center _ Web Tools J 5 My Account sharrisbooks com EJ MySQL Databases Tie 7 Quick Controls Most of the web applications require a database where they store various settings and data This section allows you to create faama cr delete databaze as well as to manage Rs content Add Services Uporades Video Tutori
9. can install it yourself Does the host provide access to a database Is phpMyAdmin support provided How many databases do you get What is the size limit What sort of Control Panel does the service provide Does it allow easy access to all the features you need What type of file management is used For example determine how you upload files to the system Most services use browser based upload ing This system is fine for small projects but it s quite inconvenient if you have a large number of files you want to transfer Look for FTP sup port to handle this Does the host have an inactivity policy Many free hosting services automatically shut down your site if you don t do anything with it usu ally after 30 to 90 days of inactivity Be sure you know about this policy Do you have assurances that the server will remain online Are back ups available What sort of support is available Note that these ser vices are much more likely on a paid server Book VIII Chapter 1 SI9M3S Jno ueue 880 Choosing a Web Host How easily can you upgrade if you want Does a particular hosting plan meet your needs without being too expensive Does the service offer you a subdomain and can you register your own You may also want to redirect a domain that you didn t get through the service See the section Naming Your Site later in this chapter for information on domain names What kind of support is ava
10. names simplify addressing IP numbers are too confusing for human users The Domain Name System DNS is a series of databases connecting Web site names with their associated IP numbers When you type http www google com for example the DNS system looks up the text www google com and finds the computer with the associ ated IP You have to register a DNS name Of course to ensure that a particular name is associated with a page you need to register that relationship Registering a domain name In this section I show you how to register a domain using Freehostia com Check the documentation on your hosting service Chances are that the main technique is similar even if the details are different To add a domain name to your site follow these steps 1 Log in to the service Log in to your hosting service administration panel You usually see a Control Panel something like the one shown in Figure 1 13 2 Find the domain manager In Freehostia the domain manager is part of the regular administration panel 3 Pick a subdomain In a free hosting service the main domain freehostia con for example is often chosen for you Sometimes you can set a subdomain ike mystuff freehostia com for free The page for managing this process might look like Figure 1 14 Figure 1 13 This Control Panel shows all the options including domain and subdomain tools Figure 1 14 Use this page to create a subdoma
11. rerlic trates Se Pi E Free Hostia B Welcome Andy Home SLogout andharso ID 293316 2 Free Hostia Control Panel amp Esaten lx CPintro visit Store Change Theme Site Management E mail Options Web Tools 5 Live Stats Help Center My Account h Site Management oa amen 2 bed 8 4 2 ra Hosted Domains Domain Manager Subcomain Manager Custom ONS Records FTP Manager E Change Plan Renew Pian 2 aa a 2 2 Realster transfer E J my best domain com cn File Manager FrontPage Extensions MySQL Databases Password Protected Areas Sst aN N Setup New Account cS b PHP Settings E mail Options Ea a P gt D Plan Advanced bannerless In Use Available E mail Manager E mail fitters SPF Protection E mail forwarding Webmail 2 8 3 97 293 s 5 295 2 o Mailing Liste Book VIII Chapter 1 s1 M Jno ueue 882 Managing a Remote Site Figure 1 7 This file management tool allows you to manipulate the files on your system There s usually some sort of file management tool that might look like the one shown in Figure 1 7 Froe Hostia Mozilla Firefox tf Ble Edt ew History Bookmarks Tools Hep lt C X amp le htrs io freehostia comimembersjtenenecer Re E 2G E Free Hostia la E Add Seevices Uparndes 1 f Changs Plan Create New File Folder Qy watch Disk Usage 779 3 ME of 10000
12. Chapter 1 Managing Vour Servers In This Chapter Understanding the client server relationship Reviewing tools for client side development Gathering server side development tools Installing a local server with XAMPP Setting essential security settings v Choosing a remote server Managing the remote servers v Choosing and registering a domain name W pages are a complex undertaking The basic Web page itself isn t too overwhelming but Web pages are unique because they have meaning only in the context of the Internet a vastly new undertaking with unique rules Depending where you are on your Web development journey you may need to understand the entire architecture or you may be satisfied with a smaller part Still you should have a basic idea of how the Internet works and how the various technologies described in this book fit in Understanding Clients and Servers A person using the Web is a client You can also think of the user s computer or browser as the client Clients on the Internet have certain characteristics Clients are controlled by individual users You have no control over what kind of connection or computer the user has It may not even be a computer but may be instead a cellphone or I m not kidding refrigerator Clients have temporary connections Clients typically don t have per manent connections to the Internet Even if a machine is on a perma nent network most machines used as clients hav
13. Creating Vour Own Server with XAMPP as Figure 1 4 The XAMPP Security panel shows a few weaknesses Setting the security level When you have a Web server and a data server running you create some major security holes You should take a few precautions to ensure that you re reasonably safe Treat your server only as a local asset Don t run a home installation of Apache as a production server Use it only for testing purposes Use a remote host for the actual deployment of your files It s prepared for all the security headaches Run a firewall You should run at an absolute minimum the Windows firewall that comes with all recent versions of Windows or the equiva lent for your OS You might also consider an open source or commer cial firewall Block incoming access to all ports by default and open them only when needed There s no real need to allow incoming access to your Web server You only need to run it in localhost mode The ports XAMPP uses for various tools are listed on the security screen shown in Figure 1 4 Run basic security checks The XAMPP package has a handy security screen Figure 1 4 shows the essential security measures I ve already adjusted my security level so you ll probably have a few more red lights than I do Click the security link at the bottom of the page for some easy to use security utilities Ble Edt wew History Ecckmarks Tools Help B C X amp E
14. MB F Renew Pian video Buy 2 space M75 Register transfer geate my best domaim com GOL empty folder empty file a Pan i Path co Host Shortcuts Choose domain MJ E Setup New Account Reload j Odete j Copy Move j Downoad Toplevel Permission Lchange Salact All Clear Selaction Q Watch Video Name Options Size a gt Perms Last Accessed x loas 55 1 o 03 3 Co me T Z5 i a z O waw Z5 10 01 7 03 13 5 4 5 Wate d Select All Clear Selection 2 eat 3 MySQL DB s Reload _ Delete Copy Mowe Download Toplevel Permission TM i Change MySQL MB 52 aran Trafic 66 Upload file Q Watch video Storage MB o 9220 70 Files 16196 33804 In this particular case all my Web files are in the www aharrisbooks net directory so I click to see them Figure 1 8 shows what you might see in an actual directory This page allows you to rename upload and edit existing files and change file permissions You can create or edit files with a simple integrated editor build a new file with the Create File button Type a filename into the text area and click the button You can also click the edit button next to a file and the file will open in the editor In either case the text editor shown in Figure 1 9 appears You can write an entire Web site using this type of editor but the Web based text editing isn t helpful an
15. a EEE ERS https icp freehostis com imembersifin tacton adtifin 02434355 cy 88 PG E Free Hostia z gt Welcome Andy Home Logout andhar30 1D 293316 je zr Free Hostia Control Panel e amp Jules M CPintra Visit Store Change theme Site Management E mail Opbons Web tools Live Stats Help Center My Account sharrisbooks com al 8 FTP Manager Tir 2 Quick Controls FTP Manager Edit FTP account ami Video Tutoriale Shomsde Hola 5 Add Services Uporades Ba Username andharS0 Change Plan Siena Access Path Dassmord seeeee a z 0 8 2 20 symbols Beatster transfer m e type Fass my best domam com GOL Apply Ji Cancel E Setup New Account Plan Advanced bannerless i Renew Pian Expires on July 23 2013 SMTP ON COU limit 48 Service InUse Available Domains 2 8 Subdomains 3 37 Aliases 7 253 E mails 5 285 Mailing Lists o o i an a a F x Tere WEE You also need an FTP client Fortunately many free clients are available I like FireFTP for a number of reasons It s free and open source That s always a bonus It works as a Firefox plugin I always know where it is It s easy to use It feels just like a file manager Figure 1 11 shows FireFTP running in my browser Book VIII Chapter 1 SI9M3S Jno ueue 886 Managing a Remote Site Figure 1 11 FireFTP is a complete FTP program that ru
16. als Show Hide Help d E Changa Plan Database Name F Renew Plan a should net be longer than 16 characters incl username_ 209har30_ Beatster tronsfer my best domam com Panavord a z 0 9 2 20 nymbals Re type Password be Add SQL Database E Setup New Account vidan Tutorials Show Hide Help Database Name Database Username phpMyAdmin Size Change Password Delete Plan Advanced bannerles g Renew Plan 1 endherSd xfd a 56 ka 2 xpires o J 2 a Expires on July 23 2013 om Sats a y a SMTP ON E CPU lima 4 bn s15 Ka A x Service In Use Available s Domains 2 s Py 184 Ka Subdomains 3 37 Aliazes 7 253 Database Server myscli freebostin com E mails 5 285 Mailing Lists o o b a Tere Ea This database creation step happens because you don t have root access to MySQL lf everybody had root access chaos would ensue Instead you usually have an assigned username and database name enforced by the server On Freehostia all database names begin with the username and an underscore To create a new database you need to provide a database name and a password Usually a MySQL user is created with the same name as the database name After you create the database you can select it to work with the data in MySQL Figure 1 18 shows the MySQL screen for my database on Freehostia Managing Data Remotely mysqld frechostia com phpMyAdmin 2 6 4 pl2 Mozilla Firef
17. an A typical home connection doesn t have the guaranteed IP number you need Besides you probably signed an agreement with your broadband pro vider that you won t run a public Web server from your account This situation isn t really a problem because thousands of Web hosting ser vices are available that let you easily host your files You should consider an external Web host for these reasons The host not you handles the security headaches This reason alone is sufficient Security isn t difficult but it s a never ending problem because the bad guys keep finding new loopholes The remote server is always up Or at least it should be The dedicated Web server isn t doing anything other than serving Web pages Your Web pages are available even if your computer is turned off or doing something else A dedicated server has a permanent IP address Unlike most home con nections a dedicated server has an IP address permanently assigned to it You can easily connect a domain name to a permanent server so that users can easily connect Ancillary services usually exist Many remote hosting services offer other services like databases FTP and e mail hosting The price can be quite reasonable Hosting is a competitive market which means that some good deals are available Decent hosting is avail able for free and improved services are extremely reasonable Choosing a Web Host 879 You can find a number of
18. as shown in Figure 1 5 I show an alternative way to change the password in Book VI Chapter 1 Ble Edt wew History Ecekmarks Tools Help lt JIC X A Eheeahostseanty Te EN AS KAMPF 1 7 3 S XAMPP 1 7 3 Bl Tal E XAMPP for Windows XAMPP F PHP 5 3 1 Security Security console MySQL amp XAMPP directory protection Languages Eoen MYSQL SECTION ROOT PASSWORD Ne Fences MySQL SuperUser root Polski Slovene Current password eoeeee najan New password eveeeee X Espanol Repeat the new password eeccecce an Portugu s phpMyAdmin authentication http cookie Portugu s EU eee Set a random password for the Yes No E z phpMyAdmin user pma Figure 1 5 2002 2000 Changing a pe th e Mys QL File C xarnpp security mysqlrootpasswd txt root password ae T AA L Dere 0 Add an XAMPP Directory password Type a password into the lower half of the security form to protect your xampp directory from unau thorized access When you try to go to the xampp directory you re ted for thi d prompted for this passwor ret Security is always a compromise When you add security you often intro Shonen duce limits in functionality For example if you changed the root password for MySQL some of the examples and phpMyAdmin may not work any more because they re assuming that the password is blank You often have to tweak See Chapter 1 in Book VI for a com
19. ave a number of other programs that work with MySQL A 5 2e NING Leaving server programs open on your machine constitutes a security 5 v hazard Be sure to take adequate security precautions See the section GE Setting the security level later in this chapter for information on setting S up your security features 8 14 Creating Your Own Server with XAMPP Figure 1 2 The XAMPP main page Testing your XAMPP configuration Ensure that Apache and MySQL are running and then open your Web browser Set the address to http localhost and you see a screen like the one shown in Figure 1 2 E xampp 1 7 3 XAM P P for Wi ndows English Deutsch Francais Nederlands Polski Slovene Italiano Non gPa BE Portugu s Portugu s Brasil IBRI XAMPP 1 7 3 Congratulations Security You have successfully installed XAMPP on this system guages Now you can start using Apache and Co You should first try Status on the left navigation to make phpinfa sure everything works fine pearinfa perlinfo For OpenSSL support please use the test certificate with https 127 0 0 1 or https localhost aspinfo And very important Big thanks for help and support to Nemesis KriS Boppy Pe Durnmy and all other friends of XAMPP CD Collection Good luck Kay Vogelgesang Kai Oswald Seidler Carsten Wiedmann Blorhythm Instant Art Flash Art Phone Book Guest Book phpMyAdmin Webali
20. d it s kind of awkward More often you create your files on your own XAMPP system and upload them to the server when they re basically complete Use server side editing features for quick fixes only Figure 1 8 Now you can see some files here Figure 1 9 The hosting service has a limited text editor Managing a Remote Site 883 home www feharrisbooks net xfd ibook 1 chapter 2 Path Avawiaharrisbooks net efd book_1 chapter_2 ao Host Shortcuts Choose domain l Rebed j Odete j __Copy t Account Usage Plan Advanced bannerless Eenew Pian Expires on July 23 2023 SMTP ON COU limat 45 Service Domains Subdomains Aliases E mails Cunleval m index htm In Une Mailing Lists MySQL OB s 2 MySQLMB 24 52 55 43 Traffic MB 52 39 119997 65 Storage MB 779 30 9220 70 Files 16296 33804 0 oxwheelss htmi D E oxwheeles bern ly p oxwheelscorrect htm template btrnt p templatecopy hem W atch lact Al S Q viatch Select All Clear Selection a Wiatch Select all Clear Selection Select all Clear Selection 7 Cowrload Top Level Permission Ta ichange AE AEA He sKkKawr He sKkKoaer He ea HeesKkoaer M e eae GAE Eg Yet sKkaw HeSKkKaer 1 49KB 75 141 KB 1 33 Kb 1 33 KB EEE 1 34 KB 3 1 53 KB k E 1 53 KB 0 31 KB g 0 60 KB o9 03 13 11 10 06 05 03 13 11 10 06 09 03
21. e temporarily assigned addresses that can change Clients might have wonderful resources Client machines may have mul timedia capabilities a mouse and real time interactivity with the user 870 Understanding Clients and Servers Clients are limited Web browsers and other client side software are often limited so that programs accessed over the Internet can t make major changes to the local file system For this reason most client pro grams operate in a sort of sandbox to prevent malicious coding Clients can be turned off without penalty It doesn t really cause any body else a problem if you turn off your computer Generally client machines can be turned off or moved without any problems Servers are the machines that typically host Web pages They have a much different set of characteristics Servers are controlled by server administrators A server administrator is responsible for ensuring that all data on the server is secure Servers have permanent connections The purpose of a server is to accept requests from clients For this reason a server needs to have an IP number permanently assigned to it Servers usually have names too To make things easier for users server administrators usually register domain names to make their serv ers easier to find Servers can access other programs Web servers often talk to other pro grams or computers especially data servers Servers must be reliable
22. free hosting services at sites like http free webhosts com Finding a hosting service When looking for a hosting service ask yourself these questions Does the service have limitations on the types of pages you can host Some servers are strictly for personal use and some allow commercial sites Some have bandwidth restrictions and close your site if you draw too many requests How much space are you given Ordinary Web pages and databases don t require a huge amount of space but if you do a lot of work with images audio and video files your space needs will increase dramatically Is advertising forced on you Many free hosting services make money by forcing advertisements on your pages This practice can create a problem because you might not always want to associate your page with the company being advertised A page for a day care center probably should not have advertisements for dating services for example Which scripting languages if any are supported Look for PHP support Does the host offer prebuilt scripts Many hosts offer a series of pre built and preinstalled scripts These can often include content manage ment systems message boards and other extremely useful tools If you know that you re going to need Moodle for example a course manage ment tool for teachers you can look for hosting services that have it built in If a tool you want isn t there make sure you have FTP access so you
23. httespocatcstisecunty XAMPP 1 7 3 XAMPP 1 7 3 a El Portugu s Gray The Tomcat add on is not installalled XAMPP for Windows XAMPP i PHP 5 3 1 XAMPP SECURITY Security Check 1 1 Security This page gives you a quick overview of the security status of your XAMPP installation Please continue reading after the table IEJ __Languages English Deutsch These XAMPP pages are not accessible through the network by anyone Nadarlants The MySQL admin user root has a password Polski PhpMyAdmin is freely accessible by network Slovene PhpMyAdmin is accessible by network without a password Itallano n the config inc php The configuration httpd o A FTP server is not running or is blocked by a firewall ies The test user newuser for the POP3 server Mercury Mail does not Portugu s exist anymore or has a new password A one she The green marked points are secure the red marked points are definitively unsecure and the yellow FRIENDS marked points couldn t be checked for example because the sofware to check isn t running To fix the problems for mysql phpmyadmin and the xampp directory simply use gt http localhost security xamppsecurity php lt Some other important notes Creating Vour Own Server with KAMPP 877 Change the MySQL root password If you haven t already done so use the security link to change the MySQL root password
24. ilable Most hosting services have some kind of support mechanism with e mail or ticket systems Some hosts offer live chat and some have telephone support Talking to a real human in real time can be extremely helpful and this is often worth paying for Connecting to a hosting service The sample pages for this book are hosted on Freehostia com an excellent free hosting service You can find many great hosting services but the rest of the examples in this chapter use Freehostia I chose this service for the examples because Its free account is terrific At the time of this writing the features of the free account at Freehostia are as good as they are at many paid accounts The pages have no forced advertising Freehostia doesn t place any ads on your pages a major selling point for me PHP phpMyAdmin and MySQL are supported all on the free account Often you have to upgrade to a paid service to get these features You get enough space to start with The free account comes with 250MB of space This amount is fine for ordinary Web pages PHP and database needs You need more though if you do a lot of image or video hosting You can have a subdomain for free Even if your site doesn t have a domain name you can choose a subdomain so that your site has a rec ognizable address like http myStuff freehostia com It has a good list of script installers It comes with a nice batch of scripts that you can instal
25. in for your account Naming Vour Site 889 add Services Upgrades Changs Plan E Renew Pian Reatster transfer my best domam com Sign up E Setup New Account Account Usage Plan Advanced bannerless Eancw Pian Expires on July 23 2013 SMTP ON COU limit 4 Sennre Domains Subdomains Aliases E mails Mailing Lists In Use PHP Settings a FrontPage Extensions Subdomain Manager 5 MySQL Databases Custom ONS Records Password Protected Areas E mail Options E mail Manager 3 Mailing Lists E mail Forwarding Ble Edt wew History Bookmarks Tools Help e amp Pintra vian Store Add Services uparades E Change Plan E Renew Pian Siga wp Setup New Account Account Usage Plan Advanced bannerless Benew Pian Expires on July 23 2013 SMTP ON COU limit 4 Service Domains Subdomains Aliases E mails Mailing Lists In Use In this section you are able to create subdomain names for your exciting domains which you host In the account Use the Sia Subdomain Manager form below to create new subdomains and manage their settings Create anew subdomain Specify path for filex Set Eror 404 page Aubdomain fi bharebooks com aa IP Address 1 fano Leave blank for default pas Leave blank for defadt aor page e g http mum my beatdamai
26. l effortlessly The upgrade policy is reasonable Freehostia makes money on commer cial Web hosting It offers an excellent free service that ideally gets you hooked so that you then upgrade to a commercial plan It has a number of good upgrade packages for various sizes of businesses Managing a Remote Site 881 You get a nice batch of extras The free service comes with FTP and e mail support and also a MySQL database Customer support is excellent Most free hosting services offer no customer support Freehostia provides good support even to the free services I asked a couple of questions before anyone there knew that I was writing this book and I was impressed with the speed and reliability of the responses Choose whichever hosting service works for you If you find a free hosting service that you really like upgrade to a paid service Hosting is a reasonably cheap commodity and a quality hosting service is well worth the investment Managing a Remote Site Figure 1 6 This Control Panel allows you to manage your site remotely Obviously having a hosting service isn t much fun if you don t have pages there Fortunately there are a lot of ways to work with your new site Using Web based file tools Most of the time your host has some sort of Control Panel that looks like the one shown in Figure 1 6 G Free Hostia Mozilla Firefox Jog Fle Edt wew History Bookmarks Tools Help CS RR
27. n com 404 html Activate FrontPage Extensions C Activate Ascens amp Eror toga E Secure Socket Layer SSL Subdomain listing Do not use SSL m Add Subdomain My Account vidan Tutorials Show ide Help Book VIII Chapter 1 SI9M3 Jno ueue 890 Naming Vour Site Figure 1 15 I m searching for aharris books net it seems like a good domain name ANG on 4 Look for a domain search tool Often you have a tool like the one shown in Figure 1 15 that allows you to search for a domain 5 Search for the domain name you want You can type a domain name to see whether it s available Ble Edt wew History Ecekmarks Tools O c ir E E Free Hostia z Welcome Andy Home Stogout andhars0 Toss Help RBS ee i reehoste comfrembersicdemanrecton domans_dyeck zr Free Hostia Control Panel ee Eih Site Management E mail Options Web Toots Live Stats Help Center 5 My Account EJ sharrisbooks com A Domain Manager Tie Quick Controls Below you can see the results based on your domain search query Select which domain name s you would like to register or transfer You can reserve your domain name s for several years ahead E Add Services Upgrades Change Plan Renew Plan Search for a domain name is ccbouks Search Again Q watch video Swlect the TLDs to search for
28. nd performing other handy tasks FTP is a completely unsecure protocol Anything you transfer with FTP is completely visible to any bad guys sniffing the Internet For this reason some servers use a different protocol Secure FTP SFTP FireFTP supports this and other protocols your server might use Naming Vour Site After you have a site up and running you need to give it an address that people can remember The Domain Name System DNS is sort of an address book of the entire Internet DNS is the mechanism by which you assign a name to your site Understanding domain names Before creating a domain name you should understand the basics of how this system works Book VIII Chapter 1 S13M3 Jno Guibeuey 888 Naming Vour Site Every computer on the Internet has an IP Internet Protocol address When you connect to the Internet a special number is assigned to your computer This P address uniquely identifies your computer Client machines don t need to keep the same address For example my note book has one address at home and another at work The addresses are dynamically allocated A server needs a permanent address that doesn t change IP addresses are used to find computers Any time you request a Web page you re looking for a computer with a particular IP address For example the Google IP address is 66 102 9 104 Type it into your browser address bar press Enter and you see the Google main page DNS
29. ng else is basically the same See Book VI for details on how to use phpMyAdmin to work with your databases Book VIII Chapter 1 Finding the MySQL server name Throughout Book VI I assume that the MySQL server is on the same physi cal machine as the Web server This situation is common in XAMPP installa tions but commercial servers often have separate servers for data You may have to dig through the documentation or find a Server Statistics section to discover how your PHP programs should refer to your server S13M3 Jno ueue 8 9h Managing Data Remotely By far the biggest problem when moving your programs to a remote server is figuring out the new connection Make sure that you know the right combi nation of server name username and password Test on a simple PHP appli cation before working on a complex one
30. nguages and have syntax help code coloring and preview features Using one of these tools can be extremely helpful both are free For client side development you don t necessarily need access to a server You can test all your programs directly on your own machine with no other preparation Of course you ll eventually want a server so that you can show your pages to everyone The client side development tools listed here are described in more detail in Book I Chapter 3 Parts of a server side system When you start working on the server side with PHP MySQL and AJAX you need a somewhat more complex setup In addition to everything you need for client side development you also need these items A Web server This piece of software allows users to request Web pages from your machine You must either sign on to a hosting service and use its server or install your own I show you both techniques in this chapter By far the most common server in use is Apache Web server software usually runs all the time in the background because you never know when a request will come in A server side language Various languages can be connected to Web servers to allow server side functionality PHP is the language I chose in this book because it has an excellent combination of power speed price free and functionality PHP needs to be installed on the server machine and the Web server has to be configured to recognize it See Book VI
31. ns inside Firefox P aharrisbooks Firef TP Mozilla Firefox Ble Edt wew History Bookmarks Tools Help w ES windows E WwoRKSSETLe xampp H anonymous D apache TE egibn Greaber Contdocs 2 instal 2 Dikenss W E Mercur yMai o Omod pei pha O L phaMtyAdmin G hrome jfreftpjcontent frefo i r Sa AG aharntsbooks nrerTP al Giecormect Ect Abort LogQueue Toot Help D shamsbocks netjxfd_2ed v change lal name Sz Type A Cicerhy_2010 af rame a sire Ty Date E xampp i A 186275HTM X 38 987KB ap index ofihtm K3 hw E 417997 Javasor 5 ap Bh index offipho 3 oho Ae banner gf gt gif E practke ptp K op beck_tchep_t beck_ 2 H tock_t_shep_3 H book_2shap_4 H bock_2shep_5 H tock_3_shep_1 Hbtock_3_chap_2 Dteck_3 chap 3 Dtcek_3_chap_4 HBHRHHEERESSPHHEHEE Dec 420 21 Dec 4 21 04 Dec 5 16 14 Dec 7023 11 Jan 5 03 52 Jan 5 17 00 Jan 16 59 Jan 6 18 14 Jan 6 20 57 Dore Local Listing 4 objects 438 Bytes Disk Space Available 35 8 GE Binary If you want to connect to your server with FTP follow these steps 1 Look up the configuration settings You may have to dig around in the server documentation but you should find the server name username and password t
32. o access your server Sometimes you have to configure these elements yourself 2 Create a profile for your server Use the Manage Accounts feature to create a profile using the FTP set tings Figure 1 12 shows a profile for my aharrisbooks account 3 Connect to the remote server FTP programs look a lot like the file explorer you might have on your machine except that they usually have two file panels The left panel represents the files on your local system and the right panel shows files on the remote system 4 Navigate to the directories you re interested in If you want to move a file from the local system to the remote one use the two file explorers to find the appropriate directory on each system Figure 1 12 The profile editor for FireFTP Naming Vour Site 887 Account Manager Main Connection Advanced Main Details Account Name aharrisbooks Category v Host ftp aharrisbooks net D Login andhar 50 Password eseese C Anonymous e Ce e 5 Drag the file to transfer it FireFTP automatically determines the type of transfer you need to make 6 Wait for the transfer to complete It usually takes some time to transfer a large number of files Be sure the transfer is complete before you close the FTP window 7 Manipulate remote files You can right click on the remote file system to display a context menu This menu has commands for changing permissions creating directo ries a
33. ox Fle Edt wew History Eeokmarks Tools Help and Collations Storage Engines Databases lt a o GBS tea co reehostin com ame index php lang en ao G389 1ascerver 1 cy gt a E Fres Hoana mysalafrechostia com phptty E Welcome to phpMyAdmin 2 6 4 pl2 MySQL 4 1 22 standard log running on mysql8 freehostia com as k phpliyAdmin andhar50_xfd 66 40 52 21 php a uagg andharSO_xfd 27 mysal phpMyAdmin ad amp create to Language English en utl 3 E cmsBiock archarso7ets Colation Iu create fi MySQL charset UTF 8 Unicode uta Theme Style Orginal im gQ phpMyAdmin documentation amp Export G Official pnpMyAcmin Homepage E Log out ChangeLog CVS Lists Figure 1 18 phpMy E madera Admin is De x X B wb_seerch just like ma the one on b_users your home machine i If you look carefully you see that Freehostia is still using MySQL 4 Therefore not all SQL scripts in this book work correctly The only signifi cant problem is views because this feature wasn t included in MySQL 4 I include a version of the buildHero4 sql script on the CD ROM that elimi nates all references to views Otherwise the script is the same You can see from Figure 1 18 that phpMyAdmin is somewhat familiar if you read Book VI Often public servers remove the Privileges section because you aren t logged in as root Everythi
34. plete discussion of password issues in MySQL and phpMyAdmin SI8M3S Jno ueue Compromising between functionality and security You may be shocked that my example still has a couple of security holes It s true but it s not quite as bad as it looks 878 Choosing a Web Host The firewall is the first line of defense If your firewall blocks external access to your servers the only real danger your system faces is from yourself Begin with a solid firewall and ensure that you don t allow access to port 80 Apache or port 3306 MySQL unless you re abso lutely sure that you have the appropriate security measures in place Ileft phpMyAdmin open phpMyAdmin needs root access to the MySQL database so if anybody can get to phpMyAdmin through the Web server they can get to my data and do anything to it Because my firewall is blocking port 80 access you can t get to phpMyAdmin from anything other than localhost access and it s not really a problem I m not running a mail or FTP server on this machine The security system isn t sure whether my FTP or mail system is secure but because I m not running them it isn t really a problem Choosing a Web Host Creating a local server is useful for development purposes because you can test your programs on a server you control and you don t need a live con nection to the Internet However you should avoid running a production server on your own computer if you c
35. s And thia you may well know made their work s0 much the harder to endure lt p gt lt p gt Silence the Oxen cried at last cut of patience What have Apply Changes _ Save and Close Book VIII Chapter 1 SI8M3S Jno Guilfeuey 88 4 Managing a Remote Site What s with all the permissions Permissions are typically treated as binary numbers 111 means read write execute This 111 value is also a 7 permission because 111 binary translates to 7 in base ten or base eight but let s skip that detail for now A permission is read as three digits each one a number indicating the permissions so 644 per mission means rw r r This example can be translated as The owner should be able to read and write this file Everyone else can read it Nobody can execute it If you don t understand this concept don t worry about it The guidelines are very simple Make sure that each of your files has 644 per mission and that each directory has 755 per mission That s all you really need to know Understanding file permissions Most hosting services use Linux or Unix These operating systems have a more sophisticated file permission mechanism than the Windows file system does At some point you may need to manipulate file permissions Essentially the universe is divided into three populations Yourself your group and everybody else You can allow each group to have different kinds
36. tering yourself as the domain owner Figure 1 16 shows a typical form for this transaction WHOIS information provides your information to people inquiring about the domain name E Froe Hostia Mozilla Firefox mK Ble gdt wew History Ecckmarks Tools Help CB Sc EEren oeben dhek wae Bee PG E Free Hostia E Welcome Andy Home Logout andhar30 1D 293316 ca CPintra visit Store Free Hostia Control Panel Site Management i E mail Options 6 Web toote Help Center 2 MyAccount A aharrisbooks com x f3 Domain Manager le Show hide Help W Important The Foll your domain s rill be PUBLICLY available online You can hide this Tinatar by srdaring WHOIS 7 1D Protectan TA nfornation and thun E Change Plan F Renew Pian Order WHOIS 1D Protection Domain registrations aharriabooks org 1 year Realster Transfer WHOIS not protested best d x my best domam com EATR gt First Name Andy E Setup New Account Last tinme Harts Organization Name Account Usage Plan Advanced bannerlesz greiet R Eenew Pian E maili mon July 28 2013 Address City State Province Zip Postal Code 0 Malling Lists ane o Country Unitad States ral x Dore 8 Wait a day or two Your new domain name won t be available immediately It takes a couple of days for the name to be registered everywhere
37. wn Server with XAMPP ar If the requirements for a Web hosting solution seem intimidating that s because they are It s much more difficult to set up a working server system by hand than it is to start programming with it I don t recommend setting up your own system by hand It s simply not worth the frustration because very good options are available XAMPP is an absolutely wonderful open source tool It has the following packages built in Apache The standard Web server and the cornerstone of the package PHP Configured and ready to start with Apache and MySQL MySQL Also configured to work with Apache and PHP phpMyAdmin A data management tool that s ready to run Mercury Mail A mail server FileZilla FTP server An FTP server PHP libraries A number of useful PHP add ons including GD graphics support Ming Flash support and more 4 Additional languages Perl another extremely popular scripting and server language and SQLite another useful database package Control and configuration tools A Control Panel that allows you to easily turn various components on and off This list is a description of the Windows version The Mac and Linux ver sions have all the same types of software but the specific packages vary Considering the incredible amount of power in this system the download is remarkably small The installer is only 34MB A copy is included on the CD ROM that accompanies this book
38. zer Mercury Mail Filezilla FTP 2002 2009 APACHE FRIENDS This page indicates that XAMPP is installed and working Feel free to experi ment with the various items in the Demos section Even though you may not know yet what they do you should know what some of their capabilities are Adding your own files Of course the point of having a Web server is to put your own files in it Use your file management tool to find the XAMPP directory in your file system Right under the XAMPP directory is the htdocs folder the primary Web directory Apache serves only files that are in this directory or under it That way you don t have to worry about your love letters being distributed over the Internet All the files you want Apache to serve must be in htdocs or in a subdirec tory of it When you specified http localhost as the address in your browser you were telling the browser to look on your local machine in the main Figure 1 3 After disabling index php can see a list of files and directories ar Creating Your Own Server with KAMPP 875 htdocs directory You didn t specify a particular file to load If Apache isn t given a filename and it sees the file named index html or index php it displays that file instead So in the default htdocs directory the index php program is immediately being called Although this program displays the XAMPP welcome page you don t usually want that to happen

Download Pdf Manuals

image

Related Search

Related Contents

nº 2, abril de 2006 Artículos - Çédille, revista de estudios franceses  MOOVYOO ELÍPTICO Monster II  TFORMer Designer - Tec-It  Samsung C270 Uživatelská přiručka  Inspiron 24 5000 Series Manuale di servizio  Shuttle XS36-703 V4 PC  Omnitron iConverter GX/T  EVO RT - Tecnoware  ceiling ventilators read and save these instructions  DESCARGAR () Ficha técnica  

Copyright © All rights reserved.
Failed to retrieve file