Difference between revisions of "Manual installation on Windows"

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
Tag: 2017 source edit
m
Tag: 2017 source edit
(3 intermediate revisions by the same user not shown)
Line 54: Line 54:
 
**Check the box '''Windows''' in the '''Operating System,''' section.
 
**Check the box '''Windows''' in the '''Operating System,''' section.
 
**in the '''Package Type''' section, tick '''MSI Package'''.
 
**in the '''Package Type''' section, tick '''MSI Package'''.
**In the '''CPU''' section, check '''32-bit''' or '''64-bit''' depending on your operating system (if you do not know, refer to the Appendix [[Draft:Manual installation on Windows#How do I know if my computer runs the 32-bit or 64-bit version of Windows ?|How do I know if my computer runs the 32-bit or 64-bit version of Windows ?]]).
+
**In the '''CPU''' section, check '''32-bit''' or '''64-bit''' depending on your operating system (if you do not know, refer to the Appendix [[Draft:Manual_installation_on_Windows#How do I know if my computer runs the 32-bit or 64-bit version of Windows ?|How do I know if my computer runs the 32-bit or 64-bit version of Windows ?]]).
 
*Click on the link to download the only file now displayed in the list.
 
*Click on the link to download the only file now displayed in the list.
  
Line 63: Line 63:
 
File:MariaDB Install 3.png|This page allows you to customize the components to be installed. By default, all components are selected to be installed. Click on '''Next'''.
 
File:MariaDB Install 3.png|This page allows you to customize the components to be installed. By default, all components are selected to be installed. Click on '''Next'''.
 
File:MariaDB Install 4.png|In this step, the installer asks you to choose a password for the database administrator. Choose a strong password that you will remember then enter it in the fields '''New root password''' and '''Confirm'''. Also check the box '''Use UTF8 as default server's character set''' then click '''Next'''.
 
File:MariaDB Install 4.png|In this step, the installer asks you to choose a password for the database administrator. Choose a strong password that you will remember then enter it in the fields '''New root password''' and '''Confirm'''. Also check the box '''Use UTF8 as default server's character set''' then click '''Next'''.
File:MariaDB Install 5.png|In this step, the installer proposes to customize the port on which the database server will be available and allows to create a Windows Service allowing the automatic start of the server when the computer is started. Leave all the default choices and click '''Next'''. If port 3306 is already in use, read the appendix [[Manual installation on Windows#What are "Listening Ports" and how do I know if a program already occupies a specific port? |What are "Listening Ports" and how do I know if a program already occupies a specific port?]] for more information.
+
File:MariaDB Install 5.png|In this step, the installer proposes to customize the port on which the database server will be available and allows to create a Windows Service allowing the automatic start of the server when the computer is started. Leave all the default choices and click '''Next'''. If port 3306 is already in use, read the appendix [[Manual_installation_on_Windows#What are "Listening Ports" and how do I know if a program already occupies a specific port? |What are "Listening Ports" and how do I know if a program already occupies a specific port?]] for more information.
 
File:MariaDB Install 6.png|his page allows you - if you wish - to send anonymous information about your use to the MariaDB designers (choose, then click '''Next''').
 
File:MariaDB Install 6.png|his page allows you - if you wish - to send anonymous information about your use to the MariaDB designers (choose, then click '''Next''').
 
File:MariaDB Install 7.png|Click '''Install''' to start the installation.
 
File:MariaDB Install 7.png|Click '''Install''' to start the installation.
Line 263: Line 263:
 
This command tests the validity of your <code>httpd.conf</code> file and should return the line where the error is encountered.  
 
This command tests the validity of your <code>httpd.conf</code> file and should return the line where the error is encountered.  
  
In addition to common syntax errors due to carelessness, one of the most common errors is the absence of the file <code>C:\php\php7apache2_4.dll</code>. This file is indeed missing if you have downloaded the wrong version of PHP ('''<u>No</u>''' '''Thread Safe''') instead of the '''Thread Safe''' version. In this case, download the good archive ('''Thread Safe''') and perform the [[Manual_Installation_Under_Windows#Extract_the_archive_for_PHP_installation]] part again.
+
In addition to common syntax errors due to carelessness, one of the most common errors is the absence of the file <code>C:\php\php7apache2_4.dll</code>. This file is indeed missing if you have downloaded the wrong version of PHP ('''<u>No</u>''' '''Thread Safe''') instead of the '''Thread Safe''' version. In this case, download the good archive ('''Thread Safe''') and perform the [[Manual_Installation_On_Windows#Extract_the_archive_for_PHP_installation]] part again.
  
Another problem that can be encountered is the impossibility to start '''Apache2''' because the port '''80''' is already used by another program. See the appendix [[Manual Installation under Windows#What are "Listening Ports" and how to know if a program already occupies a specific port? |What are "Listening Ports" and how to know if a program already occupies a specific port?]] for instructions on how to proceed.
+
Another problem that can be encountered is the impossibility to start '''Apache2''' because the port '''80''' is already used by another program. See the appendix [[Manual_Installation_On_Windows#What are "Listening Ports" and how to know if a program already occupies a specific port? |What are "Listening Ports" and how to know if a program already occupies a specific port?]] for instructions on how to proceed.
  
 
Once you have corrected any errors, try again to start the '''Apache2.4''' Service with the command mentioned above.
 
Once you have corrected any errors, try again to start the '''Apache2.4''' Service with the command mentioned above.
Line 296: Line 296:
  
 
You can now close the software '''MySQL Client (MariaDB 10.4 (x64)'''.
 
You can now close the software '''MySQL Client (MariaDB 10.4 (x64)'''.
 +
 +
===Check if Apache2 works properly===
 +
 +
*Start your favorite Web Browser (Firefox, Google Chrome, Opera, Brave, Vivaldi, Internet Explorer, Edge, etc.) and enter the address <code>http://localhost</code> in the address bar then validate with '''Enter'''.
 +
 +
If you have correctly installed '''Apache2''', the "Web Server" should answer you a nice <code>It works!</code>.
 +
[[File:It works! Apache2.png|none|frame|The Web Server default page '''Apache2''.|link=Special:FilePath/It_works!_Apache2.png]]
 +
 +
This concludes our '''Apache2''' test.
 +
 +
We were indeed able to get a response from the Web Server '''Apache2''' (in this case <code>It works!</code>) which proves that it was correctly installed and started.
 +
 +
You can now close your Web Browser.
 +
<br />
 +
 +
===Check if PHP works properly===
 +
Concerning the PHP part, we have two things to check.
 +
 +
#The files <code>index.php</code> are correctly recognized when accessing a directory.
 +
#The files <code>*.php</code> are correctly interpreted by PHP and return HTML.
 +
 +
*With the Windows '''File Explorer''', go to the '''Local Disk (C:)''' then in the directory '''Apache24'''. Finally, go to the '''htdocs''' directory (<code>C:\Apache24\htdocs</code>).
 +
 +
You will find in this folder a file <code>index.html</code>. This is the famous file which contains <code><nowiki><html><body><h1>It works!</h1></nowiki><nowiki></body></nowiki><nowiki></html></nowiki></code> is the HTML answer which was sent back to us '''Apache2''' when we accessed the server by typing the address <code>http://localhost</code>.
 +
 +
*In the folder '''htdocs''' (<code>C:\Apache24\htdocs</code>), create a new folder <code> test</code> (right click, '''New''' > '''Folder''').
 +
*Double-click on the new folder <code>test</code> to enter it.
 +
*Create a new file <code>index.php</code> (right click, '''New''' > '''Text Document''').
 +
*Open the document with the Windows '''Notepad''' (right click, '''Open with''' > '''Notepad'''; if '''Notepad''' is not proposed, click on '''Choose another software''', then on '''More software''' and select '''Notepad''' in the list before validating with '''OK''').
 +
*Enter the following '''PHP''' code in the file :<syntaxhighlight lang="php">
 +
<?php
 +
phpinfo();
 +
</syntaxhighlight>
 +
*Save the file <code>index.php</code> ('''File''' > '''Save''' or <kbd>Ctrl</kbd> + <kbd>S</kbd>) and close it.
 +
 +
When PHP processes a file, it looks for the opening and closing tags ('''<code>?php</code>''' and '''<code>?</code>''') that delimit the code it must interpret. <code>?php</code> thus allows to indicate that we are going to write '''PHP''' code.
 +
 +
The function <code>[https://www.php.net/manual/en/function.phpinfo.php phpinfo]</code> displays a lot of information about the configuration of '''PHP''', which will allow us to check that '''PHP''' works and that we have activated the right extensions.
 +
 +
*Start your favorite Web Browser (Firefox, Google Chrome, Opera, Brave, Vivaldi, Internet Explorer, Edge, etc.) and this time enter the address <code>http://localhost/test</code> in the address bar then validate with '''Enter'''.
 +
 +
'''Apache2''' should return a page generated by '''PHP''' containing all the configuration information. If you scroll this page, you '''<u>should</u>''' see sections related to the extensions we loaded previously (including <code>curl</code>, <code>gd2</code>, <code>intl</code> and <code>mysqli</code>). If one of these sections is not displayed, it means that the extension is not loaded (so you forgot to remove a semicolon in front of an extension name when editing the <code>C:\php\php.ini</code> or you forgot to copy one of the files mentioned in [[Manual_installation_on_Windows#Copy the files needed for the PHP extensions intl and curl to the bin/ directory of Apache2|Copy the files needed for the PHP extensions <code>intl</code> and <code>curl</code> to the <code>bin/</code> directory of Apache2]]. Check and correct if necessary your omissions and then restart the Service '''Apache2.4''' so that your changes are taken into account (see appendix [[Manual_installation_on_Windows#How to manage Windows "Services" ?|How to manage Windows "Services" ?]] to know how to restart an existing Service).
 +
 +
[[File:Phpinfo().png|border|none|thumb|750x750px|''Apache2'' returns the page with the configuration information generated by ''PHP''.]
 +
<This concludes our test of ''PHP''.
 +
 +
We were indeed able to verify that '''PHP''' works correctly because it returns the information related to its current configuration.
 +
 +
Moreover, the files '''PHP''' <code>index.php</code> are well interpreted as index files because our file was well executed by typing <code>http://localhost/test</code> (we did not need to type <code>[http://localhost/test http://localhost/test/index.php]</code> ).
 +
 +
*With the Windows '''File Explorer''', go to the '''Local Disk (C:)''' then to the '''Apache24''' directory. Finally, go to the '''htdocs''' directory (<code>C:\Apache24\htdocs</code>).
 +
*Delete the folder <code> test</code> that we previously created.
 +
 +
You can now close the Windows File Explorer and your Web Browser.
 +
<br />
 +
 +
*
 +
 +
#

Revision as of 11:44, 22 May 2020

This page describes the installation of various components needed to run Dolibarr on a Windows environment.

The installation has been done on Windows 10 but should be functional for earlier versions of Windows - some screenshots just won't fit.

If you are a beginner, please note that the section Installation - Update With DoliWamp (Windows .exe package) also discusses automated installation with DoliWamp.


The interest to install even the different "Server" components needed for Dolibarr to work properly is the possibility to choose newer versions than those proposed by the DoliWamp installer.

It is also an excellent way to understand how it works and to deepen your knowledge about deployment and maintenance of a Dolibarr instance.


This documentation page has been written with the goal to be understandable to the largest number of people (whatever the computer level). Some precisions could appear as trivial for some people but will certainly be useful for others. If you are a (great) beginner, don't try to go fast and take the time to read the different sections of the page carefully (allow a big half-day for implementation).


In the following page, it has been tried as much as possible to explain the different actions you are going to perform (the aim being to understand and not to copy/paste or mechanically apply instructions). In order to easily distinguish the explanations from the actions to be performed, please note that all the actions to be performed are preceded by a bullet (•).


Dolibarr Architecture

Dolibarr is a Web software of type "Client/Server.

So it requires a 'Web Server with scripting language PHP and a Relational Database Management System to work.

Dolibarr Client/Server Architecture


Functioning

On the "Client" side, you use a Internet browser (Firefox, Chrome, Opera, Internet Explorer, etc.) to access the Dolibarr interface by typing the address of the Web Server.

As soon as you type address to which Web Server answers (for example http://localhost/dolibarr), it will try to display main page of sub directory Dolibarr (according to Web Server configuration, main page of a directory - also called index page - can be for example index.html, index.htm or index.php).

Generally, by default, the Web Server will be configured to recognize only index.html files as index files but we will see together how to add index.php files.

The files .php being script files written in the PHP language, they will not be directly understandable by the browser of the "Client" which is only able to display HTML.

So we will have to tell the Web Server that when it encounters a file with the extension .php, it will have to use its module mod_php to interpret (or convert if you prefer) the PHP code into HTML code before sending it back to the "Client" (i.e. the browser).

Finally, we also need to install a Relational Database Management System, here MariaDB to store Dolibarr data (it's Dolibarr PHP scripts that will interact with the RDBMS to write or read data from it).

Installing and configuring MariaDB

First we will install the MariaDB database server.

Download MariaDB

  • Go to the MariaDB download site and click on the green button Download xx.x.x.xx Stable now! (normally the second green button on the page).
  • In the right column, to filter the available files :
  • Click on the link to download the only file now displayed in the list.

Install MariaDB

At this level, MariaDB is now installed and started. As a Windows "Service" has been created, the RDBMS will be automatically started at each (re)startup of the computer.

Installing and Configuring PHP


Download PHP

  • Please visit https://windows.php.net/download
  • In the list of proposed downloads, take the latest Thread Safe version of PHP corresponding to your architecture (x64 if your system is 64 bits or x86 if your system is 32 bits).
    • This is normally the second proposed download (Warning ! Be careful to download the Thread Safe version and NOT No Thread Safe').
  • Once you have found the right version, download the file by clicking on the link Zip.


Extract the archive to install PHP

  • Once downloaded, right click on the archive and select Extract all....
  • Indicate C:\php as the destination path and click Extract.


Extraire PHP.png


Configure PHP

Now that PHP is uncompressed in the right place, we'll configure some settings.

PHP is delivered with extensions and Dolibarr needs that some of these extensions are enabled (they are not enabled by default).

Enable Display of Filename Extensions

  • In the Windows File Explorer, click on the View tab and check the File Name Extensions checkbox in the Show/Hide group.
Enable Display of File Name Extensions.

Create PHP configuration file from template

To customize your PHP installation, you will have to modify the php configuration file (the file php.ini).

  • Go to the folder where you unpacked PHP (C:\php) using the File Explorer Windows > Local Disk (C: ) > php (if you had checked the Show extracted folders when done box when extracting the archive, the Windows File Explorer should already be open in the right place).

In this folder containing the PHP files, you will find two configuration files "template" php.ini-development and php.ini-production.

  • Make a copy (right click, Copy) of the file php.ini-production and paste it in the same directory (right click, Paste).
  • Rename the copied file (php - Copy.ini-production) to php.ini (right click, Rename on the file).

When validating the new filename, Windows will warn you following the modification of the file extension (you must answer Yes to this question to validate the renaming of the file).

Windows warning when changing file extension.


Activate PHP extensions needed for Dolibarr

Double-click on the file php.ini to open it in Notepad Windows and thus be able to modify it.

Scroll through the file to find the section starting with Dynamic Extensions framed by ; (about halfway through the file) :

;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;

In this section, you will need to remove the ; in front of some of the extensions to load them (change for example ;extension=gd2 to extension=gd2).

Remove the ; in front of the lines ;extension=curl, ;extension=gd2, ;extension=intl, ;extension=mysqli.

Modify some other PHP parameters

Tip : To easily find a parameter in the file php.ini, you can use the Search function of the Notepad Windows (menu Edit > Search or Ctrl + F). Enter your search then click on Next. Depending on your position in the file, feel free to reverse the direction of the search by selecting the option Top instead of Bottom in the frame Direction then click again on next to search in the opposite direction of the file.

The Search dialog box allows you to search a text in the file.


Set the time zone

Below the section :

;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

Under the sub-section [Date], replace the line ;date.timezone = with date.timezone = Europe/Paris (don't forget to remove the ; at the beginning of the line).

Increase the size of files that can be uploaded

By default, files that can be uploaded on server through button Browse... of Dolibarr forms (PDF bank statements, supplier invoices, etc.) are limited to a size of 2M.

If you want, you can increase this limit by modifying these lines :

  • replace line upload_max_filesize = 2M by upload_max_filesize = 16M for example ;
  • if you choose a value greater than 8M for upload_max_filesize, you will also need to replace post_max_size = 8M by post_max_size = 16M.


Save the file (File > Save or Ctrl + S) and close it.

We have now configured PHP.

Installing and configuring Apache2

Download Apache2


Extract the archive to install Apache2

Unlike installing PHP, we will proceed slightly differently for decompressing the Apache2 archive.

Instead of extracting the entire archive, we will only extract the folder Apache24.

  • To do this, start by double-clicking on the archive httpd-x.x.xx-winxx-VSxx.zip to open it in the Windows File Explorer.
  • Open the Windows File Explorer again and go to the Local Disk (C:).
  • Drag the folder Apache24 from the archive to the Local Disk (C:).
Decompress Apache2 by dragging the Apache24 folder to the Local Disk (C:)

This is followed by a copy of files (longer this time than for PHP) corresponding to the decompression of the archive in the Local Disk (C:).

Copy files from the Apache2 archive to the Local Disk (C:)

Configure Apache2

Now that Apache2 is uncompressed, we will need to change some parameters in its configuration file.

  • With the Windows File Explorer, go to the Local Disk (C:) and then to the Apache24 directory. Finally, go to the conf directory.
  • Double-click on the file httpd.conf to open the file with the Notepad Windows and thus modify the configuration file of Apache2.

Type the hostname of the Web Server

  • Search for the line #ServerName www.example.com:80 and replace it with ServerName localhost:80.

Treat the files index.php as index files

  • Look for the block
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>

and replace it by

<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

So when we access a directory, Apache2 will first look for a index.php file before looking for a index.html file.

Interpreting *.php files

You remember, at the beginning, in the introductory section about Dolibarr architecture, I told you that browsers (Firefox, Chrome, Internet Explorer, etc.) that we use can understand and display only Web pages written in HTML language. So we must tell Apache2 to interpret (convert) files *.php into HTML code understandable by browsers.

  • At the very end of the file httpd.conf, skip a line and paste the following block of code to tell Apache2 to interpret the files *.php :
LoadModule php7_module "c:/php/php7apache2_4.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
  • This will tell Apache2 to use the php7_module provided with PHP that we installed earlier to interpret the *.php files.
  • Save the file httpd.conf (File > Save or Ctrl + S) and close it.

Copy the files needed for the PHP extensions intl and curl into the bin/ directory of Apache2

PHP's intl extension is responsible for the internationalization (translation management) functions of the software that uses it. The PHP extension curl allows to make requests (contact) to external servers.

Dolibarr requires extensions intl and curl and these extensions need some libraries (function files) to work.

These libraries are provided with PHP, but since we use php7_module with Apache2, we need to copy these files from PHP directory to bin/ directory of Apache2 so that extensions intl and curl can work properly.

  • With the File Explorer Windows, go to the Local Disk (C:) then to the php directory (C:\php).
  • Select the files icudt65.dll, icuin65.dll, icuio65.dll, icuuc65.dll, libcrypto-1_1-x64.dll, libssl-1_1-x64.dll and libssh2.dll by clicking on the first file, then while holding the Ctrl key on your keyboard, select the other files by clicking on them.
  • Copy the files (right click, then Copy or Ctrl + C).
  • With the File Explorer Windows, go to the Local Disk (C:) then in the directory Apache24 and then in the sub directory bin (C:\Apache24\bin).
  • Paste the files (right click, then Copy or Ctrl + V).


Create and start the Windows "Service" to automatically launch Apache2

In the first part of this documentation, when we installed the RDBMS MariaDB, remember, there was a page in the installation wizard that proposed to create a Windows "Service" and customize its name.

"Services" are very handy and allow you to automatically start a software when you (re)start your computer. Contrary to the startup folder, "Services" are executed even before opening a Windows user "Session".

We will therefore create a Windows "Service" to automatically start Apache2 when the computer is (re)started.

  • Next to the Windows button that opens the start menu, in the search box "Type here to search", click then type cmd. In the list of proposed options, choose Run as administrator then validate the User Account Control window.
Execute Command Prompt Windows as administrator
  • Enter the following command in the Windows Command Prompt and validate with the Enter key :
C:/Apache24/bin/httpd.exe -k install
Creating the Windows "Service" with the Windows Command Prompt running as administrator.

The "Service" we just created hasn't started yet, so we need to start it for the first time (it will then be started automatically each time the computer is (re)started).

  • Enter the following command in the Windows Command Prompt and validate with the Enter key :
net start Apache2.4
Starting the Windows "Service" Apache2.4 with the Windows Command Prompt running as an Administrator

If the service doesn't start correctly, it's because your configuration file httpd.conf is invalid.

To determine the cause of your error if any, you can enter the following command in the Windows Command Prompt :

C:\Apache24\bin\httpd.exe -n "Apache2.4" -t

This command tests the validity of your httpd.conf file and should return the line where the error is encountered.

In addition to common syntax errors due to carelessness, one of the most common errors is the absence of the file C:\php\php7apache2_4.dll. This file is indeed missing if you have downloaded the wrong version of PHP (No Thread Safe) instead of the Thread Safe version. In this case, download the good archive (Thread Safe) and perform the Manual_Installation_On_Windows#Extract_the_archive_for_PHP_installation part again.

Another problem that can be encountered is the impossibility to start Apache2 because the port 80 is already used by another program. See the appendix What are "Listening Ports" and how to know if a program already occupies a specific port? for instructions on how to proceed.

Once you have corrected any errors, try again to start the Apache2.4 Service with the command mentioned above.

You can now close the Windows Command Prompt.

Apache2.4 is now installed as a Windows "Service" and started. The Apache2 "Web Server" will therefore be started automatically each time the computer is (re)started.

Check that everything's working

Before continuing (the installation of Dolibarr), let's take a moment to verify that our current installation works properly.

Check if the RDBMS MariaDB works properly

  • Beside the Windows button to open the start menu, in the search box "Type here to search", click and then type mysql client. In the list of options on the right, choose "Open" or click on the full title of the software to launch it (MySQL Client (MariaDB 10.4 (x64)).
Run the software MySQL Client (MariaDB 10.4 (x64))

.

The MySQL Client (MariaDB 10.4 (x64) software is launched.

This is a command prompt specific to your RDBMS MariaDB allowing you to execute database commands (in SQL language).

  • Enter the password of the database administrator that you chose during the installation of MariaDB previously (in the fourth screen of the installer) then press Enter to validate the password.
  • Enter the SQL statement SHOW DATABASES; to list the current databases then press Enter to validate the command.

MariaDB should answer you with the list of databases automatically created during installation: information_schema, mysql, performance_schema and test.

List of databases managed by the RDBMS MariaDB installed on our computer.

This concludes our test of MariaDB's functionality.

We were indeed able to successfully connect to the RDBMS with the administrator password we had previously chosen and the execution of an SQL statement ( SHOW DATABASES; ) worked correctly.

You can now close the software MySQL Client (MariaDB 10.4 (x64).

Check if Apache2 works properly

  • Start your favorite Web Browser (Firefox, Google Chrome, Opera, Brave, Vivaldi, Internet Explorer, Edge, etc.) and enter the address http://localhost in the address bar then validate with Enter.

If you have correctly installed Apache2, the "Web Server" should answer you a nice It works!.

The Web Server default page 'Apache2.

This concludes our Apache2 test.

We were indeed able to get a response from the Web Server Apache2 (in this case It works!) which proves that it was correctly installed and started.

You can now close your Web Browser.

Check if PHP works properly

Concerning the PHP part, we have two things to check.

  1. The files index.php are correctly recognized when accessing a directory.
  2. The files *.php are correctly interpreted by PHP and return HTML.
  • With the Windows File Explorer, go to the Local Disk (C:) then in the directory Apache24. Finally, go to the htdocs directory (C:\Apache24\htdocs).

You will find in this folder a file index.html. This is the famous file which contains <html><body><h1>It works!</h1></body></html> is the HTML answer which was sent back to us Apache2 when we accessed the server by typing the address http://localhost.

  • In the folder htdocs (C:\Apache24\htdocs), create a new folder test (right click, New > Folder).
  • Double-click on the new folder test to enter it.
  • Create a new file index.php (right click, New > Text Document).
  • Open the document with the Windows Notepad (right click, Open with > Notepad; if Notepad is not proposed, click on Choose another software, then on More software and select Notepad in the list before validating with OK).
  • Enter the following PHP code in the file :
    <?php
    phpinfo();
    
  • Save the file index.php (File > Save or Ctrl + S) and close it.

When PHP processes a file, it looks for the opening and closing tags (?php and ?) that delimit the code it must interpret. ?php thus allows to indicate that we are going to write PHP code.

The function phpinfo displays a lot of information about the configuration of PHP, which will allow us to check that PHP works and that we have activated the right extensions.

  • Start your favorite Web Browser (Firefox, Google Chrome, Opera, Brave, Vivaldi, Internet Explorer, Edge, etc.) and this time enter the address http://localhost/test in the address bar then validate with Enter.

Apache2 should return a page generated by PHP containing all the configuration information. If you scroll this page, you should see sections related to the extensions we loaded previously (including curl, gd2, intl and mysqli). If one of these sections is not displayed, it means that the extension is not loaded (so you forgot to remove a semicolon in front of an extension name when editing the C:\php\php.ini or you forgot to copy one of the files mentioned in Copy the files needed for the PHP extensions intl and curl to the bin/ directory of Apache2. Check and correct if necessary your omissions and then restart the Service Apache2.4 so that your changes are taken into account (see appendix How to manage Windows "Services" ? to know how to restart an existing Service).

[[File:Phpinfo().png|border|none|thumb|750x750px|Apache2 returns the page with the configuration information generated by PHP.] <This concludes our test of PHP.

We were indeed able to verify that PHP works correctly because it returns the information related to its current configuration.

Moreover, the files PHP index.php are well interpreted as index files because our file was well executed by typing http://localhost/test (we did not need to type http://localhost/test/index.php ).

  • With the Windows File Explorer, go to the Local Disk (C:) then to the Apache24 directory. Finally, go to the htdocs directory (C:\Apache24\htdocs).
  • Delete the folder test that we previously created.

You can now close the Windows File Explorer and your Web Browser.