Category Archives: Internet

Install Apache, PHP and MySQL on Windows Server 2008 R2 SP1

 Apache doesn’t provide binaries for Windows, however Apache provides links to several third-party sites that do provide binaries, for example, Apache Lounge. From the Apache Lounge website, and depending on your Windows Server version (32bir-x86 or 64bit-x64 ) we can download either the 32-Bit version (win32) or the 64-Bit one (Win64)

Download the Prerequisites – Example: 64bit versions:

Go to Apache Lounge: Apache2.4.25-win64-VC14
The File Download: (httpd-2.4.25-win64-VC14.zip)

Go to windows.php.net/download:  PHP-7.1-VC14-x64-Thread-Safe
The File Download: (php-7.1.5-Win32-VC14-x64.zip)

Find this at Microsoft:
C++RedistributableVisualStudio2015 (vc_redist.x64.exe)

Installation Instructions for Apache:

First Install the C++ Redistributable Visual Studio 2015.  It will show up in your Programs and Features in the Control Panel.  Using the PHP-7.15 VC14 x64 thread safe and the Apache2.4.25-Win64=VC14, you should also use the C++ VS2015 x64 redistributable (rather than VS2017 version).  Make everything match or you will have errors when you try to start Apache after you

Unzip the Apache2.4.25 VC14 and then copy the extracted contents to a new folder c:/Apache24 (that is the ServerRoot in the config).
Default folder for your your web pages is DocumentRoot “c:/Apache24/htdocs”

Note: If  you unzip to a location other than C:\Apache24, you will need to change ServerRoot in the httpd.conf, and also change in httpd.conf the Documenroot, Directories, ScriptAlias, also when you use the extra folder config file(s) change to your location there.

We may need to set up a fully qualified domain name at this point.

Starting Apache in a DOS box as Administrator.  In other words, ppen a command prompt “As Administrator.”

Change the directory as follow:
cd\apache24\bin

C:\apache24\bin> httpd.exe

At this point, It may appear to you that the system is hanging, but it is NOT hanging.  In fact, it means there are no errors, at least those that are reported at the moment, and that Apache is probably started and running.  Test Apache by opening a web browser and typing localhost in the address bar. Hit enter.  “IT WORKS!”

To “Break” from the “Hang” in the DOS command prompt:
C:\apache24\bin> Ctrl+C

After you install PHP7, then come back here and
Install Apache as a service:

C:\apache24\bin> httpd.exe -k install

Installation Instructions for Installing PHP7.1.5:

Using Windows Explorer (file explorer), create a new folder named php at the Windows C: drive root:

c:\php

Now, extract all the folders and files from php-7.1.5-Win32-VC14-x64.zip.

Then copy those extracted folders and file contents to the new folder:
C:\php

Now, go get and install Notepad++ if you have not already installed it.  This text editor (or one like it) is a must to open and edit various text configuration files for php and apache, etc.

Here is the download page for Notepad++:  https://notepad-plus-plus.org/download/v7.4.1.html  Get the 64-bit or 32-bit version of Notepad++ that your system requires:

But, here is the installer file for the 64-bit version of Notepad++

Within the php root c:\php, open the php.ini.production file and save it as a file named php.ini in the root folder c:\php

Using Windows Explorer (file explorer) find the file called php.ini.production.  Open it using Notepad++ editor.  Now, on the Notpad++ menu, click File, select SAVE AS and change the name of the file to php.ini before saving it. 

APPEND the following items to the existing items within the “PATH” System Environment Variable. Note a Semicolon ; must separate each path item.  If you don’t know how to do this, you must learn.

;c:\php;c:\apache24;c:\apache24\bin

Go to a Dos command prompt and type in:

path (press enter)

You will see a display of what is in the current path. At this point, the above-appended path items are not yet included in the current path.

Log Off Windows, then Ctrl-Alt-Del and log into Windows again.

Now, open a command prompt and type:

path (press enter)

You will see the existing path containing the above-appended path items. 

Integrate / Connect Apache2 to your PHP7:

Using Windows Explorer, go to c:\apache24\conf

Open with Notepad++ the file called httpd.conf
Scroll down within the httpd.conf file and just below all the “LoadModule” lines, insert the following new lines:

LoadModule php7_module C:/PHP/php7apache2_4.dll

<IfModule php7_module>
DirectoryIndex index.html index.php
AddHandler application/x-httpd-php .php
PHPIniDir “C:/PHP”
</IfModule>

Save the changes to httpd.conf file and then close Notepad++

Log off Windows, and log into Windows again.

Test Apache now having php referenced from the httpd.conf of Apache.  How, just like we did above.

