Menu
Is free
check in
the main  /  Firmware Installing on the old versions of Windows. Installing PHP to local computer Use command line to create PHP handler comparison

Installation on the old versions of Windows. Installing PHP to local computer Use command line to create PHP handler comparison

We continue to collect the local WAMP server on the local machine ( personal Computer). In this article, we install the PHP interpreter, it is the letter [P] in the acronym Wamp.

Let me remind you the build of Apache + MySQL + PHP is necessary for creating a site on your computer, as a local server. Task Many interesting and frequently used to work on projects. Self-assembly AMP is a complex task associated with the configuration of the computer and its constant health. For many it is easier than working with remote servers, because computer help is always at hand. In addition, working with a local server is free.

In past articles, I told how like. Local server We collect under windows control 7. It's time to install PHP.

PHP will be installed in the PHP folder created on system disk: C: \\ Program Files \\ PHP.

Where to take php.

We take the latest version of PHP on the official website, here is the link: https://php.net/downloads.php.. Another one: https://windows.php.net/download#php-7.0. We will not take the latest PHP7.0 version, we will not take such a "revolutionary" PHP 5.6 (5.6.20). I take an assembly under 32 Bit architecture of Windows 7 with a built-in Windows installer.

Installation PHP with installer (MSI)

The last PHP with the installer and the main thing with the APACHE 2.2 module. This is PHP-5.3.10-NTS-Win32-VC9-X86.MSI. Take it here: https://windows.php.net/downloads/releases/archives/ His and put it.

Note: We choose with the Apache 2.2 module., Since we collect Wamp on Apache 2.2, which we have already installed.

Installing PHP using the installer (MSI) is simple, in several windows:

1. Start the downloaded file PHP-5.3.10-NTS-Win32-VC9-X86.MSI.

The first installation window PHP-5.3.10

2. Meet the license and agree with it, go further by pressing the "Next" button.

3. On this page, set the folder to which PHP set. Let it be a catalog:

4. On the next page, select the used web server. In our assembly it is Apache2.

5. On this page you need to select PHP modules that we will need. For the suspension, choose everything.

6. Click "Install"


Click Install to install PHP-5.3.10
We see the process of installation window PHP-5.3.10

Everything! Installing PHP on local computer Completed.

PHP - Abbreviation for Hypertext Processor (Hypertext Processor). This is an open-source scripting language of general purpose, which is widely used in web development due to its ability to integrate into HTML. Used to write in advance the programs written, which are subsequently used to automate the tasks. PHP scripts are commonly used in Linux, Unix, Windows, Mac OS and other operating systems. When you use PHP in web development, you can select your web server and the main operating system.

Here will be described a step-by-step procedure for installing PHP 5.6 versions on Ubuntu 18. Commands and procedures mentioned in this article are performed in ubuntu system 18.06 LTS.

This article uses the Ubuntu, Terminal command line. You can open the Terminal application through system menu or combination keys Ctrl. + Alt + t.

PHP can be downloaded from the official site http://php.net/releases/ in the form of source and compile. We describe the installation of PHP through the Ondrej PPA repository in the form of a finished package.

Installation

To install PHP 5.6 you want to add to the system Personal Package Archive (PPA) - Repository with informal packages from developers who want to publish their own packages.

To work with PPA, you need to set the following by:

Sudo Apt-Get Install Software-Properties-Common

After that, you can add onDrej / PHP repository.

Sudo Add-APT-Repository PPA: ONDREJ / PHP

This repository contains all actual versions PHP at the moment.

After adding the Ondrej repository, you need to update the repository index on your system. It is necessary to establish the latest available version. software. Enter the following command:

Sudo Apt-Get Update

Distribution Apache2.2.2 with installer named Apache_2.2.2-Win32-x86-no_ssl.msi. You can find it at www.sai.msu.su/apache/dist/httpd/binaries/win32/

Run the downloaded installer on execution. When the installer will ask you about where to install Apache, specify the directory to it c: /APACHE2.2

Note

All further instructions will be based on the assumption that Apache is installed in the C: /APACHE2.2 directory. If you install Apache to another directory, then you must appropriately adapt the instructions to your situation.

Installation of Apache from the installer is quite transparent and does not cause special difficulties, as a result of which it is not rational to bring it full description In this article. We give only one dialog box that the user needs to be filled in the installation process. This is a server selection window. In the "Network Domain" and "ServerName" fields, write down the server name, to work with which Apache will be configured by default.


