How to install local Apache server with Php, MySQL, phpMyAdmin on Windows computer. How to install local Apache server with Php, MySQL, phpMyAdmin on Windows machine Configuring Apache to use PHP


Installing a web server on Linux:

  • If you have Ubuntu, then the article “How to install Apache web server with PHP 7, MariaDB/MySQL and phpMyAdmin (LAMP) on Ubuntu 16.10” is suitable for you.
  • If you have Arch Linux, then the article "Installing LAMP (Linux, Apache, MySQL/MariaDB, PHP7 and phpMyAdmin) on Arch Linux / BlackArch" is suitable for you.

Local server is a very useful tool. It will definitely be useful for webmasters, PHP programmers, and penetration testers. All programs included in a typical web server installation are free and open source. A local web server consumes minimal resources and is actually quite easy to install and configure.

This instruction will tell you how to install a local web server without using ready-made assemblies. This method has its advantages. The most important of them are: complete control over what you install; ability to use the latest versions of software.

If you follow the instructions exactly, then everything will definitely work for you! Except for those who have Windows XP - if you have this operating system, then special instructions have been made for you.

I will show an example of installation on Windows 10, but if you have a different version of Windows, then don’t let this bother you - the procedure is identical everywhere. I will download the latest (most recent) versions of the programs at the time of writing. If by the time you read, new versions will be released, then download them.

Installation steps:

You may also find it useful:

1. Preparation (downloading programs included in the server, creating the server structure)

We need:

  • Apache(directly web server)
  • PHP- environment for running PHP programs (required by almost all websites)
  • MySQL- database management system (required by most websites)
  • phpMyAdmin- a very convenient tool for database management

The official website of the Apache developers is httpd.apache.org. You can download Apache from this site. But the official version is built using an old compiler, for this reason it does not work with new versions of PHP. PHP authors recommend Apache from apachelounge.com/download. Therefore, for this instruction, we download Apache from the site apachelounge.com/download.

If you have a 64-bit version of Windows, then you can choose both 64-bit and 32-bit versions of components. The main rule is that all components must be of the same bit size. If you have a 32-bit version of Windows, then all components must be 32-bit. This does not apply to phpMyAdmin, which is written in PHP. For PHP programs, the concept of bit depth is not applicable.

The free version of MySQL is called MySQL Community Server. It can be downloaded on the page. There is an executable installer on this same page, but I recommend downloading the ZIP archive. On the download page we are asked to register or log in to an existing account - but this is not necessary. Just click on the link " No thanks, just start my download" Pay attention to the bit depth.

We also need the Visual C++ Redistributable for Visual Studio 2015-2019 file, i.e. Visual C++ redistributable component for Visual Studio 2015-2019 (or any other later), you can download it on the official Microsoft website using the link (direct link to download the 64-bit version; direct link to download the 32-bit version).

So, I downloaded the following files:

  • httpd-2.4.29-Win64-VC15.zip
  • php-7.2.0-Win32-VC15-x64.zip
  • mysql-8.0.11-winx64.zip
  • phpMyAdmin-4.7.6-all-languages.zip
  • vc_redist.x64.exe

Install the file vc_redist.x64.exe.

2. Create a web server structure

Let's create the directory structure of our server. The main idea is to separate executable files and website files with databases. This is convenient for server maintenance, including backups.

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

Go to the directory data and create subfolders there D.B.(for databases) and htdocs(for websites).

Go to the directory C:\Server\data\DB\ and create an empty folder there data.

Map of important folders that are mentioned in this manual:

C:. ├───bin │ ├───-Apache24 │ │ └───conf │ ├───-mysql-8.0 │ ├───-PHP │ └───-S endmail ├───certs ├── ─data │ ├───DB │ │ └───data │ └───htdocs │ └───-phpmyadmin └───manage

3. Installing Apache 2.4

The contents of the downloaded archive (more precisely, only the directory Apache24), unpack into C:\Server\bin\.

