Centos 7 redirect http to https

<VirtualHost *:80>

ServerName example.com

Redirect “/” “https://example.com/”

</VirtualHost>

Posted in apache, centOS | Comments Off on Centos 7 redirect http to https

Track Email Messages With Office 365 Mail Trace

On-prem Exchange did not allow message tracking via the Exchange admin center. In Office 365, EAC enables message tracing and offers quite a comfortable experience. Although usually I prefer administrating Exchange Online with PowerShell, I must say that in this case, EAC seems to do its job very efficiently.

Note: It was also possible to perform a message trace in the Microsoft 365 Security and Compliance center. However, Microsoft announced this method is blocked after November 2021 (it was rescheduled from October 5, 2021).

To access Message trace, you can either use this link, or go to Exchange admin center > Mail flow > Message trace:

Message trace in M365

Now, you can either click Start a trace to specify your search criteria from scratch or use one of the templates available below. Templates open the same New message trace window, but they have some fields predefined.

Message trace options

This window lets you define the criteria for the reports you want to generate. You can define the following criteria:

  • Senders – defines senders the tool will incorporate in the reports. The field accepts wildcards, which allows you to easily limit results for a certain domain.
  • Recipients – similar to the Senders fields, it accepts wildcards.
  • Time range – can be configured by using a slider or entering a custom time range.

Additionally, you can click Detailed search options to make your query even more granular:

  • Delivery status – lets you search only for the emails which were, for example, successfully delivered or quarantined. For a list of all available statuses and what they mean, see this section of the article.
  • Message ID – lets you find a specific message. Message ID can be found in the email’s headers.
  • Direction – lets you choose from InboundOutbound and All.
  • Original client IP address.

Remember, tracing messages older than ten days is treated like a Historical Search, no matter if you use EAC or PS. It means that you will have to wait for your reports either way. Generating the reports might take up to a few hours. If you trace messages from the past ten days, clicking search will open a window with the results:

Message trace results

If you want to see details for a chosen email, click it, and a new window will open:

Message trace result details

In this window, you can check what happened to the message. In the example above, you can see that the delivery failed because of a transport rule. You can easily check which transport rule caused the problem and fix the issue.

Back in the main message trace window, you can go to Downloadable reports tab to see a list of the historical searches and extended reports you have requested. If you have started a Historical Search using PowerShell and failed to specify the –NotifyAddress parameter, this is the only place to learn if the message trace is finished and to download the csv file with your report.

Downloadable message trace reports

The downloaded report is in the CSV format. Each row displays information about a single email. To make your report more readable, you can open it in Excel or another spreadsheet.

Posted in 365 | Comments Off on Track Email Messages With Office 365 Mail Trace

Installing PHP on Windows 10 and IIS

1. Configure IIS

Control Panel | Programs | Turn Windows features on or off

Check Internet Information Services
Check IIS | World Wide Web Services | Application Development Features | CGI
OK

01_configureiis

2. Install the NTS (non-thread safe) 64-bit version of PHP

Download and save onto the machine:

http://windows.php.net/downloads/releases/php-7.x.x-nts-Win32-VC14-x64.zip

Extract all the contents of the zip file to C:\PHP

02_unzip_php

Now edit the System PATH variable so IIS knows where the PHP executables are:

Control Panel | System and Security | System | Advanced System Settings
Environment Variables
System Variables | Path | Edit
New -> C:\PHP

03_edit_path_variable

3. Configure the php.ini file. This is the part you’d never figure out without some help.

Make a copy of file C:\PHP\php.ini-development and save it as C:\PHP\php.ini

Edit file php.ini by finding the following entries, uncomment them, and change values to:

1. fastcgi.impersonate = 1
2. cgi.fix_pathinfo = 0
3. cgi.force_redirect = 0
4. open_basedir = “C:\inetpub\wwwroot”
5. extension_dir = “ext”
6. error_log=”php_errors.log”
7. uncomment the 24 Windows Extensions entries:

extension=php_bz2.dll
extension=php_curl.dll
extension=php_fileinfo.dll
extension=php_ftp.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_gmp.dll
extension=php_intl.dll
extension=php_imap.dll
extension=php_interbase.dll
extension=php_ldap.dll
extension=php_mbstring.dll
extension=php_exif.dll
extension=php_mysqli.dll
extension=php_oci8_12c.dll
extension=php_openssl.dll
extension=php_pdo_firebird.dll
extension=php_pdo_mysql.dll
extension=php_pdo_oci.dll
extension=php_pdo_odbc.dll
extension=php_pdo_pgsql.dll
extension=php_pdo_sqlite.dll
extension=php_pgsql.dll
extension=php_shmop.dll