Note

This instruction Describes the Apache server setting under the assumption that it will be used only for local site testing and will not work in intranet and Internet networks. For server operation in networks Intranet and the Internet you must enter the real domain nameThat will be used by the server.

If the installation process has passed correctly, then upon completing Apache2.2 you already have to be run as a service. To check this if you open a list of Windows Services (" Start »| "Control Panel" | "Administration" | "Services") And find a string Apache2.2 in it. (or Apache2). Service status: Works or not appears in the third column.

If you cannot find the list of Apache2.2 service in the list of services, it is likely that a failure and Apache has occurred during the installation. In this case, you need to install Apache, as a service yourself. To perform this, you will need a program with a console, such as FAR, WindowsCommander, TotalCommander, and the like.

Open the program with the console, go to the C: /APACHE2.2/BIN directory and execute the command:

C: /apache2.2/bin/httpd.exe -k Install

In response, you should be issued a message. "The Apache2 Service Is SuccessFully Installed". Appearance The cantilever window is shown in the figure.


First start

Managing Apache-EM (Start, Stop, Restart) is carried out either through graphic interface Office windows servicesOr in the console execution of httpd.exe file with specific keys.

Windows management is carried out through the context menu, open by pressing the right mouse button on the service name. If Apache has not yet been running, then run the Start command from the context menu.


If you like to work in the console, the keys below are used to manage Apache.

APACHE Management Commands through the console

Httpd.exe -k start
httpd.exe -k stop (stop service)
httpd.exe -k Restart (restart)


By default, the server's root directory is installed c: /apache2.2/htdocs.. It is located in it. The index.html file is displayed by the name LocalHost. For the definition of the root directory of the site answers the directive Documentroot.in file c: /apache2.2/conf/httpd.conf..

Documentroot "C: /APACHE2.2/htdocs"

You can change it and make another directory of the root server directory.

However, before making it, you should make a minimal configuration file of httpd.conf. By default, Apache is configured to prohibit any access to sites and permission directors must be installed explicitly for each directory, as is done for the C: /APACHE2.2/htdocs directory. If you postpone the root server directory in another directory without configuring the appropriate permissions, then in response you will be issued an error 403 Forbidden and the page shown in the figure.


Therefore, if you are not going to use your newest Apache to provide hosting services on the Internet or in local networkYou should immediately remove the default protection.

Find in the file with: /apache2.2/conf/httpd.conf strings:


Options FollowSymLinks.
ALLOWOVERRIDE NONE.
Order Deny, Allow
DENY FROM ALL
Satisfy all.

Pay attention to the string DENY FROM ALL.

It prohibits any access to directories, including directory of virtual hosts. When attempting to appeal to them, Apache will respond with a 403 Forbidden error. The counterweight is the "Allow From All" directive. Installing this directive cancels the action of the Deny From All Directive.

You can install ALLOW FROM ALL for each directory and for each virtual hostBut you can proceed easier and remove (or comment out) Directive "DENY FROM ALL" from the container.


Options FollowSymLinks.
ALLOWOVERRIDE NONE.
Order Deny, Allow
# DENY FROM ALL
Satisfy all.

After performing these simple actions, restart Apache. How to do this is described above.

Installing PHP.

The modern Web server is already unthinkable without supporting dynamically generated pages. In Russia, the leader among technologies for creating dynamic pages and web applications is PHP technology. Below will be addressed to the PHP connection process on Example 5.3.5. If you have already installed this version of PHP, you can immediately move to the "PHP to Apache2.2.2" connection section.

Distribution with PHP You can download from our site to the address. According to the link, you can also familiarize yourself with the rules for choosing a distribution and why we took on behalf of the offer to download the Distribution from our site, and not from the official php.net. When loading the distribution presented by reference, it is assumed that you will install PHP as a module.

Unpack the ZIP archive with PHP to the C: /PHP-5.3.5 directory. This is completed on this PHP installation. Next steps The PHP + Apache bundle configuration will be concerned and configuring the PHP itself.

Note

All further instructions will be based on the assumption that you are using PHP-5.3.5, which is installed in the C: /PHP-5.3.5 directory. If you have another PHP version or you install PHP to another directory, you must appropriately adapt the instructions to your situation accordingly.

Connect PHP to Apache2.2.2

PHP Connection Problems to Apache2.2

If you try to connect a regular PHP5APACHE2.DLL module to Apache2.2.2, then failure awaits you. Apache does not want to run, giving out the message shown in the picture.


And in the logs of the system and applications the following messages will appear

The Apache Service Named Reported The Following Error:
\u003e\u003e\u003e httpd.exe: Syntax Error ON LINE 115 OF C: /APACHE2.2/conf/httpd.conf:
Cannot Load C: /PHP-5.3.5/PHP5Apache2.dll Into Server: \\ XCD \\ XE5 \\ XED \\ Xe0 \\ Xe9
\\ Xe4 \\ Xe5 \\ Xed \\ XF3 \\ XeA \\ Xe0 \\ Xe7 \\ Xe0 \\ XeD \\ XeD \\ XFB \\ Xe9 \\ XEC \\ Xee \\ Xe4 \\ XF3 \\ XEB \\ XFC.

The php5apache2.dll library is designed for Apache 2.0.x, for Apache 2.2.x, it is necessary to wind the php5apache2_2.dll library (it is located next to the php5apache2.dll in the distribution).

Configuring httpd.conf for PHP connection

To connect PHP, as a module, you need to add only 3 instructions to the httpd.conf file

Instructions for connecting php in httpd.conf

LoadModule PHP5_Module C: /PHP-5.3.5/PHP5APACHE2_2.dll
AddType Application / X-Httpd-PHP PHTML PHP
Phpinidir "C: /PHP-5.3.5/"

These rows should be placed in about the middle of the httpd.conf file, for example, immediately after the LoadModule directives. The specific location of these directives has no fundamental importance, but it is impossible to place them at the beginning, as well as at the very end of the httpd.conf file.

  • The first string loads the PHP module implemented in the php5apache2_2.dll library
  • The second line establishes the correspondence between files with the PHP extension and the MIME type of Application / X-HTTPD-PHP, which is processed by the PHP module.
  • The third line allows you to explicitly specify the location of the PHP.ini configuration file.

Note

PHPINIDIR directives are not enough in Apache1.3, as confusion often occurred in the PHP setting if there are several copies of the php.ini file, or when it is placed in the unsuitable directory.

The next step must be created configuration file. For PHP. In httpd.conf In the PHPINIDIR directive, the PHP configuration file location was indicated by the C: /PHP-5.3.5 directory. The configuration file itself should be called php.ini

In the C: /PHP-5.3.5 directory, there are several configuration file templates. As the basis, take the file c: /PHP-5.3.5/PHP.ini-ReCommended. and rename it to php.ini.. Thus, the PHP configuration file (php.ini) will be located in the directory C: /PHP-5.3.5 and it is precisely all changes in the PHP configuration.

After making changes to httpd.conf and create php.ini file, restart Apache.

Create a test php script under the name phpinfo.php that performs the function of the same name and save it to the directory c: /apache2.2/htdocs..

Phpinfo.php script

echo phpinfo ();

// Please note that the full recording syntax is used.
// php script.?>

Note

In the PHPInfo.php test script, a full syntax is used to determine the PHP script. In the PHP distributions of the last versions of the short recording syntax is disabled by default. For switching on the short record mode, the directive is responsible short_open_tag in the php.ini file. It needs to be set ON..

Now refer to this script through the browser entering address line http: //localhost/phpinfo.php.. In response, you must be displayed widely known purple pages displaying settings php. and its extensions.


If the phpinfo () function report in the form of "purple tables" was displayed - it means PHP is successfully performed by Apache.

Possible mistakes

Apache is loaded, but instead of "purple tables" a blank page opens.

Check: Test script is recorded in through a full syntax or via abbreviated? Those.:

Must be recorded
echo phpinfo ();
?>
instead
echo phpinfo ();
?>

Apache for Windows XP

Currently, all current versions of Apache are launched on Windows 7 SP1, Vista SP2, 8/8.1, 10, Server 2008 SP2 / R2 SP1, Server 2012 / R2, Server 2016.

Thus, it is currently impossible to run modern versions of Apache on Windows XP. Also Apache does not work on Windows Server 2003.

On Windows XP, you can run only Apache 2.2. And your windows system XP should have a Service Pack 3.

Before continuing, I recommend you go to a newer windows version - Starting with the seven can be installed any modern version Apache and PHP. Old versions of Apache and PHP may contain bugs. If you plan to use local web server To study the administration of web applications and programming on PHP, then Windows XP is not the most best platform - Here you will deal with the long-standing software.

If I did not convince you, then follow this step by step instructions To run Apache on Windows XP.

Creating a web server structure

Create the structure of the directories of our server. The main idea is to divide the executable files and files of sites with databases. It is convenient for servicing the server, including backup.

At the root of the disk C: \\ Create a catalog Server. In this directory, create 2 subdirectory: bin. (for executable files) and data..

Go to the catalog data. and there create subfolders DB (for databases) and htdocs. (for sites).

How to install Apache on Windows XP

Choose Custom Installation:

Change the installation folder on C: \\ Server \\ Bin \\ Apache2.2 \\:

After completing the installation, open http: // localhost /:

Go to the catalog C: \\ Server \\ Bin \\ Apache2.2 \\ CONF \\ and open the file httpd.conf. Any text editor.

In it, we need to replace a row row.

#ServerName Localhost: 80

ServerName Localhost: 80

Documentroot "C: /Server/bin/apache2.2/htdocs"

Documentroot "C: / Server / Data / Htdocs /"

DirectoryIndex index.html.

DirectoryIndex index.php index.html index.htm

# AllowOverride Controls What Directives May Be Placed in .htaccess Files. # IT CAN BE "ALL", "NONE", OR ANY COMBINATION OF THE KEYWORDS: # Options FileInfo Authconfig Limit # ALLOWOVERRIDE NONE

# ALLOWOVERRIDE CONTROLS WHAT DIRECTS MAY BE PLACED IN.HTACCESS FILES. # It can be "all", "none", or any combination of the keywords: # allowOverride FileInfo Authconfig Limit # AllowOverride All

#LoadModule Rewrite_Module Modules / mod_rewrite.so

LoadModule Rewrite_Module Modules / mod_rewrite.so

Save and close the file. Everything, Apache setting completed! Restart the web server or restart the computer to change the changes to take effect.

Your sites place in the folder C: \\ Server \\ Data \\ Htdocs \\.

How to install PHP on windows xp

In Windows XP, this version of Apache will earn only PHP 5.4, last version It is PHP 5.4.9, this is this file and download from the archive.

Download and install for this version. Php file. "Distributed package Microsoft Visual C ++ 2008 (x86)".

In folder C: \\ Server \\ Bin \\ Create another folder named Php., Schedule the contents of the downloaded file php-5.4.9-win32-vc9-x86.zip..

In file C: \\ Server \\ Bin \\ Apache2.2 \\ Conf \\ httpd.conf To the easiest add a line

PHPINIDIR "C: / Server / Bin / PHP" Addhandler Application / X-Httpd-PHP .php Loadmodule PHP5_Module "C: /Server/Bin/PHP/PHP5APACHE2_2.dll"

Now in the folder C: \\ Server \\ Bin \\ PHP \\ Find the file php.ini-development and rename it to php.ini..

Open this file php.ini. in any text editorLooking for a line

; EXTENSION_DIR \u003d "EXT"

and replace it on

EXTENSION_DIR \u003d "C: \\ Server \\ Bin \\ PHP \\ EXT \\"

Now find the string group:

; extension \u003d php_bz2.dll; extension \u003d php_curl.dll; extension \u003d php_fileinfo.dll; extension \u003d php_gd2.dll; extension \u003d php_gettext.dll; extension \u003d php_gmp.dll; extension \u003d php_intl.dll; extension \u003d php_imap.dll; extension \u003d php_imap.dll; extension \u003d php_imap.dll; extension \u003d php_interbase.dll; extension \u003d php_ldap.dll; extension \u003d php_mbstring.dll; extension \u003d php_exif.dll; Must Be After MBString As IT Depends on It; Extension \u003d php_mysql.dll; extension \u003d php_mysqli.dll; extension \u003d php_oci8.dll; Use with Oracle 10gr2 Instant Client; EXTENSION \u003d PHP_OCI8_11G.DLL; Use with Oracle 11gR2 Instant Client; extension \u003d php_openssl.dll; extension \u003d php_pdo_firebird.dll; extension \u003d php_pdo_mysql.dll; extension \u003d php_pdo_oci.dll; extension \u003d php_pdo_odbc.dll; extension \u003d php_pdo_pgsql.dll; extension \u003d php_pdo_sqlite.dll; extension \u003d php_pgsql.dll; extension \u003d php_pspell.dll; extension \u003d php_shmop.dll

and replace it on:

Extension \u003d php_bz2.dll extension \u003d php_curl.dll extension \u003d php_fileinfo.dll extension \u003d php_gd2.dll extension \u003d php_gettext.dll; extension \u003d php_gmp.dll; extension \u003d php_intl.dll; extension \u003d php_imap.dll; extension \u003d php_interbase.dll; EXTENSION \u003d php_ldap.dll extension \u003d php_mbstring.dll extension \u003d php_exif.dll; Must Be After MBString As IT Depends on It Extension \u003d php_mysql.dll extension \u003d php_mysqli.dll; extension \u003d php_oci8.dll; Use with Oracle 10gr2 Instant Client; EXTENSION \u003d PHP_OCI8_11G.DLL; Use with Oracle 11gR2 Instant Client extension \u003d php_openssl.dll; extension \u003d php_pdo_firebird.dll extension \u003d php_pdo_mysql.dll; extension \u003d php_pdo_oci.dll; extension \u003d php_pdo_odbc.dll; extension \u003d php_pdo_pgsql.dll extension \u003d php_pdo_sqlite.dll; extension \u003d php_pgsql. DLL; EXTENSION \u003d PHP_PSPELL.DLL; EXTENSION \u003d PHP_SHMOP.DLL

now revolve lines from this group:

; extension \u003d php_soap.dll; extension \u003d php_sockets.dll; extension \u003d php_sqlite3.dll; extension \u003d php_sybase_ct.dll; extension \u003d php_tidy.dll; extension \u003d php_xmlrpc.dll; extension \u003d php_xsl.dll; extension \u003d php_zip.dll

it should turn out:

EXTENSION \u003d php_soap.dll extension \u003d php_sockets.dll extension \u003d php_sqlite3.dll; extension \u003d php_sybase_ct.dll; extension \u003d php_tidy.dll extension \u003d php_xmlrpc.dll extension \u003d php_xsl.dll; extension \u003d php_zip.dll

Restart the web server:

In catalog C: \\ Server \\ Data \\ Htdocs \\ Create a file called i.php.

Copy to this file:

Unpack the downloaded file in C: \\ Server \\ Data \\ Htdocs \\. Rename this folder (phpMyAdmin-3.5.8.2-All-Languages) in phpmyAdmin..

In catalog c: \\ Server \\ Data \\ Htdocs \\ phpMyAdmin \\ Create a file. config.inc.php. and copy there:

Now in the web browser, open the address http: // Localhost / phpMyAdmin /:

Introduct as a username root, And leave the password empty.

Conclusion

As you can see, although we selected suitable versions, but on Windows XP you can run a full-fledged web server, even if not with the latest components of the programs.

By the way, you can download the ready-made assembly created by this instruction. You will find it.

Php. - The scripting language of general purpose programming, which is mainly used in the development of web applications.

Installation

The PHP interpreter comes in several variants for different interpreter launch modes.

CLI

To install PHP -Cli, run:

Sudo Apt-Get Install PHP5-CLI

CGI

To install PHP - CGI Perform:

Sudo APT-Get Install PHP5-CGI

Fastcgi.

To install PHP -FPPM.

Sudo APT-Get Install PHP5-FPM

Module for Apache.

Starting with the Ubuntu Saucy version (13.10), PHP is installed in the system with a preset Zend Opcache.

Do not install several PHP accelerators at once, it will not give any result.

Alternative PHP Cache.

Starting from the Ubuntu Saucy version (13.10) package pHP-APC. does not install an OPCode cachecher, instead it sets the package php-apcu. With part of the functionality (custom data caching).

APT-Get Install PHP-APC

File Settings /etc/php5/apache2/conf.d/apc.ini..

EXTENSION \u003d APC.SO REALPATH_CACHE_SIZE \u003d 4096K APC.MAX_FILE_SIZE \u003d 4M APC.SHM_SIZE \u003d 128M APC.MMAP_FILE_MASK \u003d /TMP/APC.XXXXXX APC.TTL \u003d 3600 APC.UXER_TTL \u003d 3600 APC.GC_TTL \u003d 3600

Xcache

APT-Get Install PHP-Xcache

File Settings /etc/php5/apache2/conf.d/xcache.ini..

Realpath_cache_size \u003d 4096k xcache.size \u003d 40m xcache.slots \u003d 8K xcache.ttl \u003d 3600

You can also specify the number of the cores of your processor:

Xcache.count \u003d 2.