Start Apache in a DOS box as Administrator.  In other words, open a command prompt “As Administrator.”

Change the directory as follow:
cd\apache24\bin

and type httpd.exe at the prompt (and press enter).

C:\apache24\bin> httpd.exe

If it “hangs” without errors, you are good!  Open a browser and input localhost in the address bar.  IT WORK! 

In the command prompt window, enter Ctrl+C in order to break to the C:\> prompt.

In Windows, click Start, point at Administrative Tools, and select Services.  Then, in the Services list, find the Apache service near the beginning of the list, right-click the Apache service and left click /or select Properties. Find the correct TAB to STOP the Apache service.

Remember that I said above, after you install PHP7, then come back here and

Install Apache as a service:

C:\apache24\bin> httpd.exe -k install

Test localhost in your Web Browser.  IT WORKS!

Displaying PHP INFO:

Open Notepad++ text editor and create a new file (on the menu, click file, new).  Now, save the new with a filename of phpinfo.php

While you still have the new “phpinfo.php” file displayed within Notepad++, now insert the following contents on line 1 of the new file.

<?php phpinfo() ; ?>

Save the file named phpinfo.php with only this one line of content.  Copy or save this file to the root folder of the Apache http docs. In other words, save or copy the new phpinfo.php file into the following target sub-folder.

c:\apache24\htdocs\

Open a web browser, type into the address bar:

localhost/phpinfo.php

Voila!!!

Open TCP Port 80 In Windows Firewall

https://wiki.mcneel.com/zoo/window7firewall

Open TCP Port 443 in Windows Firewall the same way.

Configure httdd.conf using Notepad++

Find httpd.conf in C:\apache24\conf\
#ServerName www.example.com
#Insert next line & change svr (host header domain com or net)
ServerName svr.yourdomain.tld

Restart Apache service in the Services Module
Start, Administrative Tools, Services.

Set Up a DNS Entry — “A” (Address) record, pointing to your server’s fully qualified domain name and the IP address

You should now be able to connect from a remote 

 = = = = = = To be continued = = = =

ApacheMonitor:

Double click ApacheMonitor.exe, or put it in your Startup folder.

How to Identify and Stop and Remove a Docker Container

This pertains to Ubuntu Server 16.04 running Apache2.x, PHP7.x, and MySQL.  NextCloud 12 is installed and running on a domain with an SSL certificate issued by a public CA (on www.mydomain.tld and mydomain.tld).  I tried to integrate Collabora (Docker) obtaining its own SSL on a subdomain (office.mydomain.tld)

It became necessary to remove and reinstall the Collabora docker container / image. My two SSL certificates were conflicting after Collabora was installed and enabled in NextCloud 12. There was a failed configuration when I following the guided instructions for integrating Collabora online with NextCloud.  Incidentally, the installation mistake occurred  during the “run” phase. I mistakenly (and understandably) entered the sub-domain “office.mydomain.tld” (i.e. the subdomain where my collabora SSL certificate will address) rather than entering the already configured nextcloud domain www.mydomain.tld.  See the correct run command at the end of this Article.

Open terminal or putty ssh connection:

To See All docker containers:
sudo docker ps -a

To Stop a running docker container:
sudo docker stop <container id>
Example:
sudo docker stop 94fc7ad48626

Check the status again:
sudo docker ps -a

To Remove a stopped docker container:
sudo docker rm <container id>
Example:
sudo docker rm 94fc7ad48626

If there is an error at the removal step, it may be necessary to either restart apache or reboot the system.  Restarting Apache did not work for me.  I rebooted the system.

After reboot, check the status again and the container ID should be gone/empty. CONGRATULATIONS.  

When you reinstall Collabora:

Example to run the docker container referencing correct sub-domain of the previously installed nextcloud:
sudo docker run -t -d -p 127.0.0.1:9980:9980 -e ‘domain=nextcloud\\.your-domain\\.com’ –restart always –cap-add MKNOD collabora/code

I am not sure whether I should again first pull the docker Collabora/code before the docker run.  I will let you know.

 

Footnotes:  URL References / Credits:

https://docs.docker.com/engine/reference/commandline/stop/

https://help.nextcloud.com/t/collabora-docker-remove/4851

Remove ‘Powered By’ in Footer of Septera Theme by CryoutCreations

If you make this edit, please understand that you should either pay Cryout Creations $25 for support (and CC’s removal of their part of this “Powered By WordPress” footer segment), or please insert authoring credit for Cryout Creations elsewhere on your website for their development of this Septera theme.

First, on you website, locate the core.php file in the path wp-content/themes/septera/includes/

