PHP Learning Toolkit-Chapter III

Source: Internet
Author: User
Tags gz file imap php development environment php editor php online hosting web hosting microsoft frontpage
Php Chu Getting Started

This chapter highlights

Decide whether to outsource or build your own

Find the right ISP

Avoid common host traps

Install PHP

Choose PHP Development Tools

 
In this chapter, we will discuss the pros and cons of various web hosting options: Outsourcing, self-build, and different tradeoffs bin cases. Then we'll discuss the details of installing PHP, and finally some suggestions for finding the right development tools. By the end of this chapter, you should be able to start writing your first script.

Virtual Hosting and DIY comparison

The first important decision you need to make is: Who will master and manage the Web site that supports PHP, is it you, or is it a vendor that provides web hosting services? In addition, is there a need for a separate development installation, and who will master it if needed? If you have made your decision, you can skip this part and go directly to the installation section of this chapter.

Select ISP

Remote Hosting has become a mainstream choice since many ISP companies are starting to provide PHP-enabled Web services. Here are some basic concepts that must be remembered.

Advantages

Outsourced virtual Hosting has a number of advantages. In theory, ISPs have a responsibility (theoretically) to master many of the key technical and management details to keep the station functioning properly, including:

Hardware

Software upgrades

InterNIC registration, IP addressing, DNS

Mail server (POP/IMAP and SMTP)

Broadband

Power supply

Backup

Security

If there is something wrong with the user's website, the ISP technician's phone will have to be turned on at midnight, and the user will be able to sleep more soundly after knowing this. Lurking Vendetta (cracker), power outages, backup tapes are out of the question, and all these headaches are now given to companies that provide virtual hosting services.

In most cases, the cost-effectiveness of web hosting is relatively good. PHP on Linux or some BSD is very inexpensive and easy to get. Currently only a handful of companies provide NT Server platform PHP, of course some prices are not cheap. Anyway, look more than compare, look for the right ISP service provider.

Disadvantages

Of course, the ISP virtual host also has some serious drawbacks.

Fortunately, most of these shortcomings can be controlled. When using an ISP, the user is essentially a [guest] and must follow other people's rules. You may be a paid and popular guest, but it's better to be at home than you are in your own house.

The most worrying issue is the contrast between PHP modules and CGI. PHP performs the best and fastest for module execution, in other words, the module is built into the Web server itself, not as a separate itinerary. Whenever possible, almost every one of them is willing to use the MoD version. However, many ISP companies prefer to perform CGI versions because it is easier to manage it safely. Fortunately, there are more and more virtual hosting services in the market, so that you can more easily find the mode of the module.

Currently, the biggest problem with outsourcing PHP virtual hosting is the inability to get other program resources, and obviously ISPs encourage you to design programs on their servers, but there are many PHP parameters that must be somewhere between service and communication protocols. You cannot perform some unauthorized execution or link to the library in your directory.

There is a constant rule: the more common the requirements, the more likely and more suitable to outsource the virtual host, if the demand is more special, the more likely to need to set up themselves. There is, of course, an unwritten rule: the bigger your site is, the more money you'll need to spend, and the bigger the trade-offs you'll give to someone else's management.

Here are a few factors that make it more difficult to find a virtual hosting service:


Generally controversial content (violence, pornography).

Unsolicited e-mail, also known as spam.

Cracker content (security information) to attract vendetta.

Potentially illegal content that can cause problems.

Requires less common server hardware, operating systems, or software requirements.

Demand for ultra-large bandwidth (especially not unpredictable broadband).

If you are one of these things, you need to be informed in advance. If you can find a good and compatible with the virtual hosting services, do not hesitate, quickly seize the opportunity to use, and then slowly find a better way to deal with.

Finally, it is important to mention the most significant of all the negative factors: bad hosting services can cause you a lot of frustration and worry. There is no way to describe your Web page being listed in Slashdot but unable to display pages of gnashing of teeth, gastrointestinal pumping, screaming screams written, making you appear to be publicly available but losing all the opportunities for the show.