Save the edited php.ini file.

4. Configure IIS to work with PHP

Run | inetmgr
Handler Mappings | Add Module Mapping

Request path: *.php
Module: FastCgiModule (from the dropdown)
Executable (optional): C:\PHP\php-cgi.exe
Name: FastCGI

OK (Yes)

04_iis_handler_mappings

5. Test the installation and configuration

Launch Notepad with Administrative privleges. Create a file test.php and save it at C:\inetpub\wwwroot. The contents are (I use an image because my blog software would choke on HTML text):

file_test_php

Now launch a browser and navigate to

http://localhost/test.php

05_testing
Posted in PHP | Comments Off on Installing PHP on Windows 10 and IIS

Installing PHP on IIS

First, we need to access the PHP website for Windows.

Locate and download the Non-Thread Safe (NTS) versions of PHP.

php windows download

In our example, the following file was downloaded: php-7.2.9-nts-Win32-VC15-x86.zip.

Create a directory named PHP on the root of your C drive.

Extract the content of the file inside the PHP folder.

Windows PHP Folder

PHP for Windows requires the installation of a specific version of Microsoft Visual Studio.

In our example, we downloaded the PHP package build VC15.

PHP Build VC 15 requires the installation of the Microsoft Visual Studio version 2017.

PHP Visual Studio

Download and install Microsoft Visual Studio version 2017 x86.

Visual Studio installation x86

After finishing the Visual Studio installation, we need to add the PHP directory to the PATH environment variable.

Access the System properties window.

Access the Advanced tab and click on the Environment variables button.

System properties windows

Select the PATH variable and click on the Edit button.

path variable

Add the PHP directory to the end of the PATH variable value.

Copy to Clipboard

;C:\PHP

PHP path variable

Open the Windows explorer application and access the PHP folder.

Locate the file named PHP.INI-PRODUCTION.

php ini production

Rename PHP.INI-PRODUCTION to PHP.INI

Edit the file named PHP.INI.

Here is the original file, before our configuration:

Copy to Clipboard

; date.timezone =
; fastcgi.impersonate = 1
; cgi.fix_pathinfo=1
; cgi.force_redirect = 1
; extension_dir = "ext"
; extension=bz2
; extension=curl
; extension=gd2
; extension=ldap
; extension=mbstring
; extension=mysqli
; extension=openssl

Here is the file, after our configuration.

Keep in mind that your timezone file may not be the same as mine.

Copy to Clipboard

date.timezone = America/Sao_Paulo
fastcgi.impersonate = 1
cgi.fix_pathinfo=1
cgi.force_redirect = 0
extension_dir = "ext"
extension=bz2
extension=curl
extension=gd2
extension=ldap
extension=mbstring
extension=mysqli
extension=openssl

Test the PHP installation.

Open a DOS command prompt and enter the following command.

Copy to Clipboard

C:\> php -info
phpinfo()
PHP Version => 7.2.9
System => Windows NT TECH-DC01 6.3 build 9600 (Windows Server 2012 R2 Standard dition) i586
Build Date => Aug 15 2018 23:05:53
Compiler => MSVC15 (Visual C++ 2017)
Architecture => x86

Congratulations! you installed PHP on the Windows server.

Tutorial – IIS Installation on Windows

Open the Server Manager application.

Access the Manage menu and click on Add roles and features.

Windows 2012 add role

Access the Server roles screen, select the Web Server (IIS) option and click on the Next button.

IIS Installation

On the following screen, click on the Add features button.

IIS Features

On the IIS service screen, select the CGI option and finish the installation.

IIS enable CGI

The IIS server was installed on your computer but we still need to configure the PHP integration.

Open the IIS manager application and access the Handler Mappings option.

IIS Handles Mappings

On the right part of the screen, select the option named: Add Module Mapping.

On the Module mapping screen, you will have to enter the following information:

Copy to Clipboard

• Request Path - *.php
• Module - FastCGIModule
• Executable - C:\php\php-cgi.exe
• Name - PHP

PHP Module IIS

Click on the button named: Request Restrictions.

Select the File or Folder option and click on the OK button.

IIS PHP Request Restrictions

Click on the OK button.

If the following message is presented, click on the Yes button.

IIS Module mapping

Now, we need to configure IIS to accept index.php as a default page.

Open the IIS manager application and access the Default Document option.

IIS default page PHP