Go to the directory c:\Server\bin\Apache24\conf\ and open the file httpd.conf any text editor.

In it we need to replace a number of lines.

Define SRVROOT "c:/Apache24"

Define SRVROOT "c:/Server/bin/Apache24"

#ServerName www.example.com:80

ServerName localhost

DocumentRoot "$(SRVROOT)/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: # AllowOverride FileInfo AuthConfig Limit # AllowOverride None

# AllowOverride controls what directives 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. That's it, Apache setup is complete! A description of each changed directive can be found on this page.

Open the command line (this can be done by pressing the Win+X keys simultaneously). Select Windows PowerShell (Administrator) there and copy there:

C:\Server\bin\Apache24\bin\httpd.exe -k install

If a request is received from the firewall for Apache, click Allow.

Now enter into the command line:

C:\Server\bin\Apache24\bin\httpd.exe -k start

And press Enter.

Enter root as the username. Leave the password field empty. If everything is done correctly, then everything should look like this:

7. Server use and data backup

In the catalog c:\Server\data\htdocs\ create folders and files, for example:

c:\Server\data\htdocs\test\ajax.php - this file, accordingly, will be available at http://localhost/test/ajax.php, etc.

To create a complete backup of all sites and databases, just copy the directory C:\Server\data\.

Before updating modules, make a backup of the folder bin- in case of problems, you can easily roll back to previous versions.

When reinstalling the server or updating it, you need to re-configure the configuration files. If you have copies of these files, the process can be significantly speeded up. It is advisable to backup the following files:

  • c:\Server\bin\Apache24\conf\httpd.conf
  • c:\Server\bin\mysql-8.0\my.ini
  • c:\Server\bin\PHP\php.ini
  • c:\Server\data\htdocs\phpMyAdmin\config.inc.php

All settings are stored in them.

8. Additional PHP setup

PHP is now a very powerful, flexible, user-friendly tool. On a local computer, you can use it to solve a variety of tasks that are not necessarily related to generating Web pages. When solving extraordinary problems, you may run into restrictions set in the settings. These settings are contained in the php.ini file (c:\Server\bin\PHP\php.ini). Let's look at some of them:

Memory_limit = 128M

sets the maximum amount of memory that a script can use

Post_max_size = 8M

sets the maximum amount of data that will be accepted when sending using the POST method

;default_charset = "UTF-8"

sets the encoding (by default, the line is commented out)

Upload_max_filesize = 2M

the maximum size of a file uploaded to the server. The size is initially set to a very small size - only two megabytes. For example, when loading a database into phpMyAdmin, you will not be able to upload a file larger than 2 megabytes until this setting item is changed.

Max_file_uploads = 20

maximum number of files to upload at one time

Max_execution_time = 30

maximum execution time for one script

Changing these settings is completely optional, but it is useful to know about them.

9. Additional settings for phpMyAdmin

We have already configured phpMyAdmin and for most people the basic functionality is enough. However, on the phpMyAdmin start page there is a message: “Additional features of phpMyAdmin are not fully configured, some functions have been disabled.”

New features are:

  • showing relationships between (related) tables;
  • adding information about tables (starting from version 2.3.0 you can describe in a special table ‘table_info’ which column will be shown in the tooltip when moving the cursor over the associated key);
  • creating a PDF diagram (starting from version 2.3.0 you can create PDF pages in phpMyAdmin showing the relationships between your tables);
  • display column comments (since version 2.3.0 you can make a comment describing each column for each table. And they will be visible in the "print preview". Since version 2.5.0, comments are used on the tables' own pages and in the mode view, appearing as tooltips above columns (property tables) or embedded in the table header in view mode. They can also be shown in the table dump);
  • create bookmarks (since version 2.2.0, phpMyAdmin allows users to bookmark queries. This can be useful for frequently used queries);
  • history of SQL queries (starting from version 2.5.0 you can save your history of all SQL queries that were made through the phpMyAdmin interface);
  • designer (starting from version 2.10.0, the Designer tool is available; it allows you to visually manage relationships between tables);
  • information about recently used tables;
  • customizing the interface of frequently used tables;
  • tracking (starting from version 3.3.x, a tracking mechanism is available. It helps you track every SQL command that was executed by phpMyAdmin. Recording of data manipulation and command recording is supported. Once enabled, you will be able to version tables);
  • user settings (starting from version 3.4.x, phpMyAdmin allows users to set most settings and save them in the database);
  • custom menus (starting from version 4.1.0 you can create user groups that will only have access to assigned menu items. A user can be assigned to a group and will only see menu items available to their group);
  • hide/show navigation items (starting from version 4.1.0 you can hide/show items in the navigation tree).
  • and others

Now we will fully configure these additional features. Go to the link http://localhost/phpmyadmin/chk_rel.php and click "Create database". After this, all new features will be activated.

A few screenshots of the new features:

1) Designer