Not to mention other common problems, such as the unexplained loss of e-mail, DNS is missing, the site is not disconnected, the database data lost (this only happened to us), the lack of backup, or wait one hours of electronic words to talk with their technical support staff, and these people seem to have never approached the server, And never responded to your polite emails, and you only get a little bit of preferential treatment when you pay. (We're not mocking, always our lawyers say we can't mention too much).

The bottom line of choosing a virtual hosting service is that when you choose a virtual hosting service, it is tantamount to starting to face the danger. Be prepared to move away at any time, which also means not to choose services that don't have long-term contracts and/or prepayments, even if they are cheap or full-featured. Conversely, don't be impatient when dealing with them, and if you've never outsourced a virtual host before, take the time to learn and judge the difference between web hosting services (careful and poor technical support) and fundamental Internet traffic problems.

Details

If you decide to use a virtual host, you need to know that there are many choices in the current market. However, novice buyers should be careful, because the word [ISP] can contain almost everything, and thus make you confused. The Guidelines in table 3-1 provide the scope of specialization and the most appropriate use (the companies mentioned therein are examples only and do not imply endorsement or recommendation of their services).

Table 3-1 A variety of different ISPs

While trying to find a good web hosting service is sometimes as difficult as looking for a lifelong companion, some of the following resources can make this process a little easier:

Http://hosts.php.net

http://www.od-site.com/php

Http://www.ispcheck.com

We should pay more attention to the evaluation of users and the market, whether it is good evaluation or bad evaluation. Ask your friends or colleagues about their experience. Look for the PHP Messenger community or discussion group on the Internet, and you will occasionally make some comments about your good and bad experiences.

The issue that may be controversial at the time of signing is website traffic. Be careful with this ad. "Infinite flow/bandwidth/point-reading" is not guaranteed to meet the requirement for a bandwidth level that has not been tested with a credible unit. So before signing, you need to look, try, and evaluate the possible results.

What if the bandwidth requirement is evaluated? 1GB per month is equivalent to browsing 100,000 average 10K files (including graphics, text, ads, and so on) all except third-party-provided service support, it evaluates calculations from a user's perspective, not from the server's perspective.

Be aware of the total amount of disk space you need for your site's plans, especially for large sites or graphics platforms. If the limit is exceeded, an additional and expensive amount is usually paid for the excess space on a monthly basis. One way to solve this problem is to be careful with the external diary file (log file), periodically delete it, or download it to a cheaper storage device.

The choice of self-constructed host

With the decline in connection costs, self-built host has gradually become a choice for many sites. This gives you the highest level of control and command power, and it provides a real security advantage if combined with experience is fully utilized. Their installation means that the problem is solved faster because there is no need to waste time and technical support on the hotline, and it will be interesting to have direct control of the actual server whenever necessary. Finally, if you have any unusual, contentious or somewhat different needs, whether you want to or not, you have to serve your own website.

On the other hand, self-owners need to do more preparatory work, and the aim may be a little higher, especially for small to medium sized websites. Moreover, the self-built host station is good or bad depends on your own technical ability related. Therefore, if no one on your team knows more about security, be careful about security issues. But you can accumulate your own experience and learn, not like handing over to others, perhaps their company in charge of security engineers leave the security issue, we can only look at it.

The more realistic question is, if there is a problem, you can only blame yourself. If you get up in the morning, stand in front of the mirror and say to yourself: "All on my own!" That's a good feeling! "Then you have the confidence you need to build your own mainframe.

A compromise solution

Of course, outsourcing and self-built hosts are actually at the ends of this issue. In addition to this, there are several "compromise" solutions that provide the best part of both.

Hosting means packaging your own server host and sending it to a company that provides a virtual hosting service that will hook it up to their network and monitor it for you. You are responsible for purchasing, licensing, insuring, installing, configuring, and maintaining all software and hardware, in addition to uninterrupted power. Virtual Hosting service provisioning does not disrupt your device at all, except for occasional reboots, which usually cost extra. If you need additional technical support, you must go to the site yourself, or pay to get the workers and help. If you take a managed approach, it is possible to use a product that the other operator has no experience with.