On the right part of the screen, select the option named: Add…

On the Add default document window, you will have to enter the following information:

Copy to Clipboard

• index.php

IIS PHP support

To finish the installation you need to restart the IIS service.

Right click on the server name on the top left part of the screen and select the option Stop.

IIS stop

Right click on the server name on the top left part of the screen and select the option Start.

IIS start

Congratulations! You have installed PHP on the Windows server.

The IIS server is now supporting the use of PHP.

Testing Your PHP installation on Windows IIS

Open the notepad application and create a document named test.php

This document should be placed inside the WWWROOT folder.

Copy to Clipboard

<?php
phpinfo();
?>

Open your browser and enter the IP address of your IIS web server plus /test.php

In our example, the following URL was entered in the Browser:

• http://35.162.85.57/test.php

The following content should be presented.

php configuration file

The PHP installation on IIS was tested successfully.

Posted in PHP | Comments Off on Installing PHP on IIS

PHP on IIS in Windows

  • Click Internet Information Services
  • Click World Wide Web Services
  • Click Application Development Features
  • Tick CGI
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 4
  • Wait for the changes to be applied.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 5

Step 2: Download PHP

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 6
  • Extract Zip folder to C:.
  • Name it PHP.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 7

Step 3: Configure PHP.ini

  • Open PHP folder.
  • Copy php.ini-production file & Paste there in the same directory.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 8
  • Rename the copied file as php.ini.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 9
  • Right click on the php.ini file(php). Note that the extension .ini will  not be visible.
  • Open with Notepad.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 11
  • -Press Ctrl + F5 to open search box.
  • Use Up & Down radio buttons, because some of the lines are at top and some are at middle and some are at bottom.
  • “;” is a comment symbol. It means such lines will not be executed.
  • Find the lines below in your php.ini, remove the “;” symbol from their start and make the changes, which I have made.
  • Save these changes as well.

Find — extension_dir = “./” —  Replace with —  extension_dir = “C:PHPext”
Find — fastcgi.impersonate=0 — Replace with —  fastcgi.impersonate=1
Find — cgi.fix_pathinfo=0 — Replace with —  cgi.fix_pathinfo=0
Find — cgi.force_redirect=1 Replace with — cgi.force_redirect=0
Find — error_log = php_errors.log (remove “;“)

Find these lines below and remove only  (“;“) from their start.

extension=curl
extension=gd2
extension=mbstring
extension=mysqli
extension=pdo_mysql

extension=xmlrpc

How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 12
  • Press Ctrl + S to save the changes.

Step 4: Configure The Environment Variables

  • Click Control Panel
  • Click System and Security
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 13
  • Click System
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 14
  • Click Advanced system settings
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 15
  • Click Environmental Variables
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 16
  • Select Path & click Edit under the System variables Label.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 17
  • Click New.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 18
  • Type C:PHP
  • Click OK
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 19

Step 5: Configure IIS

  • Type IIS on Windows Search Bar or Type Run.
  • Click Run.
  • Type inetmgr
  • Click OK
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 21
  • Click Handler Mappings.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 22
  • Click Add Module Mapping
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 23
  • On request path: type *.php
  • On Module, select FastCgiModule from dropdown menu
  • On Executable, browse: C:PHPphp-cgi.exe
  • Name it anything, type FastCGI
  • Click OK.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 24

Step 6: Test The PHP Version

  • On Windows Search Bar Type CMD
  • Right click on it and select as Run as administrator
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 25
  • Type php -version.
  • Here it is showing me VCRUNTIME140.dll error because in my computer, The Visual C++ Redistributable. Packages is not installed.
  • Check the C: drive whether the setup vc_redist.x64.exe is present or not.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 26
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 27
  • Tick vc_redist.x64.exe
  • Click Next to begin downloading
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 28
  • Click the setup to install.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 29
  • Now type again, php -version on command prompt.
  • You can see that it is not showing the error.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 30

Step 7: Test A PHP File

  • Click Windows Search Bar
  • Type Notepad
  • Right Click on Notepad
  • Click Run as administrator
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 31
  • Type this HTML code or write your own code in PHP or HTML.
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 32
  • Save As this file in: C:inetpubwwwroot as test.php
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 33
  • Click this or type this on your browser’s URL bar
  • http://localhost/test.php
  • You can see that I have successfully configured PHP on IIS in Windows 10
How To Install PHP On IIS In Windows 10 Step-By-Step? | Install IIS On Windows 10 35
Posted in PHP | Comments Off on PHP on IIS in Windows