Results 1 to 6 of 6

Thread: PHP (Hypertext Preprocessor): Installation and Configuration - Manual

  1. #1
    Join Date
    May 2008
    Posts
    420

    PHP (Hypertext Preprocessor): Installation and Configuration - Manual

    History of PHP

    The language PHP was designed as a tool for solving practical problems. Its creator, Rasmus Lerdorf, wanted to know how many people read it online-resume, and wrote for the simple CGI-shell language Perl, ie it was a set of Perl-scripts that are intended exclusively for a particular purpose - the collection of statistics of visits.

    For reference. CGI (Common Gateway Interface - a common gateway interface) is a standard that is used to create server applications that work over HTTP. Such applications (referred to as gateways or CGI - programs) to run the server in real time. The server sends the user's query CGI - program, which handles them and returns the result of their work on the user's screen. Thus, the visitor receives the dynamic information, which may vary as a result of the influence of various factors. Sam gateway (script CGI) can be written in different programming languages - Ci / C + +, Fortran, Perl, TCL, UNIX Shell, Visual Basic, Python, etc.

    Soon it became clear that the shell has a small capacity, and had to rewrite it again, but already the language of Si. After that, the sources were available to the public to correct the mistakes and additions. Users of the server where the site of the first version of PHP, interested instrument appeared willing to use it. So PHP will soon become an independent project, and in early 1995 came the first known version of the product, known as Personal Home Page Tools (tools for your personal home page). Means of these were more than modest: code analyzer, knowing only a few special commands, and a set of utilities that are useful for the creation of guest books, counters visits, chat, etc.

    By mid 1995, after a thorough processing of a second version of the product, named PHP / FI (Personal Home Page / Forms Interpreter - Personal Web Page / Forms Interpreter). It included a set of basic capabilities of today's PHP, ability to automatically handle html-form and integrated in the html-codes. The syntax of PHP / FI strongly reminiscent of the syntax of Perl, but was more simple.

    In 1997 came the second version of Ci-implementation of PHP - PHP / FI 2.0. By the time using PHP for several thousand people worldwide, with approximately 50 thousand domains, representing about 1% of the domains on Internet. The number of PHP developers has increased to a few people, but despite this, PHP / FI 2.0 was still at large project of one man. Officially, PHP / FI 2.0 released only in November 1997, until this is mainly in the beta versions. Shortly after the release by the first alphas of PHP 3.0.

    PHP 3.0 was the first version that closely resembles PHP, how do we know it today. It is very different from PHP / FI 2.0 and appeared again as a tool to address a particular application. Its founders, Andi Gutmans (Andi Gutmans) and Zeev Suraski (Zeev Suraski), in 1997 to rewrite the code of PHP / FI, as he showed them unsuitable for the development of e-commerce, over which they worked. In order to receive assistance in the project from the developers of PHP / FI, Gutmans Suraski and decided to unite with them and PHP3 to announce the official successor of PHP / FI. Following the development of PHP / FI was completely stopped.

    One of the strengths of PHP 3.0 was the possibility of extending the kernel. It is the property of extensibility PHP 3.0 has raised awareness of the many developers who want to add your module expansion. In addition, PHP 3.0 has provided ample opportunity for interaction with databases, the various protocols and API. An important step to success was the development of a new, more powerful and complete syntax with support for the PLO. Since the advent of PHP 3.0 has changed not only the functionality and internal structures of language, but also its name. In the PHP acronym is no mention of it was personal use, PHP has been a reduction (recursive acronym) of PHP: Hypertext Preprocessor, which means «PHP: Hypertext Preprocessor».

    By the end of 1998, the number of users of PHP has risen to tens of thousands. Hundreds of thousands of web-sites reported that they were working with this language. Almost 10% of the Internet server has been installed PHP 3.0.

    Officially, PHP 3.0 was released in June 1998, after 9 months of public testing. And for winter Andi Gutmans and Zeev Suraski had begun reprocessing nuclear PHP. Their goals were to improve performance of complex applications, and improve the modularity of the code, the core of PHP.

    The new kernel has been described as «Zend Engine» (of their first names: Zeev and Andi) and first presented in mid-1999. PHP 4.0, based on the kernel and with a wide range of additional features, was officially released in May 2000, almost two years after its predecessor, PHP 3.0. In addition to improving performance, PHP 4.0 has a few key innovations, such as support for HTTP sessions, output buffering, more secure ways of handling user input and several new language constructs.

    Work is currently under way to improve the Zend Engine and introduce innovations in PHP 5.0, the first beta version of which has already been reached in the light. One of the significant changes occurred in the object model of language, its fundamental podlatali and added many new features.

    Today, PHP is used by hundreds of thousands of developers. Several millions of sites written in PHP, which is more than 20% of domains Internet.


    What can PHP do?

    «PHP can all», - its creators say. Primarily used to create PHP scripts, working on the server side, so it, in fact, invented. PHP is able to solve the same problem as any other CGI - scripts, including data from html-forms that are dynamically generated html Pages, etc. But there are other areas can be used PHP. All three main areas of application PHP.
    The first, as already mentioned - is the creation of applications (scripts) that are executed on the server side. PHP the most widely used to create this kind of scripts. In order to operate in this way, you will need PHP-parser (ie handler php - scripts) and web-server for processing script, your browser to view the results of the script, well, and, of course, any text editor to write itself php-code. PHP parser is distributed in the form of CGI - the program or the server module. How do I install it, and web-server on your computer, we will look a little bit later. In this course we will discuss, as a rule, namely the creation of server applications, as an example of using the language PHP.
    The second area - the creation of scripts running on the command line. So with PHP, you can create scripts that will be executed, regardless of the web-server and browser on a specific machine. Such work will require only a parser PHP (in this case it is called a command line interpreter (cli, command line interpreter)). This method of work is suitable, for example, for scripts to be performed regularly with a variety of planning tasks for solving a simple word processing.
    And the last area - the creation of GUI-applications (graphical interfaces), running on the client side. In principle, this is not the best way to use PHP, especially for beginners, but if you have thoroughly studied the PHP, then the possibility of such language can be very useful. To use PHP in this area will require a special tool - PHP-GTK, which is an extension of PHP.

    So, the field of application of PHP is vast and diverse. Nevertheless, there are many other programming languages, capable of solving similar problems. Why study the PHP? What is it gives us? First, PHP is very easy to learn. Enough to look only to the basic rules of syntax and principles of its work, and you can start to write their own programs, and to take on such tasks in a different language which would require serious preparation.

    Secondly, PHP is supported by almost all known platforms, nearly all operating systems and a variety of servers. This is also very important. It is unlikely that anyone would want to move, for example, work on Windows work on Linux or IIS server to Apache server just to explore yet another programming language.

    In PHP combines the two most popular programming paradigms - procedural and object. In PHP4 better supported procedural programming, but it is possible to write programs in the object style. Already in the first test versions of PHP5 the majority of gaps in the implementation of object-oriented model of language that exist in PHP4, eliminated. Thus, you can choose the most usual way of working.

    If we talk about the capabilities of today's PHP, then they go far beyond those that have been implemented in its first versions. Using PHP you can create images, PDF-files, flash videos, it supports a large number of advanced database features are integrated to work with text data of any format, including XML, and functions to work with the file system. PHP supports interaction with various services through appropriate protocols, such as protocol control access to Directory LDAP, a protocol with network equipment SNMP, messaging protocols IMAP, NNTP, and POP3, HTTP hypertext transfer protocol, etc.

    Drawing attention to the interaction between different languages, it is worth mentioning the support of Java objects and using them as objects of PHP. For access to the remote sites can use the expansion of CORBA.

    To work with textual information PHP inherited (with minor modifications) mechanisms for working with regular expressions of the Perl language and the UNIX-systems. To process XML-documents can be used as a standard DOM and SAX, and the API for XSLT-transformations.

    To create the e-commerce application, there are a number of useful functions, such as a function of the payment Cybercash, CyberMUT, VeriSign Payflow Pro and CCVS.

  2. #2
    Join Date
    May 2008
    Posts
    420

    Re: PHP (Hypertext Preprocessor): Installation and Configuration - Manual

    Installing and configuring software

    The possibilities of language, we have discussed the application considered, studied history. You can now begin to install the necessary equipment. As a practical foundation course we will consider the problem solved by using the client-server technology, and PHP, respectively, can be used to create scripts that processed the server, we need to establish a web-server and interpreter of PHP. As a web-server will choose, for example, Apache, as the most popular among web-developers. To view the results of the programs we need web-browser such as Internet Explorer.



    Installing Apache 1.3.29 on Windows XP

    To install something, you need to start a software (SW). Download software to install Apache, you can, for example, in his official site http://www.apache.org. We downloaded the file apache_1.3.29-win3x86-no_src.exe. This is an automatic installer (otherwise - wizard) the Apache server for Windows. This program will try almost independently (and accurately, with minimal effort on your part) to install on your computer any software, but in this case the server. After you run the installer file, you receive the following window (Figure 1.1).




    Fig. 1.1. Automatic Installation server Apache


    To set the HTTP-server is Apache version 1.3.29 on your computer, you must click on Next. Incidentally, this same program will edit or remove already installed web-server.

    After you click Next the program will offer to accept the license terms (Figure 1.2).




    Fig. 1.2. License Agreement


    The next screen will contain information on the server, Apache, and in particular on its Windows-realization (the picture does not show).

    At this step, you enter the name of the network domain, server name and e-mail administrator. This program will try to automatically determine your domain and host on your computer (Figure 1.3).




    Fig. 1.3. Basic information on the server


    Once you have entered data in the above form, you need to select the type of installation: the total (all components are installed the server) or user-defined (you can select components for installation) (Fig. 1.4)..




    Fig. 1.4. Install Type


    Selecting server components are not very big - so the tools needed for the server, and documentation (Figure 1.5).




    Fig. 1.5. Selecting a custom installation of components


    We choose the full installation. Then on the next step program to select the folder in which the server will be installed. By default, the server is installed in the folder c:\Program Files\Apache Group\(Fig. 1.6).




    Fig. 1.6. The folder, which will be installed server


    On the next screen (Figure 1.7) will be required to confirm the correctness of the entered data and start the installation. From any window installation, including this, you can go back and edit previously entered data.




    Fig. 1.7. Start


    After you click Install to begin immediate installation of the server. From the user, no additional action is no longer required. On the one hand, it was good, but I have such an automated installation and some disadvantages. For example, users' home directories are at the same place where files and settings of the server (c: \ Program Files \ Apache Group \ Apache \ users \). It is not safe if your computer is working more than one user, not the server administrator. But first, you can not change. Suppose we run the installer, enter all necessary data, it has complied with all the operations successfully and said that the server is installed. How to verify that the server is installed? Recruited browser http://localhost/. If established correctly, we get the welcome page server Apache.


    Welcome Page

    So, the server is installed. How it work? How can I run scripts and files which must be connected? Files to be processed by the server, you can save either the root servers (in this case c:\Program Files\Apache Group\Apache\htdocs), or in the directories of users (in this case c: \ Program Files\Apache Group\Apache\users\). The location of root servers and user directories are registered in the server or, more precisely, in the configuration file httpd.conf (you can find it in c:\Program Files\Apache Group\Apache\conf). To change the way you want to change the relevant variables in the configuration file server. The variable in the configuration file ServerRoot is responsible for the root directory of the server, and a variable UserDir - for a directory where files will be users of the server (for a more secure work suggest to change the variable UserDir to something of type c:\users\). To gain access to the file test.html, located at the root of the server, you need to type into your browser http://localhost/test.html (ie, the host name, file name). If the file test.html located in user's user, then it must be viewed in a browser type http://localhost/~user/test.html.

  3. #3
    Join Date
    May 2008
    Posts
    420

    Re: PHP (Hypertext Preprocessor): Installation and Configuration - Manual

    Installing PHP 4.3.4 on Windows

    Go to the installation of PHP. Distribution can be downloaded from the official site PHP - http://www.php.net. For convenience, I choose the automatic installation process, as is the case with the server. The first window, with this setup, PHP provides greeting and a warning of the existence of copyright on the product (Fig. 1.9).




    Fig. 1.9. The program auto-install PHP


    Next you need to read and agree (or disagree) with the license (Figure 1.10).




    Fig. 1.10. License Agreement


    Then select the type of installation: a standard or to specialists. We choose a standard installation (Figure 1.11).




    Fig. 1.11. Install Type


    In the next window to select a directory for the installation of PHP. There will be copied the files of libraries, extensions, shell, Modules, etc. (Figure 1.12).




    Fig. 1.12. Selecting the folder where you will install PHP

    In the next window are invited to enter the address of SMTP-server, the server is sending email messages, and a return address of the sender's e-mail. This window we have not.

    Next, to select from a list server, which will work with PHP. Since we installed Apache, then choose from the list, namely, it (Fig. 1.13).



    Fig. 1.13. Selecting the server that will work PHP


    The next window starts the installation (Figure 1.14).




    Fig. 1.14. Start an unattended installation of PHP


    After copying the necessary files, we received the following message (see Fig. 1.15):




    Fig. 1.15. The message that it was impossible to automatically configure Apache to work with PHP


    This means that you need to configure Apache server to work with the PHP manual.

    First, you should choose how we want to install PHP, since it comes in two forms: CGI-script (php.exe) or a set of SAPI-modules (for example, php4isapi.dll), used by the server. The latest version has new features, but due to lack of preparedness may be insufficient to operate reliably, especially on older platforms, Windows 2000 (you may receive a pile of 500 errors, there may be failures in other server modules such as ASP). So if you need absolute stability - we have to choose to install PHP as a CGI application achievable.

    If we want to install PHP as a server module, the server's configuration file (httpd.conf) to write:
    LoadModule php4_module
    c:/php/sapi/php4apache.dll
    AddType application / x-httpd-php. Php. Phtml
    AddModule mod_php4.c

    If we install PHP as cgi - a program, in httpd.conf you need to write:
    ScriptAlias/php/ "c:/php/"
    AddType application/x-httpd-php. Php.Phtml
    Action application/x-httpd-php"/php/php.exe"

    In this case, you may have problems with security. We recommend that you correct the directory where the interpreter is an executable file (c:\ php\), to something less obvious (for example, c:\abc_php\). We advise you to install PHP as a server module.

    Still need to edit the file php.ini (in the folder c:\Windows), so that PHP «known», where the root directory of the server where the user directory, and where his own library of extensions. For this to php.ini file with the appropriate variables doc_root, user_dir and extension_dir. Set them up as follows:
    doc_root = "c:\Program Files\Apache
    Group\Apache\htdocs "
    user_dir = "c:\users"
    extension_dir="c:\ php\extensions"

    In addition, you can choose to expand, which will be loaded when you run PHP. In the implementation of PHP on Windows is inherently very few extensions. To download the extension, you need to uncomment in the php.ini corresponding line 'extension = php_ *. dll'. For example, to download the extension to work with MSSQL, you need to uncomment the line 'extension = php_mssql.dll'. Some expansion requires additional libraries. Therefore, it is recommended to copy additional libraries in the system directory (from the folder c: \ php \ dlls). The first time you must configure and test PHP without extensions.

    In order for the settings done in the server configuration files, and PHP to take effect, you need to restart the server.

    Check whether PHP. To do this, create a test file (1.php) in the user directory (c:\users\nina) with the following contents:
    <? php
    echo "<h1> Hello all! </ h1>";
    >

    Run this file through a browser, type http://localhost/~nina/1.php. If something is wrong, then the screen will display the text of the file. If all is well, then our script to the server and put in big letters string «Hi everyone!».

  4. #4
    Join Date
    May 2008
    Posts
    420

    Re: PHP (Hypertext Preprocessor): Installation and Configuration - Manual

    Installing PHP on Debian GNU/Linux

    Using APT

    While you can just download the PHP source and compile it yourself, using Debian's packaging system is the simplest and cleanest method of installing PHP. If you are not familiar with building software on Linux, this is the way to go.

    The first decision you need to make is whether you want to install Apache 1.3.x or Apache 2.x. The corresponding PHP packages are respectively named libapache-mod-php* and libapache2-mod-php*. The steps given below will use Apache 1.3.x. Please note that, as of this writing, there is no official Debian packages of PHP 5. Then the steps given below will install PHP 4.

    PHP is available in Debian as CGI or CLI flavour too, named respectively php4-cgi and php4-cli. If you need them, you'll just have to reproduce the following steps with the good package names. Another special package you'd want to install is php4-pear. It contains a minimal PEAR installation and the pear commandline utility.

    If you need more recent packages of PHP than the Debian's stable ones or if some PHP modules lacks the Debian official repository, perhaps you should take a look at » http://www.apt-get.org/. One of the results found should be » Dotdeb. This unofficial repository is maintained by » Guillaume Plessis and contains Debian packages of the most recent versions of PHP 4 and PHP 5. To use it, just add the to following two lines to your /etc/apt/sources.lists and run apt-get update :

    Example #1 The two Dotdeb related lines
    PHP Code:
    deb [url]http://packages.dotdeb.org[/url] stable all
    deb-src [url]http://packages.dotdeb.org[/url] stable all 
    The last thing to consider is whether your list of packages is up to date. If you have not updated it recently, you need to run apt-get update before anything else. This way, you will be using the most recent stable version of the Apache and PHP packages.

    Now that everything is in place, you can use the following example to install Apache and PHP:

    Example #2 Debian Install Example with Apache 1.3
    PHP Code:
    # apt-get install libapache-mod-php4 
    APT will automatically install the PHP 4 module for Apache 1.3, and all its dependencies and then activate it. If you're not asked to restart Apache during the install process, you'll have to do it manually :

    Example #3 Stopping and starting Apache once PHP 4 is installed

    PHP Code:
    # /etc/init.d/apache stop
    # /etc/init.d/apache start 
    Better control on configuration

    In the last section, PHP was installed with only core modules. This may not be what you want and you will soon discover that you need more activated modules, like MySQL, cURL, GD, etc.

    When you compile PHP from source yourself, you need to activate modules via the configure command. With APT, you just have to install additional packages. They're all named 'php4-*' (or 'php5-*' if you installed PHP 5 from a third party repository).

    Example #4 Getting the list of PHP additional packages
    PHP Code:
    # dpkg -l 'php4-*' 
    As you can see from the last output, there's a lot of PHP modules that you can install (excluding the php4-cgi, php4-cli or php4-pear special packages). Look at them closely and choose what you need. If you choose a module and you do not have the proper libraries, APT will automatically install all the dependencies for you.

    If you choose to add the MySQL, cURL and GD support to PHP the command will look something like this:

    Example #5 Install PHP with MySQL, cURL and GD
    PHP Code:
    # apt-get install php4-mysql php4-curl php4-gd 
    APT will automatically add the appropriate lines to your different php.ini (/etc/php4/apache/php.ini, /etc/php4/cgi/php.ini, etc).

    Example #6 These lines activate MySQL, cURL and GD into PHP
    PHP Code:
    extension=mysql.so
    extension
    =curl.so
    extension
    =gd.so 
    You'll only have to stop/start Apache as previously to activate the modules.


    Source : php.net

  5. #5
    Join Date
    May 2008
    Posts
    420

    Re: PHP (Hypertext Preprocessor): Installation and Configuration - Manual

    The first PHP-program

    In fact, the first PHP - a program you have already created, when tested, whether the interpreter PHP (in the previous chapter). Now we want more details of what constitutes a PHP - the program and what it differs from programming languages Ci, Perl and JavaScript. Consider an example.

    <html>
    <head>
    <title> Example </ title>
    </ head>
    <body>
    <? php
    echo "<p> Hi, I'm - script PHP! </ p>";
    >
    </ body>
    </ html>


    Example 1.1. Simple html-file with a built-in PHP code (html, txt)

    This is a simple HTML-file, which is built using special tags, the code written in PHP.

    As we said above, PHP is similar to Ci, and Perl. However, the program here is very different from the meaning of similar programs in the languages of Ci and Perl. There is no need to write a bunch of special commands to output HTML. Written directly to HTML-script, which you can embed PHP-code that performs any action (such as exempting the text on the screen, as in this example). The disadvantage of PHP compared to Ci, and Perl, despite the best efforts of developers, is still a lack of quick implementation of complex scripts.

    PHP-scripts - this is the program that are executed and processed by the server. So to compare it with scripting languages like JavaScript can not be, because these scripts are written in a run on the client machine. What is the difference between scripts running on the server and the client? If the script is processed by the server, the client sends only the results of the script. For example, if the script is executed on the server that is similar to the above, the client will receive a generated HTML-page form:

    <html>
    <head>
    <title> Example </ title>
    </ head>
    <body>
    <p> Hi, I'm - script PHP! </ p>
    </ body>
    </ html>


    In this case, the client does not know what the code is executed. You can even configure your server in such a way that the HTML-files are processed Processor PHP, so that customers are not even able to find out whether they are normal HTML-file or the result of the script. If the script is processed by the client (for example, a program in the language JavaScript), the client receives a page containing script code.

    We noted above that the PHP - Scripts are built in HTML-code. The question is, how? There are several ways. One of them is given in the first instance - through the opening tag <? Php and the closing tag>. This type of special tags allow switching between HTML and PHP. This syntax is preferable, because it allows to use PHP in XML-compatible programs (eg, written in XHTML), but nevertheless, you can use the following options (command echo "Some text"; displays the text «Some text».) :

    <? echo "This is the simplest
    instruction for
    processing PHP ";?>
    <script language="php">
    echo "Some editors
    (FrontPage) prefer
    to do so;
    </ script>
    <% Echo "You can use the tags
    in the style of ASP ";%>

    The first of these methods are not always available. To use them, you must include either short tags using the short_tags () for PHP 3, or include the installation short_open_tag configuration file in PHP, or PHP is compiled with the - enable-short-tags. Even if it is enabled by default in php.ini-dist, use of short tags is not recommended. The second method is similar to the box, for example, JavaScript-code, and uses the appropriate html tag. Therefore, you can always use it, but this is rarely done because of its cumbersome. The third method can be applied only if the ASP-style tags have been included using configuration installation asp_tags.

    When a PHP file handles, it simply sends the text, until it reaches one of these special tags, which informs him of the need to start interpreting the text of the code as PHP. Then it executes the entire code is found before the closing tag, speaking interpreter, that again is just more text. This mechanism allows to implement PHP-code in HTML - everything outside the PHP tags remains unchanged, while the inside is interpreted as a code. Note also that php-file does not like the CGI-script. Php file should not be enforceable or have any way tagged.

    In order to send a php-file to the processing server, you need to dial in the browser the path to the file on the server. Php scripts should be located where access is permitted via the www, for example, at the same place where is the home page. If php-file is based on the local machine, it can be processed through the command interpreter.


    Conclusion

    So, we got the idea that such language PHP, as it emerged and developed, to learn how and where it can be used, install the software and did all the necessary settings to work with him, and found that is a php -- program. In the following lectures we will consider a framework solve the syntax of PHP and some useful practical problems.

  6. #6
    Join Date
    Aug 2006
    Posts
    106

    Re: PHP (Hypertext Preprocessor): Installation and Configuration - Manual

    More Information on PHP - PHP Course : Basics
    Watch LATEST TECH NEWS AND TIPS to enhance your computer skills.

    Knowledge is universal and must be shared by all, exchanges enrich us

Similar Threads

  1. Manual Configuration Impossible in nokia C2-00
    By Love-Day in forum Portable Devices
    Replies: 4
    Last Post: 07-04-2012, 07:28 PM
  2. Replies: 1
    Last Post: 26-05-2011, 12:55 AM
  3. What is the meaning of Hypertext PreProcessor in PHP
    By Gefry in forum Software Development
    Replies: 3
    Last Post: 10-09-2009, 10:28 AM
  4. Dreambox Ftp Set-up and Installation Manual
    By Pyrotechnic in forum Guides & Tutorials
    Replies: 6
    Last Post: 14-04-2009, 06:40 PM
  5. Manual Configuration of the internet connection speed
    By Seraphim in forum Technology & Internet
    Replies: 2
    Last Post: 17-09-2008, 06:56 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,299,159.25926 seconds with 17 queries