Dedicated server

The dedicated server is literally the same: the host service buys a server, adjusts it to suit your situation (of course, pays for it), and then connects it to their network, and then all the processing related is yours to use. In general, you get technical support, which is more secure than using a shared server environment, and is relatively cost-effective for medium-and large-form websites.

Outsourcing production, self-development

This option involves two complete installations: an outsourced Web site and a server (one or more) that is equivalent to being developed in-house, which can be split in such a way as to achieve the best of both sides, with the ability to listen to the pager at night (at any time) and to control their own servers directly. This is a good solution if you have a limited selection of connections in your area. This is also one of the best options for large sites that require more developers.

Install PHP

If you decide to outsource the PHP host service entirely, you can skip the rest of this chapter without looking. However, we still recommend that you first install your own software, even if only installed on your own work machine, as you will have more experience with understanding the design environment.


Before you begin, you are ready to work

Before installing PHP on any platform, what you need is:


A server host that has enough RAM for your operating system to use.

You have installed UNIX, MAC OS X, or Windows operating system.

If this is a formal station, you need to have an ongoing Internet connection, if you are still in development, you can install it on your intranet, or let it be installed separately (although there is no internet connection, but you still need to have additional software packages to match).

These prerequisites are beyond the scope of this book. Detailed information can be found on the following websites:

