Intranet applications are programs that are only
made available to a closed group of users in the local network.
The display often occurs in a browser, e.g. Firefox, Edge, Chrome.
The presentation of the application is like a web page,
however, the contents do not come from outside, but from the company's own server.
An advantage of an intranet application in the browser is that multiple users can work with the same database simultaneously. Additionally, the program doesn't need to be installed on every computer and it's independent of the operating system, i.e. it runs on Windows, Mac, Linux, possibly a tablet/pad or smartphone. And in case of a program update, it's sufficient to install the new version once on the central server. If the server has a Windows operating system, you can use the IIS (Internet Information Services) that comes with Windows
as web server software, see below. On Linux, however, NGINX or Apache HTTP Server are usually used.
AI Symbolic Image |
Activate IIS in Windows
The IIS (Internet Information Services) are part of Windows.
If you activate IIS in the settings,
Windows takes care of the installation and updates.
Menus in Windows 10 ...
World Wide Web Services > Security > URL Authorization
URL Authorization is needed to, for example, block external access to certain subfolders.
With Apache, you use a configuration file called ".htaccess" for this,
with IIS, however, it's an XML file called "web.config" in the respective folder. More on this below.
After you've confirmed your selection with Ok, Windows activates IIS (web server) and creates a web root directory on your hard drive, see C:\inetpub\wwwroot\ You can check if the web server is active by entering in your web browser: http://localhost/ or http://127.0.0.1/ |
Install PHP
Download PHP for Windows from php.net, at
https://windows.php.net/download. There is no installer, but a .ZIP file. Take the NTS version (Non-Thread Safe), which is recommended for Windows IIS. Unpack the ZIP file into a new folder whose name (and entire path) must not contain any spaces. The documentation therefore suggests the folder C:\PHP\. In the unpacked PHP folder
you will find a file called "php.ini-production".
Copy the file and rename the copy to "php.ini".
If necessary, you can make your own settings in the php.ini.
The PHP folder should only be writable with admin rights (which is given in the Program Files folder), so that the folder cannot be manipulated. |
Configure IIS for PHP Finally, IIS needs to be told where to find the PHP folder.
To do this, open the IIS Manager by right-clicking on the Windows Start menu, selecting 'Run' and entering "inetmgr" there.
The management program opens.
Set ...
|
Test PHP To test if PHP and the IIS web server
are working together correctly, you need a .php file that is stored in the web root.
Create, for example, a file "phpinfo.php" with the following content:
<?php phpinfo(); ?>
Save the file in: C:\inetpub\wwwroot\
You can then simply open the file in the browser: http://localhost/phpinfo.php Instead of the source code, you should see a detailed page that lists all PHP settings. |
Replacement for .htaccess in IIS
In the Apache web server, it is common to have a configuration file named ".htaccess" stored in individual folders,
which controls what properties the folder has.
For Windows IIS, however, an XML file named "web.config" must be saved in the respective folder to configure it individually. "web.config" file to block access from outside ... (the following corresponds to "deny from all" in an .htaccess file) <configuration> <system.webServer> <security> <authorization> <remove users="*" roles="" verbs="" /> <add accessType="Deny" users="*" /> </authorization> </security> </system.webServer> </configuration>
Since we have described the PHP installation here, it is also interesting to be able to define default file names
that should be searched for when calling a mere folder address.
"web.config" file to set index.php as Default Document ... <configuration> <system.webServer> <defaultDocument> <files> <clear /> <add value="index.php" /> </files> </defaultDocument> </system.webServer> </configuration> |
Add MIME Type When I tried out a locally stored webpage, I
noticed that some images weren't displayed. These images are stored in the fairly new .webp file format.
In this case, it seems IIS hadn't yet been set by default to serve .webp files.
This needs to be manually added if needed.
Open the Internet Information Services (IIS) Manager. To do this, go to the Windows Start menu and type "IIS",
then you can click on the IIS Manager. In the Manager window, double-click the "MIME Types" icon.
In the list of file extensions, you can right-click and select "Add".
There, you enter the new file extension and the appropriate MIME type.
|
Hash, Random, Crypto using OpenSSL Data transmission in the local intranet is typically
rarely encrypted using SSL (https), because you need to deal with self-signed certificates for that.
Nevertheless, it's likely that you'll need OpenSSL as an extension for PHP, as there are a few
PHP functions that use OpenSSL, e.g. the hash function openssl_digest(), random numbers using openssl_random_pseudo_bytes()
or other encryptions with openssl_encrypt() and openssl_decrypt().
Conveniently, PHP comes with the OpenSSL extension, but it's not activated by default. Open the "php.ini" file in the PHP folder by right-clicking and selecting "Edit". If you need administrator rights to write in your PHP folder (recommended), you must first start the editor "as administrator" and then load the file in it.
In the configuration, you'll find the following two lines (search for each individually) ...
;extension=openssl ;extension_dir = "ext"A semicolon comments out a line (deactivates it). Remove the semicolon from both lines and save the file. You may need to restart IIS (command line: iisreset) for the change to take effect - or simply restart the computer. |