2) Tracking

10. Installation of a mail plug

In the C:\Server\bin\ directory, create a new directory called Sendmail. Now in this directory create a file sendmail.php with the following content:

#!/usr/bin/env php

Open the PHP configuration file, it is located here C:\Server\bin\PHP\php.ini. And add one line there:

Sendmail_path = "C:\Server\bin\PHP\php.exe C:\Server\bin\Sendmail\sendmail.php --dir C:\Server\bin\Sendmail\emails"

Save the file and restart the server. Great, now all sent emails will be saved in the directory C:\Server\bin\Sendmail\emails\

Letters will have the extension .eml and they can be opened, for example, by the program Thunderbird. Or a regular text editor.

11. Adding a PHP directory to PATH on Windows

If this is not done, there may be problems with some PHP modules, including php_curl.dll, php_intl.dll, php_ldap.dll, php_pdo_pgsql.dll and php_pgsql.dll. At least, every time the server starts, the following appears in the logs:

PHP Warning: PHP Startup: Unable to load dynamic library "C:\\Server\\bin\\PHP\\ext\\php_curl.dll" - \xef\xbf\xbd\xef\xbf\xbd \xef\xbf\ xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\ xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\ xbf\xbd\xef\xbf\xbd.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library "C:\\Server\\bin\\PHP\\ext\\php_intl.dll " - \xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef \xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library " C:\\Server\\bin\\PHP\\ext\\php_ldap.dll" - \xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\ xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\ xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd.\r \n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library "C:\\Server\\bin\\PHP\\ext\\php_pdo_pgsql.dll" - \xef\xbf\xbd\xef\xbf \xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef \xbf\xbd\xef\xbf\xbd\xef\xbf\xbd.\r\n in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library "C:\\Server\\bin\\PHP\ \ext\\php_pgsql.dll" - \xef\xbf\xbd\xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\ xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\ xef\xbf\xbd \xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd\xef\xbf\xbd.\r\n in Unknown on line 0

To avoid these warnings, you need to add the path to PHP to your system environment variables.