Next, create a backup of the original core.php file by copying this file to a location outside your website.  Then, come back and make your changes to the core.php file that is live online from your website. Understand that If you do not self-host your website on you own server, thus having direct access to the server file system and this core.php file, then you will likely need to access it via ftp to make a backup, perform the edit, and overwrite the original online file with your edited file.

You can edit the core.php file using a good text editor, such as the Notepad++ editor.  In core.php first locate the Footer Hook section from lines 235 to 248.  Insert //Rem at the beginning of those certain 4 lines (to disable them) as shown below:

/**
* Footer Hook
*/
add_action( ‘cryout_master_footer_hook’, ‘septera_master_footer’ );
function septera_master_footer() {
$septera_theme = wp_get_theme();
do_action( ‘cryout_footer_hook’ );
echo ‘<div id=”footer-separator”></div>’;
echo ‘<div id=”site-copyright”>’ . wp_kses_post( cryout_get_option( ‘septera_copyright’ ) ) . ‘</div>’;
//REM echo ‘<div style=”display:block;float:right;clear: right;font-size: .85em;font-weight: bold; text-transform: uppercase;”>’ . __( “Powered by”, “septera” ) .
//REM ‘<a target=”_blank” href=”‘ . esc_html( $septera_theme->get( ‘ThemeURI’ ) ) . ‘” title=”‘;
//REM echo ‘Septera WordPress Theme by ‘ . ‘Cryout Creations”> ‘ . ‘Septera’ .'</a> &amp; <a target=”_blank” href=”‘ . “http://wordpress.org/”;
//REM echo ‘” title=”‘ . __( “Semantic Personal Publishing Platform”, “septera”) . ‘”> ‘ . sprintf( ” %s.”, “WordPress” ) . ‘</a></div>’;
}

Click to expand the following screen capture image to see what this section looks like from within the Notepad++ editor.

footer hook in core.php

I tried using a child theme to make this change, but I was having some problems making it work.  This may have something to do with the priority of functions loading (i.e. the order in which functions are loading) between the child and parent themes. I changed some priorities in the add_actions and do_action of the child theme, but to no avail.  Let me know if you figure it out.  Send comments.  sheldon @ sheldonsblog.com.

Alternative way to make the same change.   You could also edit the core.php theme file from within the WordPress administrative dashboard.  On the dashboard menu, point at “Appearance” and select “Editor.”  Scroll down the file list on the right side of the editor page and select “core.php.”  //REM out the same 4 lines in the footer hook section as shown in the following screen image.  And click the update save button to save your changes.

Fix Error: Google Chrome Profile Could Not Be Opened Correctly

Here is the fix: In Windows 10, open Windows File Manager (Windows Explorer). Make sure that you configure folder options to display hidden files and folders.

Follow this path:

  • This PC
  • Local Disk (C:)
  • /Users
  • /(Your Username)
  • /AppData
  • /Local
  • /Google
  • /Chrome
  • /User Data
  • /Default

Scroll Down within the /Default folder and Find and Delete the file called “Web Data.”

You may be restricted from deleting the “Web Date” file because it is in use by Google Chrome processes.  In this case, you will first need to stop all the Chrome processes and add-ons sub-processes.  Close each Chrome browser window.  Click simultaneously the keys, CTRL + ALT + Delete. Then, select task manager.   Select the Processes tab.  On the left menu under “Apps,” if any Chrome browser windows are still open, you will need to expand the Google Chrome (32 bit) app/s, right click each Chrome Page or Tab that you find in the list, and left click “end task.”  This should close all open Chrome pages and tabs.  Under “Background Processes” in the left menu list, just right-click each Google Chrome (32 bit) sub-process, and Left click to select “End Task” for each.  Now, you can proceed to delete the “Web Data” file.

DAA Opt-Out of Targeted Advertising Interest-based Advertising

Digital Advertising Alliance Consumer Choice Page

Go here using the particular browser that you wish to set your opt-out cookies:

http://www.aboutads.info/choices/

Microsoft Opt-Out regarding browser and apps:

http://choice.microsoft.com/en-us/opt-out

 

Toggle Preferences on/off for Microsoft and Internet Explorer:

  • Personalized ads in this browser.
  • Personalized ads when you use your Microsoft Account.

 

Exchange 2010 Management Console Failed

The Oxford SBS Guy explains that he encountered a problem and received an error message while attempting to open Microsoft Exchange 2010 Management Console.  He determined that one way to correct this problem is to open a command prompt and perform an iisreset.

Here is then entire error message that Oxford SBS Guy received while trying to open the Exchange 2010 Management Console:

“The attempt to connect to http://server/Powershell user ‘Kerberos’ authentication failed: Connecting to remote server failed with the following error message: The WS-Management service cannot process the request. The system load quota of 1000 requests per 2 seconds has been exceeded. Send future requests at a slower rate or raise the quota for this user. The next request from this user will not be approved for at least xx milliseconds.”