World of Windows Networking (http://www.wown.com)
Linux Document Project (Http://www.linuxdoc ...)


If you plan to install PHP on Windows, the following conditions are also required:


A Web server that supports PHP. Under PHP3, IIS/PWS is the easiest option because there is a PHP module version available for that form, but PHP4 offers more extensive selection of modules under Windows.

A PHP-supported database is installed (if you plan to use the database).

For Windows 95, you must have DCOM updates available for free download from the following platforms: Http://download.microsoft.com/msdownload/dcom/95/X86/en/dcom95.exe

PHP Windows binary execution version (available for download from www.php.net/downloads.php).

Unzip the program (can be found on the famous download website, for example http://download.cnet.com looking for a PC file compression program).


If you plan to install PHP on UNIX, the following conditions are required:

PHP source code version (http://www.php.net/downloads.php).

Latest Apache source code version (the highest bit cardinality number for the. tar.gz file from http://www.apache.org/dist/is the latest version).

If you plan to use a database, you need a database that supports PHP.

All other support software that PHP must connect to (mail server, Bcmath Suite, JDK, etc.).

ANSI C language Compiler program.

GNU make (starting with PHP4, cannot be used with other made versions, this is especially important for non-GPL UNIX such as Solais and BSD, which can be downloaded from Www.gnu.org/software/make for free).

Bison and Flex (OK, in the/usr directory, and then type "find.-name bison-print" and "find.-name flex-print", check to see if this is already in place, or let GCC check during the make process. If not, you can download bison from Www.gnu.ory/software/bison and download flex from ftp://ftp.ee.lbl.gov.

This is what you need to do to actually install PHP.

Keep in mind that any other server or software library that PHP is connecting to must be installed before it is established. The repository is the most common type of expansion server. Other examples include the BC Math Suite, the IMAP server, the MCrypt library, and the expat XML parser (which, unless Apache is used, contains these components).

Now that you are ready to formally install PHP, there is little difference between building Apache modules and creating CGI executable files. In fact, the difference is simply to use the-with-apache or-with-apax flag when setting. Many users compile both the module version and the CGI version for ease of use.

In the past, there were many agencies that offered to install Apache, PHP, and sometimes MySQL programs (such as Phptriad, Nusphere MySQL, and Zend Launchpad), but unfortunately, it seems to be problematic to use and talk about these programs, Nusphere a serious violation of MySQL's use rights, Phptriad's defenders claim that he will no longer maintain the product, Zend Launchpad has long since disappeared from the site.


installation process

Due to the PHP commitment to cross-leveling, such as operability, there are too many specific installation methods can be used, there is no way to list all, we try to introduce all in the introduction of the most popular platform for PHP, but full out for each of the possible operating system and the Web Server Installation Guide will make this chapter too long.

Furthermore, although installing PHP on Unix has been stable for many years, the release of PHP 4.0 makes installing Windows a bit more different, partly because of the PHP team, partly because of the listing of Windows products, such as Windows XP and possible updates to IIS. PHP can now be executed on Macintosh OS x, while the process of installing it is still very volatile in the book's Culinary writing.

Based on this rapid change, we can only remind you that you should refer to the PHP website (http://www.php.net/docs.php)

The clearest installation information on each download, even if you've been installing it many times in the past, it's possible that you'll see some new changes after you install it multiple times.


UNIX and Apache

The first time you create your own HTTP daemon with the original code, you may be a little worried. However, this process is fairly straightforward, and compiling the Web server itself without relying on other people's rpm is a very learned experience, other people's rpm may be weeks or months before the version, want to use the new just wait for others to be ready. When everything is done on your own, and it all works, you will feel like a genius!

For those who have already used the previous version of PHP to complete the process, the whole process is exactly the same, but the time required may be longer than the previous one.

Reb hat or Mandrake Linux installation may be available with the RPM versions of Apache and PHP. These software packages must be removed before compiling your own new PHP. Alternatively, there may be RPM versions of other server vendors, such as MySQL or PostgreSQL, which are different from the installation of the original code counterpart version. If you are having problems, see the documentation for the installation source.

In the following description, the original code fragment is entered under the shell prompt symbol.

If you use a personal directory when installing, remember to log in to the system with root first.

 
To get started, follow these steps:

1. If this has not been done before, then the original Apache version of the unzip and Untar decompression processing. Unless there is a reason not to do so, please take it to a standard location such as/usr/local.

Gunzip–c apache_1.3.x.tar.gz
TAR–XVF apache_1.3.x.tar.gz

2. Initial adjustment of the Apacche server, if you install in a location other than/usr/local, now you have to use the following--prefix option, if you install in/usr/local, do not need tension under the Apacche directory is production exists, He is only used in the build process.

Cd apache_1.3.x
./configure--prefix=/usr/local/apache


3. Unzip and Untar the PHP original code version. Unless there is a reason not to do so, please take them to the standard position of/usr/local. If Apache and PHP are in a different directory, the ".." below must be The location is replaced with the full path of the software suite.

Cd..
Gunzip–c php-4.x.tar.gz
TAR–XVF Php-4.x.tar
CD php-4.x


4. Set up your own compilation connection (set PHP as a very large topic, also very important, please refer to the 31st chapter of this book for detailed information). The most common choice is to build an Apache module and support specific repositories. Java and XML support is also becoming popular, the following demonstration is the Apache module with MySQL and XML support, but the reader can use the flag is completely different.

./configure--with-apache=. /apache_1.3x--with–mysql--with-xml-enable-track-vars

 
5. Make and install the PHP module.

Make
Make install

 
6. Perform the Apache daemon settings and make. Don't be nervous libphp4.a not exist in this position, Apache will produce for you.

cd.../apache_1.3x
./configure-activae-module=src/modules/php4/libphp4.a
Make


7. If you already have a httpd line file, you should now close and forget him, in the now Apache version code), and will contain the binary and configuration files you should use.

Make install

 
8. Set up the PHP.ini archive. To edit this file, refer to the options listed in chapter 31st of this book, and we strongly recommend that new users set the error report to E_all (15).

Cd.. /.. php-4.x
CP Php.ini-dist/usr/local/lib/php.ini

 
9. Tell the Web server to use the file name to identify the php file (. PHP is a standard file name, but you can also use. html.phtml or any file name you want to use). Please locate the HTTP profile under/usr/local/apache/cont or another path you set yourself) and open the httpd with a text editor: Conf search for DocumentRoot (should appear two times) and change the path of both to the directory where you want to place the file (in our case,/HOME/HTTPD), we recommend the home directory instead of using the preset/usr/local/apache/htdocs, Because this is less secure. At least new ... Parse to PHP: (This will require some execution efficiency pay, especially if you only want to use.) HTML file with the name of the file), it is now appropriate to make sure that Apache knows the domain alias or the IP address it reads. (If you don't know what this means, search for the servername in the httpd.conf file and add localhost later, and use your domain name when you know it better)

AddType application/x-ttpd-php.php

AddType application/x-httpd-php.html

 
10. Restart the server. Each time you change an HTTP setting or php.ini file, you must stop and start the server again to work. It is not enough to use only hup signals.

Cd.. /bin
./apachectl Start

 
11. Set the file root (root) directory permissions to executable. PHP file permissions can only be set to readable (644). If necessary, replace the/HOME/HTTPD with the following file root directory:

Chmod 755/home/httpd/html/php

 
12. Open a text editor. Type ". Store it in the Web server's file root directory (document root), named info.php. Start any web browser to browse this file, you must use the URL (http://www.testdomain.com/info.php), or use the HTTP path http://localhost/info.php or/HTTP// 127.0.0.1/info.php, instead of using the file path directly (/home/httpd/info.php), you should see a bar information table about the PHP4 installation. Congratulations on your installation success!


Many Apache server products do not use php.ini files, as it may not be expected to require different configuration files in two different places, you can move many configuration instructions from php.ini to Apache httpd.conf files, at the very least you should set the include path and error return level, because the default settings of these files are not satisfactory, please refer to the 37th chapter of this book.


Mac OS x vs Apache

 

The most exciting part of the recent open source world is the partial opening of the Macintosh platform, where most users think OS X is the most advanced GUI interface on a fully implemented BSD system, and it is possible that such a combination would enable UNIX machines to be used on every home computer.

In the way that Mac users can choose to do the format or the original code to install, in fact, your OS X machine may have installed Apache and PHP, this may be an earlier version, still lack some of the few common support, however, if you need is apache+php+ Mysql/postgressql installed on your computer, this is the simplest way, all you need to do is edit your Apache configuration and open your Web server, so just follow the steps below (again, the following instructions are the instructions you need to enter at each step):

1. Use the appropriate document editor to open Apache configuration as root?
Sudo Open–a textedit/etc/httpd/httpd.conf

2. Edit the file to remove the annotations from the following lines:
Load Module Php4_module
Addmodule mod_php4.c
AddType application/x-httpd-php-php

3. You may also want to remove some of the annotations, otherwise tell Apache which directory to provide services.

4. Turn your Web server back on.
Sudo Apachectl Graceful

5. Now open a document editor and enter, save the file as info.php in your website folder, open any Web browser and browse the file, you must always use the HTTP request method to parse the file correctly (/HTTP/ www.testdomain.com/-username/info.php or http://localhost/-username/info.php or http://127.0.0.1/-username/ info.php) Instead of just the file name (/HOME/USERNAME/INFO.HPH), you should see some long tables documenting your new PHP installation, congratulations.

If you feel that you do not have a PHP module to use, or you want to upgrade your module to a new version, you can download in many parts of the internet, such as the Swiss Marc Liyanage, which is the website we use below, if you have a preferred distribution file, the instructions within the URL is replaced:
Crl–o http://www2.entropy.ch/download/libphp4.so.gz
Gnzip libphp4.so.gz
SDO apxs–i–a–n libphp4.so
SDO Apachectl Graceful

Writing the source file on OS X may require a bit of skill, the file structure is not the same as some related tools, and Apple's own implementation format is not standard, so now for new PHP users who lack UNIX experience, the original code editor is less recommended, if you still want to try one side, There is a good article in stepwise.com:

Http://www.stepwise.com/Articles/Workbench/2001-10-11.01.html
Later installation on OS X may be forced to change at any time, always install a new version of PHP before the installation of the OS X system page to look up:
http://www.php.net/manual/en/install.macosx.php

Windows Nt/2000/xp and IIS

Installing PHP4 on a server that uses IIS4 or 5 on Windows is much more convenient than on Unix because it has a compiled binary format and does not need to be recompiled.

There are two options for using Windows in binary format: Automatic installation of InstallShield and compression, which is simpler, but with many drawbacks, it can only be used on Web servers such as IIS4 or 5 and Xitami, And it only provides the CGI execution version and cannot use the module way, it lacks the extensions automatic setting process, it is obviously less secure, so any rigorous PHP installation on Windows should choose the manual installation method.

 
Follow these steps to install:

1. Using your own decompression tool, unzip the binary compressed file and place all the files in the c:php folder.

2. Copy some from your PHP directory. DLL files to your system folder (usually C:winnt/system32), you must copy the Php4ts.dll, you may also need to copy your Web server module required files-C: PHPSapiphp4isapi.dll, it may also require other files from the DLLs sub-folder, but the first two parts of the above files are copied and then added to your additional needs.

3. Copy php.ini-dist or php.ini-optimized (the latter is more recommended) to your Windows directory (C:WINNT or C:WINNT40) and rename it to PHP.ini. Use the text editor to open the file (for example, using Notepad), edit the file to use the configuration instructions, and you can refer to the options listed in chapter 37th. We strongly recommend that new users set the error return to E_all (15) on the machine that is working at this time, and the most important step now is the doc_root instruction in the Paths and Directories section, which will send this instruction to your IIS Inetpub the Data folder (or any other service you want to provide).

4. Turn WWW service off again, Start menu, settings, console, service, do not pull the shaft to the IIS Admin service, select it and click Close, wait to close (status message will tell you), choose World Wide Web Publishing Service and click on, but using Internet service administrator to shut down and re-open it is no use (with right-click icon), because this is used on Windows PHP, so you may need to reboot.

5. To open a document editor (such as Notepad), enter and store files in the root directory of your Web server info.php, open a Web browser and browse the archive, you must always use the HTTP request method (http://www.testdomain.com/ info.php or http://localhost/info.php or http://127.0.0.1/info.php) and cannot use the file name (C: inetpubwwwrootinfo.php) to properly execute the file, you will see a long list of your PHP4 installation information, congratulations.

Some Windows users reported that they had to put the php.ini file and the Php.exe executable file in the same directory in order to use the CGI version of PHP. On security ... Would be better, now PHP provides a better way to module the Windows Web server, if you can use this method.

Windows 95/98/me and PWS

At the time of the revision of this book, Microsoft announced that it would no longer release personal Web Server (PWS) products for free, a simple version of the Internet Information Server used on a table.

According to consideration, this should be a positive network development, PWS used to be installed as a windows/95/98/me machine at the lowest cost and risk (or is considered) the way to use PHP, but these operating systems are not used as a server flat, and its letter can not be long-term stable operation, So if you want to install the Web server and other vendors of the scripting engine, in the past must undergo a considerable amount of manual adjustment of the login database (Registry), but these have caused a lot of serious damage to the system, and can not be quite easy to remove the clean.

It might have been necessary to wait until Microsoft's new Web server platform was fairly stable to use on desktop machines, and now we recommend that Windows users be called Apache HTTP Server friendly and inexpensive work platform, The PHP program you write in Apache can actually be executed on IIS (or other final names such as. NET Web server).

Although it is possible to use a folder name with spaces under Windows, it is recommended that you do not do this for PHP-enabled directories, as this will cause problems with the installer.

Windows 95/98/we with Apache

PHP 4.0 introduced a long-awaited Windows Apache module, before which Apache's Windows users could only use the CGI version of PHP, which was slow and unsafe. and PHP 4.1 More in the use of this module significantly improve performance and stability, Apache opener also work on the Windows HTTP server significantly improve performance, according to these reasons, there is no better time to try Apache, even in the win95/98/ This is still true on MC machines.

To install PHP on the windows95/98/me:
 
1. Download the Apache server by Http://www.apache.org/dist/httpd/binaries/win32 and look for the current stable distribution with the No_src.msi file name (you can try it if you have one). EXE version, but it will not work on all systems and is less easy to install), double-click this installation file to start installation, C://program flies is a common installation location, The installation tool will also ask you if you want to perform Apache as a service (more steps are required, but you can find it in the system slots), or in the form of command-line mode, DOS prompt characters, and so on, which we recommend not to install as a service. This can cause problems when the computer is powered on and off.

2. Using your compression software to extract PHP into the folder, the c://php is often used in the location.

3. Copy some. dll files from your PHP folder to your system directory (usually C://windows), you must copy the Php4ts.dll, and you may need to copy the files required for your Web server module-c://php/sapi/ Php4apache.dll to your Apche module folder, you may also need other files from the DLLs sub-qualification folder, but first copy the first two parts of the above files and then add your additional needs.

4. Copy php.ini-dist or php.ini-optimized (the latter is more recommended) to your Windows directory (C://WINNT or C://WINNT40) and rename it to PHP.ini. Use the text editor to open the file (for example, using Notepad), edit the file to use the configuration instructions, and you can refer to the options listed in chapter 37th. We strongly recommend that new users set the error return to E_all (15) on the machine that is working at this time.

5. Tell your Apache server where you are going to provide the service and which file name you want to use to identify the php file (. PHP is the standard file name, but you can also use the. html′. PHPML, or whatever you want, turn on your HTTP settings (C:Program Filesapache Groupapachecont or any other location you use), and use the text editor to turn on httpd.conf, Search for DocumentRoot (which should appear two times) and change the location of the folder you want to service externally (preset to C://program Filesapache Groupapachehtdocs) and add at least one PHP file name according to the following syntax:
LoadModule Php4_module Modules/php4apache.dll
AddType APPLICATION/X-HTTPD-PHP.PHP.PHPML

6. You may also need to include the following syntax:
Addmodule mod_php4.c

7. Now you also need to make sure that Apache knows the domain alias or the IP address (if you don't know the current dmain, search for the servername in the httpd.conf file, and then join localhost, And then use your domain name when you find a domain).

8. Close and re-open the WWW service. You can execute Apache via the Start menu, the assembly, Apache HTTP Server, Control Apache HTTP server, Stop/start, or by MS-DOS prompt meta.

9. To open a document editor (such as Notepad), enter and store the file as info.php in your Web server's root directory, open a Web browser and browse the archive, you must always use the HTTP request method (http://www.testdomain.com/ info.php or http://localhost/info.php or http://127.0.0.1/info.php) and cannot use the file name (c:inetpubwwwrootinfo.php) to execute the file correctly, You'll see a long list of your PHP4 installation information, congratulations.

If you are not alarmed by these instructions but can't get the results you want to see, you can go through the 15th chapter of this book and refer to the FAQ, if it is not possible to help you, please refer to the accompanying annotations on the relevant pages of the file on the ph line, and many users will record them using specific techniques in special installation problems.

Other Web servers

PHP4 executable City Many other Web servers, such as Netscape Entetprise Server,xitami,zens and thttpd. Modules for Aolserver,nspai and FHTTPD have been made available, You can install some reference pages on the PHP online manual.

Development tools

When you need to use the development tools, unfortunately PHP only for the original design of other programming languages and those who are already quite skilled in HTML syntax, you may use other services or file system to write to up to 2000 lines of complex programs, and only output string 1 to the front-end browser. On the other hand, there are many people who use PHP's main function is to include in a static HTML page together with the top and end of the page, for these diverse situations, the likely good PHP development environment for the designer is still a common and feel friendly, but light and powerful original tool is difficult to find.

The person who enters PHP development by the static web designer may have to undergo some work adjustment, there is no possibility of a development tool so that you can complete your work simply by using the wizard and dragging the diagram to build the graphical processing, if the above development is important to you, You can use WYSIWYG software to do page layout and later with the document editor to add PHP functionality, of course, the disadvantage of the way the machine for you to generate the code is not easy to read, and some is very lengthy.

Pay special attention when you want to use Microsoft FrontPage as your PHP editor, because there seems to be a lot of user problems. At the very least, you need to start the ASP format tag (using the options in the php.ini file, or a pair of tags that cause JavaScript to be more painful.)

Experienced programmers may not need to study outside, and can use PHP as any other server programming language to host HTML to the browser and other uses, most of these programmers prefer a simple text editor, usually such a soft experience to provide you with some useful tools, such as syntax color emphasis, The parentheses are in contrast, or the tag ends automatically, and most of these features are only intended to help you out of your mind, but it doesn't really help you write the program.

Now the most exciting tool to use PHP has emerged, called Zend Studio, when the book was written in a second edition, a product that combines a powerful debugging tool (though still not a WYSIWYG tool) to edit the environment, This smart main product can help you to significantly save on checking the correct PHP function syntax repetition time, so that you can quickly eliminate errors, because development time is money, so the slight cost of this product will make you more productive, you can really find this IDE's symbol know PHP syntax, Zend Studio is the first development tool not just redesigned to achieve some purpose, and figure 3-1 is the usage interface diagram for Zend Studio.

As you can see in Figure 3-1:

Zend Studio allows you to execute PHP programs and preview HTML output in Windows, you can not use the browser to view the original code, and this method is not a standard result is not a luxury display written, and debugging tools can provide tools to provide you with powerful assistance, You can check the code line or jump in or out of function check, set breakpoints, stack track processing, track all the files of the whole domain and private variables or check a specific number of content, in such an easy-to-use GUI interface, you will be reminded of the use of non-declared variable potential danger, Syntax color emphasis and in-process drawdown can be easily adjusted freely, new users can avoid the use of Emacs or VI control inconvenience, and the automatic completion of the program can save you repeatedly check the PHP online instructions (such as whether it is strreplace or str_replace, and the parameter order content and so on, you can also use in your HTML when the program auto-completion function, especially when you have to memorize each of the properties allowed by the tag, you can even register your own defined function or auto-complete the list, making it easier to use without having to refer to the function definition again, This is handy if you are learning to pass a series of arguments to a function. When you use a library that is larger, more complex, and requires a large number of functions, you will find that the IDE can help you more.

Keep in mind that your development side is not going to use the same operating system as the server servers, which is the greatest value for cross-platform development, especially if you use UNIX servers (even the Blues), we have two document editors: Emacs and VI, Even the Macintosh and Windows have more friendly instrument tools for using interfaces. UNIX, on the other hand, makes it easy for you to support client operating systems for multiple machines. Many developers have some of the best features in the design of these tools, and Emacs,vi and Zend Studio are editors that can work on many major platforms, so if your development team uses the standard tools described above, people can use these tools in many of their operating system preferences.

Table 3-2 shows some of the editors used by most programmers to work from a large operating system.

If you want to develop between many operating systems, remember to break the break with some characters in W indows and the Unix slaughter is incompatible, the UNIX format of the break will then show a black color on the Notepad symbol, and the Windows break format in the UNIX system Editor looks ∧m characters, Your PHP program may still be working fine, but you may be crazy about using files that are edited on different platforms, and for many reasons the best way to solve such line-breaking problems is to use a version control system like CVS.

In addition to these well-known options, Keith Edmunds maintains a detailed list of text editors for PHP, many of which are free or require only a little fee.
http://phpeditors.dancinghippo.com/
Take a deep breath, after all the installation and setup, now you should be able to write your first PHP program.

Table 3-2 PHP Editors that are more common on different platforms


Summary

Before we can use PHP, we need to decide whether to build our own mainframe, outsource, or adopt a compromise solution, such as hosting. In this decision-making process, the most important factors are the cost, size and flow of the website, the special hardware or software requirements, the type of content and the expectations of the control. External web hosting services are the best choice for small sites with no special needs.

If you decide to build or maintain a development server yourself, detailed installation guidelines and instructions are provided earlier in this chapter for most common platforms. Although there are many different types of Web servers supported by PHP4, there are no official documentation on the details of their installation until the time of this book's release.

Finally, the reader may want to know which development tool is best for PHP. Most PHP developers use their favorite text editors to write programs before they are specifically part of PHP's Integrated development Environment (IDE). It is possible to add PHP functionality to a so-called [WYSIWYG] editor, but it looks cluttered.


The above is the PHP learning Treasure-The third chapter of the content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.