Click the Start button (or whatever it's called on Windows 10?), start typing " Changing system environment variables» and open the corresponding settings window.

There click " Environment Variables»:

In the window " System Variables» find and click on Path, then click " Change»:

Move the entry to the top:

Close all windows and save your changes.

Restart the server.

12. Freeze, slow traffic and/or server error Asynchronous AcceptEx failed

If your server “freezes” even without load - it does not show web pages until restarted, and in the server logs there are errors Asynchronous AcceptEx failed:

AH00455: Apache/2.4.9 (Win64) PHP/5.5.13 configured -- resuming normal operations AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:42:59 AH00094: Command line: "c:\\Server\\ bin\\Apache24\\bin\\httpd.exe -d C:/Server/bin/Apache24" AH00418: Parent: Created child process 4952 AH00354: Child: Starting 64 worker threads. (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed. (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed. (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed. (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed. (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed. (OS 64)The specified network name is no longer available. : AH00341: winnt_accept: Asynchronous AcceptEx failed.

Then add to the Apache configuration file:

AcceptFilter http none AcceptFilter https none EnableSendfile off EnableMMAP off

13. Configuring cURL in the Apache web server on Windows

If you don't know what cURL is, then you don't need it. Those. Feel free to skip this step.

cURL is a console utility that allows you to exchange data with remote servers using a very large number of protocols. cURL can use cookies and supports authentication. If a web application requires cURL, then this must be specified in the dependencies. Many popular applications do not require cURL, for example phpMyAdmin and WordPress do not need to configure cURL.

If cURL is not configured correctly, you will receive errors:

Fatal error: Call to undefined function curl_multi_init() in ...

curl error: SSL certificate problem: unable to get local issuer certificate

To make cURL work in Apache on Windows you need:

1) Be sure to add the PHP directory to PATH (system environment variables). How to do this is stated just above:

2) In a file C:\Server\bin\PHP\php.ini line should be uncommented extension=curl

This is usually not required, but you can make a backup copy of the server binary (executable) files if you wish. All these files are located in the folder C:\Server\bin\. These are Apache, MySQL and PHP - i.e. programs that are responsible for the operation of the server, but which we can download from official websites and configure again at any time.

If you want to make a backup copy of them (for example, before upgrading the server), then stop the services:

C:\Server\bin\Apache24\bin\httpd.exe -k stop net stop mysql

And copy the folder to a safe place C:\Server\bin\.

By the way, you can copy the entire server, i.e. folder C:\Server\- in this case, you will simultaneously get a backup copy of both executable files and data (databases, websites).

When the copying is complete, start the services again:

C:\Server\bin\Apache24\bin\httpd.exe -k start net start mysql

15. Server update

All components that make up the web server are actively being developed and new versions are regularly released. When a new version is released, you can update one component (for example, PHP), or several at once.

Deleting a server

If you no longer need the server, or you want to install it again, stop the services and remove them from autostart by sequentially executing on the command line:

C:\Server\bin\Apache24\bin\httpd.exe -k stop c:\Server\bin\Apache24\bin\httpd.exe -k uninstall net stop mysql c:\Server\bin\mysql-8.0\bin\ mysqld --remove

And so we installed the nginx server, now it’s time to install php 7.1 on ubuntu. The nginx + php7 combination has proven itself very well, saving money and server resources.

Installing php 7.1

First, let's add a repository from which we will download and install php 7.1.

Sudo add-apt-repository ppa:ondrej/php

Note: If the system encoding is different from utf-8, then problems may occur when adding the php 7.1 repository. So let's run these two commands

sudo apt install -y language-pack-en-base sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php

Let's update the list of repositories

Sudo apt update

If everything is fine, let's proceed with the installation...

Apt install php7.1 php7.1-fpm php7.1-opcache php7.1-zip php7.1-xmlrpc php7.1-xsl php7.1-mbstring php7.1-mcrypt php7.1-mysql php7.1-odbc php7.1-pgsql php7.1-pspell php7.1-readline php7.1-recode php7.1-snmp php7.1-soap php7.1-sqlite3 php7.1-sybase php7.1-tidy php7.1-xml php7.1-json php7.1-ldap php7.1-intl php7.1-interbase php7.1-imap php7.1-gmp php7.1-gd php7.1-enchant php7.1-dba php7.1-bz2 php7.1-bcmath php7.1-phpdbg php7.1-cgi php7.1-cli

We agree with the installation and wait until everything is completed.

And so everything is ready - php 7.1, and extensions are installed. If other versions of php5 were installed on the system, you can remove them by running the command:

Apt autoremove php5* -y && apt purge php5* -y && apt clean php5*

Setting up php 7.1

The php setup will be as follows:

  • Fixing vulnerabilities
  • Increasing the upload file size
  • Increasing script running time
  • Setting up opcache

Open php.ini

Sudo nano /etc/php/7.1/fpm/php.ini

looking for a line

;cgi.fix_pathinfo = 1

uncomment the line and put 0 in place of one

Cgi.fix_pathinfo = 0

Let's increase the size of the downloaded files. Find post_max_size and bring it to form

Post_max_size = 100M

Let's increase the script processing time, look for max_execution_time and set it to 300 seconds - usually needed for working with large mysql tables

Opcache.enable=1 opcache.enable_cli=1 opcache.memory_consumption=64 opcache.interned_strings_buffer=4 opcache.max_accelerated_files=7963 opcache.revalidate_freq=20

Save the file. Restart php7.1-fpm

Service php7.1-fpm restart

Install MySQL server and phpmyadmin

sudo apt install mysql-server-5.7

During installation, we will be asked to set a password for the mysql server administrator. Fulfill the request.
All is ready. Now let's install the database manager

Sudo apt install phpmyadmin

During installation, it will most likely ask you to select a web server, select any, if it asks you to set a password for the database, set it.
Now we’ll make a symbolic link to the directory where our website will be located

Ln -s /usr/share/phpmyadmin /var/www/html/my.site.ru

You can access the database manager at

My.site.ru/phpmyadmin/

In the future, you can create your own nginx configuration file for the phpmyaadmin database manager, and transfer it to a subdomain like mysql.my.site.ru, and set server authorization.

If you have any questions, write in the comments.

Php is a popular web programming and website development language. With each new version, the language became more and more interesting, it all started with a simple functionally oriented programming language suitable only for creating web pages, and finally Php 5 is now positioned as a full-featured objective-oriented scripting language. php 7 brings many interesting improvements and fixes, such as total performance optimization and the addition of multi-threading, but today we’re not talking about that; you can find reviews of php 7 features on the Internet.

This instruction will describe installing php 7 on Linux; it is intended primarily for Ubuntu users, but is also suitable for other distributions. We'll look at installing from a PPA on Ubuntu and building from source.

PPA repositories allow third-party developers to distribute their software packages, bypassing the official Ubuntu repositories. Usually you can get the newest or even beta versions of programs from a PPA. After the official release of php 7, a PPA was made for Ubuntu. Let's add it to the system:

$ sudo add-apt-repository ppa:ondrej/php-7.0

sudo apt-get update

And you can install:

sudo apt-get install php7.0

To support mysql you need to install the library:

sudo apt-get install php7.0-mysql

To install php as an fpm module, run:

sudo apt-get install php7.0-fpm

Building php 7 from source

First, let's install the tools and libraries we need:

sudo apt-get install git autoconf bison libxml2 libxml2-dev opessllibcurl4-openssl-dev libbz2-dev libjpeg-dev libpng-dev libxpm-dev libfreetype6-dev libgmp-dev libmcrypt-dev libmysqld-dev libpspell-dev librecode-dev

Let's create a working folder:

Let's synchronize php sources from the git repository:

git clone https://git.php.net/repository/php-src.git

We proceed directly to the assembly and installation, the program will be installed in the current folder - ~/tmp:

cd php-src
$ sudo ./buildconf
$sudo./configure\
--enable-mbstring\
--enable-zip\
--enable-bcmath\
--enable-pcntl\
--enable-ftp\
--enable-exif \
--enable-calendar\
--enable-sysvmsg\
--enable-sysvsem\
--enable-sysvshm\
--enable-wddx\
--with-curl\
--with-mcrypt\
--with-iconv\
--with-gmp\
--with-pspell\
--with-gd\
--with-jpeg-dir=/usr\
--with-png-dir=/usr\
--with-zlib-dir=/usr\
--with-xpm-dir=/usr\
--with-freetype-dir=/usr\
--with-t1lib=/usr\
--enable-gd-native-ttf\
--enable-gd-jis-conv\
--with-openssl\
--with-mysql=/usr \
--with-pdo-mysql=/usr \
--with-gettext=/usr\
--with-zlib=/usr\
--with-bz2=/usr\
--with-recode=/usr \
--with-mysqli=/usr/bin/mysql_config
$make

Create a folder for the configuration file:

mkdir $HOME/tmp/usr/etc

Create a php configuration file with the following content:

nano $HOME/tmp/usr/etc/php.ini

max_execution_time=600
memory_limit=128M
error_reporting=0
display_errors=0
log_errors=0
user_ini.filename=
realpath_cache_size=2M
cgi.check_shebang_line=0
zend_extension=opcache.so
opcache.enable_cli=1
opcache.save_comments=0
opcache.fast_shutdown=1
opcache.validate_timestamps=1
opcache.revalidate_freq=60
opcache.use_cwd=1
opcache.max_accelerated_files=100000
opcache.max_wasted_percentage=5
opcache.memory_consumption=128
opcache.consistency_checks=0

Save, and php 7 is installed and configured, you can proceed to testing.

To download the Windows distribution of PHP 7, you should visit the binary file download section of the official PHP website. Each release comes with four options:

  • x86 Non Thread Safe- 32-bit CGI version of the distribution;
  • x86 Thread Safe- 32-bit version for installation as a Web server module;
  • x64 Non Thread Safe- 64-bit CGI version of the distribution;
  • x64 Thread Safe- 64-bit version for installation as a Web server module.

Option Thread Safe is designed to safely execute PHP 7 in parallel threads within a single system process, for example, if PHP is installed as an Apache Web server module. Since we are going to use the built-in server, it doesn't matter which distribution is chosen, it is best to use the option Non Thread Safe. The latter option is also used when connecting PHP as an external FastCGI application, which is launched for each external request.

Before the name of the distribution, one of the abbreviations VC11, VC14 can be placed, meaning the versions of Visual Studio (2012 and 2015, respectively), with which the distribution was compiled. In order to successfully run the project, you should download the appropriate Visual C++ Redistributable Package for Visual Studio, which contains the necessary dynamic libraries:

Attention!

Libraries from the English version of Visual Studio are required; the Russian version of the package will not work.

After downloading the zip archive, you should unpack it into some folder, for example C:\php.

You can make sure that PHP 7 is available by running the command line, and then go to the C:\php folder using the command

>cd C:\php

By running the php command on the command line with the -v parameter, you can find out the current version of PHP:

> php -v PHP 7.0.0 (cli) (built: Dec 3 2015 09:31:54) (NTS) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies

In order for the PHP command to be available anywhere in the file system, the path to the PHP interpreter should be specified in the path environment variable.

To access environment variables, you need to open the Control Panel, go to the section System. The fastest way to get to this point is to right-click on the button Start and select item System from the context menu. On operating systems earlier than Windows 8, select Start paragraph Computer and select the item in the context menu Properties. In the Control Panel window that opens with the active section System click on the link on the left Advanced System Settings. Then in the System Properties window, on the Advanced tab, click the button Environment Variables. In the dialog box that opens, in the section System Variables you should look for the path environment variable and complete it with the path to the C:\php directory. The individual paths in the value of the path variable are separated by semicolons (a semicolon is not required at the end of the entire line). After this, the php command will be available in any folder on your computer.

And describes only distinctive points, which relate to installing Apache24 and PHP7 on Windows. The description of installing the MySQL DBMS remains the same and is not repeated in this instruction.

Before you continue reading, pay attention to whether you really need to install and configure all this under Windows? Maybe you should pay attention and not waste your time and nerves setting up the same thing directly in Windows? In any case, read the article about. Perhaps it will save you not only time, but also health.

This manual is intended for developers with basic knowledge Apache and PHP. This manual will describe only difference in installing Apache and PHP with basic instructions for installing PHP 5.6. If you do not know what a WEB server, http protocol and PHP interpreter are, then you can always learn about it in more detail by reading the documentation.

I will not answer in the comments questions the answer to which is in this or the main instructions; the link to the main instructions is indicated in the first paragraph, as well as questions that relate to understanding the work of Apache and PHP, and even more so to questions about errors in development. For this, there are appropriate resources, literature, forums, and courses. However, you can always ask any question you are interested in. Perhaps someone from the community can help you.

So, let's go!

Installing Apache 2.4 VC14

  1. Loading Apache 2.4 binaries VC14 for your system via the link http://www.apachelounge.com/download/ Download the 64-bit version of the server. At the time of writing these lines, the file was called like this: httpd-2.4.17-win64-VC14.zip
  2. If you need any additional modules, you can download them there (not necessary for the basic installation)
  3. Download and install Visual C++ Redistributable for Visual Studio 2015 updates from the Microsoft website.
  4. Unzip the contents of the folder Apache24 from the downloaded archive to D:\USR\apache. Please note that in D:\USR\apache you need to put not the Apache24 folder from the archive, but its contents. There is no need to install anything.
  5. Change the value in the file ServerRoot on "d:/USR/apache" (line 37) and value DocumentRoot(And Direcroty) on "d:/USR/www" (lines 243 and 244). You should also uncomment line 219 and change it to: ServerName localhost:80
  6. We change the log storage parameters in the same file (find the parameters and change): ErrorLog "D:/USR/log/apache-error.log" CustomLog "D:/USR/log/apache-access.log" common
  7. Install the Apache service. Open the command line on behalf of the Administrator and insert the following line there: D:\USR\apache\bin\httpd.exe -k install
  8. We monitor error messages during service installation. If everything is done correctly, there should be no errors. If, after executing the line, the command line does not appear again, then you did something wrong. Simply use the copy and paste functions to avoid typing errors.
  9. Create a shortcut on the desktop for D:\USR\apache\bin\ApacheMonitor.exe and/or put it in startup (to open the startup window in WIN8..10 you need to press WIN+R, then enter shell:Startup and click OK)
  10. Launch ApacheMonitor. A shortcut will appear in the system tray. Left-click on it and select Apache24 -> Start.
  11. In the browser go to http://localhost/ - you should see It works!
  12. If you don’t see such an inscription, we figure out what went wrong (we read the logs, google, try to figure out the problem ourselves, since we decided to understand the intricacies of the web server)

Installing PHP 7

  1. Download the latest version VC14 x64Thread Safe via the link http://windows.php.net/download/. Please note that you need VC14 and exactly Thread Safe. The file you need will most likely be named something like: php-7.0.0-Win32-VC14-x64.zip
  2. Extracting the contents of the archive into D:\USR\php. As with Apache, there is no need to install anything.
  3. To file D:\USR\apache\conf\httpd.conf add the lines: LoadModule php7_module "d:/USR/php/php7apache2_4.dll" AddHandler application/x-httpd-php .php # Path to the php.ini file PHPIniDir "D:/USR/php"
  4. And we change meaning parameter DirectoryIndex on index.html index.php (line 278)
  5. Using ApacheMonitor restart Apache (Apache24 -> Restart)
  6. We go to the browser http://localhost/index.php and make sure that PHP is working (the browser will display PhpInfo).
  7. Making a copy of the configuration file template D:\USR\php\php.ini-development With name D:\USR\php\php.ini- This is a configuration file for PHP.
  8. Editing the configuration file D:\USR\php\php.ini. Using the search, we find inside the file, uncomment it and change the parameters. Note that the extension parameter specifies a set of PHP extensions. Uncomment the extensions that you need. In the example, the extensions that I needed. Specify your time zone, not mine: extension_dir = "D:/USR/php/ext" sys_temp_dir = "D:/USR/tmp" extension=php_curl.dll extension=php_gd2.dll extension=php_gettext.dll extension=php_mbstring. dll extension=php_mysqli.dll extension=php_openssl.dll date.timezone = Europe/Zaporozhye

    If you have problems running curl, please refer to these instructions.

  9. Execute on the command line php -m to view the list of connected extensions.
  10. Restarting Apache using ApacheMonitor

The installation and configuration of everything else has not changed. Please refer to the PHP 5.6 Installation Guide for details.







2024 gtavrl.ru.