676
edits
Tag: 2017 source edit |
mNo edit summary Tag: 2017 source edit |
||
| Line 154: | Line 154: | ||
We have now configured PHP. | We have now configured PHP. | ||
<br /> | <br /> | ||
==Installing and configuring Apache2== | |||
===Download Apache2=== | |||
*Go to https://www.apachelounge.com/download/ | |||
*Download the file corresponding to the architecture of your operating system by clicking on the link (Win64 for 64 bits or Win32 for 32 bits). | |||
<br /> | |||
===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 <code>Apache24</code>. | |||
*To do this, start by double-clicking on the archive <code>httpd-x.x.xx-winxx-VSxx.zip</code> 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:)'''. | |||
[[File:Décompresser Apache2.png|none|thumb|781x781px|Decompress Apache2 by dragging the '''Apache24''' folder to the '''Local Disk (C:)'''|link=Special:FilePath/Décompresser_Apache2.png]] | |||
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:)'''. | |||
[[File:Copie fichiers Apache2.png|none|frame|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 '''<code>httpd.conf</code>''' 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 <code>#ServerName www.example.com:80</code> and replace it with <code>ServerName localhost:80</code>. | |||
====Treat the files <code>index.php</code> as index files==== | |||
* Look for the block | |||
<syntaxhighlight lang="apacheconf"> | |||
<IfModule dir_module> | |||
DirectoryIndex index.html | |||
</IfModule> | |||
</syntaxhighlight>et remplacez le par<syntaxhighlight lang="apacheconf"> | |||
<IfModule dir_module> | |||
DirectoryIndex index.php index.html | |||
</IfModule> | |||
</syntaxhighlight> | |||
So when we access a directory, '''Apache2''' will first look for a <code>index.php</code> file before looking for a <code>index.html</code> file. | |||
====Interpreting <code>*.php</code> 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 <code>*.php</code> into HTML code understandable by browsers. | |||
*At the very end of the file <code>httpd.conf</code>, skip a line and paste the following block of code to tell '''Apache2''' to interpret the files <code>*.php</code> : | |||
<syntaxhighlight lang="apacheconf"> | |||
LoadModule php7_module "c:/php/php7apache2_4.dll" | |||
AddType application/x-httpd-php .php | |||
PHPIniDir "C:/php" | |||
</syntaxhighlight> | |||
*This will tell '''Apache2''' to use the <code>php7_module</code> provided with PHP that we installed earlier to interpret the <code>*.php</code> files. | |||
*Save the file <code>httpd.conf</code> ('''File''' > '''Save''' or <kbd>Ctrl</kbd> + <kbd>S</kbd>) and close it. | |||
===Copy the files needed for the PHP extensions <code>intl</code> and <code>curl</code> into the <code>bin/</code> directory of Apache2=== | |||
PHP's <code>intl</code> extension is responsible for the internationalization (translation management) functions of the software that uses it. | |||
The PHP extension <code>curl</code> allows to make requests (contact) to external servers. | |||
Dolibarr requires extensions <code>intl</code> and <code>curl</code> and these extensions need some libraries (function files) to work. | |||
These libraries are provided with PHP, but since we use <code>php7_module</code> with '''Apache2''', we need to copy these files from PHP directory to <code>bin/</code> directory of '''Apache2''' so that extensions <code>intl</code> and <code>curl</code> can work properly. | |||
*With the '''File Explorer''' Windows, go to the '''Local Disk (C:)''' then to the '''php''' directory (<code>C:\php</code>). | |||
*Select the files <code>icudt65.dll</code>, <code>icuin65.dll</code>, <code>icuio65.dll</code>, <code>icuuc65.dll</code>, <code>libcrypto-1_1-x64.dll</code>, <code>libssl-1_1-x64.dll</code> and <code>libssh2.dll</code> 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''' (<code>C:\Apache24\bin</code>). | |||
*Paste the files (right click, then '''Copy''' or Ctrl + V). | |||
<br /> | |||
===Create and start the Windows "Service" to automatically launch Apache2=== | |||
In the first part of this documentation, when we installed the <abbr title="Relational Database Management System">RDBMS</abbr> 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 <code>cmd</code>. In the list of proposed options, choose '''Run as administrator''' then validate the '''User Account Control''' window. | |||
[[File:Exécuter Invite de commandes en tant qu'administrateur.png|none|Execute '''Command Prompt''' Windows as administrator|thumb|613x613px|link=Special:FilePath/Exécuter_Invite_de_commandes_en_tant_qu'administrateur.png]] | |||
*Enter the following command in the Windows '''Command Prompt''' and validate with the Enter key : | |||
<syntaxhighlight lang="batch"> | |||
C:/Apache24/bin/httpd.exe -k install | |||
</syntaxhighlight> | |||
[[File:Créer le service Apache2 avec l'Invite de commandes Windows.png|none|frame|Creating the Windows "Service" with the Windows '''Command Prompt''' running as administrator.|link=Special:FilePath/Créer_le_service_Apache2_avec_l'Invite_de_commandes_Windows.png]] | |||
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 : | |||
<syntaxhighlight lang="batch"> | |||
net start Apache2.4 | |||
</syntaxhighlight> | |||
[[File:Démarrer le Service Apache2.4.png|none|frame|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 <code>httpd.conf</code> is invalid. | |||
To determine the cause of your error if any, you can enter the following command in the Windows '''Command Prompt''' :<syntaxhighlight lang="batch"> | |||
C:\Apache24\bin\httpd.exe -n "Apache2.4" -t | |||
</syntaxhighlight> | |||
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. | |||
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. | |||
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 <abbr title="Relational Database Management System">RDBMS</abbr> MariaDB works properly=== | |||
*Beside the Windows button to open the start menu, in the search box "'''Type here to search'''", click and then type <code>mysql client</code>. 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)'''). | |||
[[File:Lancer MySQL Client.png|none|thumb|561x561px|Run the software '''MySQL Client (MariaDB 10.4 (x64))'''|link=Special:FilePath/Lancer_MySQL_Client.png]]. | |||
The '''MySQL Client (MariaDB 10.4 (x64)''' software is launched. | |||
This is a command prompt specific to your '''<abbr title="Relational Database Management System">RDBMS</abbr>''' '''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 <code>SHOW DATABASES;</code> 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: <code>information_schema</code>, <code>mysql</code>, <code>performance_schema</code> and <code>test</code>. | |||
[[File:Lister les bases de données MariaDB.png|none|frame|List of databases managed by the '''RDBMS''' '''MariaDB''' installed on our computer.|link=Special:FilePath/Lister_les_bases_de_données_MariaDB.png]] | |||
This concludes our test of MariaDB's functionality. | |||
We were indeed able to successfully connect to the <abbr title="Relational Database Management System">RDBMS</abbr> with the administrator password we had previously chosen and the execution of an SQL statement ( <code>SHOW DATABASES;</code> ) worked correctly. | |||
You can now close the software '''MySQL Client (MariaDB 10.4 (x64)'''. | |||
edits