Here is the link to the full article written by Oxford SBS Guy.

Generate an SSL Certificate Signing Request (CSR) on IIS7

What is a CSR?  A Certificate Signing Request or CSR is a specially formatted encrypted message sent from a Secure Sockets Layer (SSL) digital certificate applicant to a certificate authority (CA). The CSR validates the information the CA requires to issue a certificate. A CSR must be created before ordering and purchasing an SSL certificate (or activating an SSL certificate already purchased through your domain registrar). How a CSR is generated depends on the web server software used. Once the CSR is generated, it can be submitted to the CA. If the request is successfully validated, the CA will issue the SSL certificate.

Here are the steps to generate a CSR in IIS7 on Windows Server 2008 R2.  Why might this be necessary?  Well, you may want to install Microsoft Exchange and connect to it via Outlook or Outlook Web Access (OWA) which would require Secure Socket Layer (SSL).

  • Click Start
  • Select Administrative Tools
  • Start Internet Information Services (IIS) Manager
  • Click the Server Name
  • Double click on the “Server Certificates” button in the “IIS” section, located int he center menu

Image from Namecheap.com

 

  • Choose the “Actions” menu (on the right)
  • Click on “Create Certificate Request (Note: Even if you are renewing an SSL certificate that may be about to expire, use the CREATE Certificate Request and do NOT select renew).

From Namecheap.com

 

  • The Request Certificate wizard will be opened. From here, you will need to enter the information required for the CSR code (details and example listed below):

Image from Namecheap.com

 

Common Name: e.g. yourdomain.com or, if you are creating a CSR for your mail server’s subdomain, then enter something like this containing your server’s host header:  mx.yourdomain.com or mail.yourdomain.com

Organization: MyCompany Ltd

Organization Unit (eg, section): Communications, IT, Support, Sales etc.

City/ Locality Name: Los Angeles

State or Province Name (full name): California

Country Name (2 letter code): US

Image from NameCheap.com

  • Specify a filename and location to save your CSR code (e.g. c:\certificate\certreq.txt)
  • Click Finish

Image from NameCheap.com

You may view the CSR file using a text editor such as Notepad++ and the certificate request should appear like this:

Image Omitted for security reasons.

Note:  When Installing the newly issued (renewal) certificate issued to you by your CA, you must first REMOVE the existing certificate from IIS7 because there will be an installation conflict (between the new certificate and the existing certificate that is still installed on the server. In other words, an error will occur during installation of the new certificate if the existing certificate is not first removed.

This article is based substantially upon Namecheap.com support knowledge base article:

https://www.namecheap.com/support/knowledgebase/article.aspx/9426/0/iis-7

After your new or renewal SSL certificate is issued to you and arrives via email, you may follow these instructions to install it on IIS7, but watch out for the known bug in IIS7.

https://support.comodo.com/index.php?/Knowledgebase/Article/View/639/0/certificate-installation-microsoft-iis-7x—8x

When you click “Complete Certificate Request” in IIS7 management console, and then browse to find your newly issued *.cer file, when you click Open, you may receive an error message about a “Conflict” explaining that the CSR may not have been issued by the server where you are installing the *.cer file, which is nonsense.

Just continue hitting Retry or OK button a couple times, then hit the cancel button.  Refresh the screen in IIS7 Management Console and see if your new certificate is listed there without a Friendly Name associated with it.  That is GOOD.  Do not remove the installed certificate.  Now go to do the Bindings on the IIS7 Default Web Site.  See the Second Link (last article) listed two paragraphs above.

Once the bindings are established to https on port 443, then you must restart the default website from within the management console.

Go test that your website can be viewed via https://

The last few lines of the tutorial say:

Click ‘OK’ on the ‘Web Site Bindings’ Window to complete the install.

Important: You must now restart IIS / the website to complete the install of the certificate.

 If none of this works, you may have to generate a new CSR and get the certificate re-issued from your CA.

 

Installing an SSL Certificate to Apache on Windows

This is for a Symantec certificate but should work the same with other certificates like Positive SSL issued by Comodo. Pay attention to the paths for certificate and CA chain files.

In Zpanel, instead of looking here c:/Program Files/apache/etc for help, maybe explore these paths:

c:/zpanel/configs/apache/httpd-vhosts.conf

c:/zpanel/bin/apache/OPENSSL-README.txt

c:/zpanel/fin/conf/openssl.cnf

A good question at this point is how to first prepare an SSL Certificate Request to be sent to the certificate authority (CA) so that a certificate can be issued to you by the CA.