Red Wine in a GlassHow to Install CSS HTML Validator on Linux using WineCSS HTML Validator Logo
HOME Tutorials & Essays About
Tutorials & Essays About

February 19, 2024

CSS HTML Validator
CSS & HTML Validation Software for Linux

As of Wine version 9.0, CSS HTML Validator is fully functional on Linux when installed using Wine. Currently, all features of CSS HTML Validator work: both the HTML editor/validator and the validation Batch Processor.
In CSS HTML Validator version 24.00 and earlier, File > Save As appends .css to non-CSS files. This will be fixed in version 24.01. File > Save already works as expected.

NEW!
The core validation engine of CSS HTML Validator has been ported to Linux!

The port, htmlval, runs under Linux as a Terminal application. Use your Linux editor of choice to edit web files, and obtain extensive validation and debugging information by invoking htmlval. No need to install Wine or a Windows Virtual Machine. Simply download and install the htmlval executable. It just works. Check out   Native Linux port of CSS HTML ValidatorNew Window Icon and note the FREE limited version available by direct download.

CSS HTML Validator Under Linux Using Wine

The advantage of running the full CSS HTML Validator is its built-in editor, which is very good.

CSS HTML Validator

CSS HTML ValidatorNew Window Icon is a full-featured CSS and HTML editor with integrated syntax checking. Though it is a Windows app, as of Wine 9.0 it installs and runs flawlessly on Linux under Wine. See the comprehensive review in the Wine Application DatabaseNew Window Icon.

When installing CSS HTML Validator using Wine, be sure to use Wine 9.0 or later. Earlier versions of Wine were not sufficiently developed to fully support CSS HTML Validator. In CSS HTML Validator versions prior to 24.01, File > Save As misbehaves as described above.

Options for the installation

If you want to create a new Wine Prefix to host CSS HTML Validator, follow the directions as given, but there are other options.

Option 1 If you do not already have an initialized Wine Prefix (i.e., if you have never executed winecfg), you can skip the first two commands in the next section (mkdir and export) and start by executing the third command, wine winecfg. That will create and initialize the default Wine Prefix ~/.wine, and CSS HTML Validator will end up being installed there. If you do this, you will not need to worry about exporting Wine Prefixes.

Option 2 However, if you want to install CSS HTML Validator into an existing Wine Prefix, skip the first command (mkdir). Start by exporting the name of your intended Wine Prefix, as in the second command (export), but use the name of your Wine prefix in place of .wine-validator. Then, skip the winecfg command and continue with the cd ~/Downloads command (or whatever cd command will take you to where your CSS HTML Validator installer is located).

This document also assumes the wine prefix is .wine-validator. If your Wine prefix has a different name, substitute the name of your prefix for .wine-validator everywhere.

Enable Show Hidden Files

Before proceeding, you may want to enable the Show Hidden Files option in your file browser (Nautilus or other). If you follow the recommendation of creating a Wine prefix with a name that starts with a period, like ~/.wine-validator, or if you accept the default Wine prefix, which is ~/.wine, that folder will be hidden and therefore invisible unless Show Hidden Files is enabled. This will be important if you enable PHP syntax checking or sound for CSS HTML Validator.

Open a Terminal window

The next two commands do initial setup in advance of creating a Wine prefix. The name given here to the prefix is "wine-validator", but this can be replaced by any other name. For example, instead of ~/.wine-validator, you might prefer ~/.css-html.

$ mkdir -v ~/.wine-validator

$ export WINEPREFIX=~/.wine-validator

It is the next command, wine winecfg, that actually creates the Wine prefix by loading folder ~/.wine-validator with the magic that allows it to host running Windows apps. Be aware that winecfg generates lots of error messages, which you should simply ignore.

While winecfg is running, it may offer to install one or both of mono and geko. In that case, allow winecfg to do the downloads and installations. In fact, geko may ask to be downloaded and installed a second time. When this happens, it is probably because both Gecko 32-bit and Gecko 64-bit are needed, so allowing both to proceed is recommended.

When a dialog window opens and asks you to choose a Windows Version, the choice of Windows 10 is known to work with CSS HTML Validator. Other options in this dialog can be the defaults.

Eventually, winecfg will finish (messages from winecfg cease), but there may be no $ Terminal prompt. In that case, press the Enter key to display a Terminal prompt.

OK – go ahead and tell Wine to execute winecfg.

$ wine winecfg

The following cd command assumes that your CSS HTML Validator installation .exe file is in your ~/Downloads folder. If you have placed it somewhere else, such as on your Desktop, change the cd command to reference the actual location.

$ cd ~/Downloads

The name of the installation file in the following is taken to be installer.exe, but, in the command which installs CSS HTML Validator, you must replace this with the actual name of your installation file, which will be something like

css-html-validator-trial-setup.exe

or

css-html-validator-190122pro-x64-setup.exe.

Next is the command that does the actual installation of CSS HTML Validator. In this command, replace installer.exe as described above, and do not specify a path to the installer .exe file. cd must have been used to make the folder holding the installer .exe file the default. This is important.

When asked if a Desktop icon should be created, accept and choose either the current user option of the all users option. This icon will be needed.

It is possible that, at the end of the installation, Terminal does not display a $ prompt. In that case, press the Enter key.

$ wine installer.exe

Successful installation leaves a Launcher for CSS HTML Validator on your desktop or in your Applications or in both.

For some versions of Linux, no Launcher is left on the desktop, but you will find one – maybe two – launchers in Applications. If there are two launchers in Applications, one will open CSS HTML Validator, and the other will open the Batch Wizard in addition to CSS HTML Validator. If, when CSS HTML Validator opens, you see a Batch Wizard window, it can be closed, after which you are left with just CSS HTML Validator.

In case there is no CSS HTML Validator icon to be found anywhere, shut down and restart your computer. This happened once, with openSUSE Tumbleweed, and a re-boot was the fix.

You may now close the Terminal window.

$ exit

Before using the desktop launcher …

If there is a Launcher for CSS HTML Validator on your desktop, right-click it. If the window that opens includes an Allow Launching option, click it. If not, close the window and double-click the Launcher and, if prompted, click the Trust and Launch option. In the future, you will just double-click the Launcher to open CSS HTML Validator.

Register CSS HTML Validator (not needed for the trial version)

Open the email or file that contains your registration information and copy the contents to the clipboard.

It may be better not to close the source file after you copied the registration information. For some versions of Linux, CSS HTML Validator cannot access the copied information after the source file is closed.

If CSS HTML Validator is not running, open it by double-clicking its icon on the desktop or in Applications.

Then, navigate to Help > Register Program.

If the registration information in the clipboard is valid, CSS HTML Validator pre-fills the license information and you just need to select OK.

Enable Sound for Audible Notifications (optional)

Recall that you may need to enable the "Show Hidden Files" option in your file browser. If your Wine prefix folder name begins with a dot (as in ~/.wine-validator), it is a hidden folder, and you will not be able to use Files to navigate to it unless its "Show Hidden Files" option is enabled.

Before proceeding, you may need to configure and test your computer's sound, which can be done by opening "Sound" in your computer's "Settings".

MS Windows keeps its sound files in

C:\windows\Media\

so you can enable sound for CSS HTML Validator by creating a Media folder inside ~/.wine-validator/drive_c/windows to hold your own sound files. Here is the full path.

~/.wine-validator/drive_c/windows/Media/

CSS HTML Validator uses two sounds, one when a validation finds errors or warnings, and another when a validation finds no errors or warnings. The default names for these .wav files are

Errors or warnings: Windows Critical Stop.wav
No errors or warnings: tada.wav

If files of those names are installed in ~/.wine-validator/drive_c/windows/Media/, close CSS HTML Validator (if it is open) and restart it. Beyond that, no other action may be required. However, if the sound files you install do not have the default names or are installed in a different folder, or if sound simply is not working, do the following.

Open CSS HTML Validator and press Ctrl+F4 to open the full Validator Engine options dialog. In case Ctrl+F4 does not work, the path through the menu is

Options > Validator Engine Options > Validator Engine Options [sic]

Scroll down the left column and click Sound.

In the panel on the right, both check boxes should be checked. You can enter the paths to your sound files, or you can navigate to the folder where you stored them by clicking the small folder icon to the right of a Play button. If your sound files are in the MS Windows default sound folder, the navigation path from within CSS HTML Validator is

My Computer > C: > windows > media

and the sound panel looks like this:

Image showing the CSS HTML Validator sound panel

You can verify that each sound works by clicking its Play button.

If sound still is not working, re-check your system's Settings > Sound where you can select the output to which sound should be directed and where you can test your system's sound to ensure it is working.

Enable PHP Syntax Checking (optional)

Recall that you may need to enable the "Show Hidden Files" option in your file browser. If your Wine prefix folder name begins with a dot (as in ~/.wine-validator), it is a hidden folder, and you will not be able to use Files to navigate to it unless the "Show Hidden Files" option is enabled.

Enabling PHP syntax checking in CSS HTML Validator requires several steps. (1) Choose a version of PHP. At the time this is being written, you can choose PHP 8.1 or PHP 7.4. (2) Download the appropriate version of Microsoft Visual C++ Redistributable for Visual Studio, either VC16 (2019) for PHP 8.1 or VC15 (2017) for PHP 7.4, and install it to your CSS HTML Validator Wine prefix. (3) Download and install into your Wine prefix PHP 8.1 or 7.4 for Microsoft Windows. (4) Create and configure a php.ini file for running php.exe, the command line PHP executable. (5) Test php.exe to verify correct installation and execution. (6) Configure CSS HTML Validator to enable PHP syntax checking.

<Step 1> Choose a version of PHP

Your choice determines which version of the Microsoft Visual C++ Redistributable you must install.

You can choose a PHP version other than 8.1 or 7.4. If you do, the file name of the PHP download ZIP file will specify which version of Visual C++ Redistributable is required. As an example, the ZIP file for PHP 7.4, which requires VC15, is

php-7.4.28-nts-Win32-vc15-x64.zip

<Step 2> Install Microsoft Visual C++ Redistributable for Visual Studio

You will need to download and install two files.

VC_redist.x64.exe and VC_redist.x86.exe

The steps a. b. c. in this section should be the best way to find the MS Redistributable files, but they may not work. In that case, do an Internet search for the version of Visual C++ Redistributable that you need, and then continue with Step d.

A query like
   Microsoft Visual C++ Redistributable 2019
will find websites offering installers for VC16. Similarly for other versions.

a. Browse to

https://visualstudio.microsoft.com/downloads/New Window Icon

b. Scroll down and, below All Downloads, expand the Other Tools, Frameworks, and Redistributables item.

c. Look for Microsoft Visual C++ Redistributable for Visual Studio, and download both the x64 and the x86 versions.

d. Assuming the download was to ~/Downloads, open a terminal window and execute the following (after replacing ~/.wine-validator with your own Wine prefix).

$ cd ~/Downloads
$ export WINEPREFIX=~/.wine-validator
$ wine VC_redist.x64.exe
$ wine VC_redist.x86.exe

The Microsoft Visual C++ Redistributables, both x64 and x86, are now installed in your Wine prefix.

<Step 3> Install PHP for Windows

a. Browse to

https://windows.php.net/download/New Window Icon

and download a Zip file for a recent MS Windows compatible x64 Non Thread Safe version of PHP 8.1 or PHP 7.4 (or other PHP version of your choice).

b. Verify the download's SHA256 hash (optional, but good to do).

c. Unzip the download into the Program Files folder inside the drive_c folder of your Wine prefix.

After the unzip, the new folder will have a name something like php-7.4.13-nts-Win32-vc15-x64.

d. Rename the new folder to PHP (all upper case).

<Step 4> Create and configure php.ini

a. To create the php.ini file, cd into the PHP folder and copy php.ini-production to php.ini. Assuming the WINEPREFIX variable is initialized, the following will do the cd and copy.

$ cd "$WINEPREFIX/drive_c/Program Files/PHP/"
$ cp -v php.ini-production php.ini

b. While still in the PHP folder, use your favorite command line text editor to open php.ini for editing. If nano is the editor,

$ nano php.ini

c. Scroll down or search to locate the On Windows definition of extension_dir. Edit the definition line so that it does not begin with a semi-colon and contains extension_dir = ext

d. Scroll down or search to locate log_errors = and edit the setting so that it does not begin with a semi-colon and contains log_errors = On

e. Scroll down or search to locate the setting for error_log. Edit the setting so that it does not begin with a semi-colon and contains error_log = syslog

f. Save your edits to php.ini and exit from the text editor. If using nano, this is done with Ctrl-O followed by Ctrl-X.

g. Verify that folder PHP contains subfolders ext and syslog. Probably ext exists but syslog does not. Use the following terminal commands as needed to ensure both are present.

$ mkdir -v etc
$ mkdir -v syslog

<Step 5> Test php.exe

All of the following terminal commands are to be executed from within the PHP folder.

a. Get the installed PHP version. The following shows the Terminal command followed by its output.

$ wine php.exe --version

PHP 7.4.13 (cli) (built: Nov 24 2020 12:43:30) ( NTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

b. Here is what happens when the Microsoft Visual C++ Redistributable version does match the PHP version.

$ wine php.exe --version

PHP Warning: 'C:\windows\system32\VCRUNTIME140.dll' 2.34 is not compatible with this PHP build linked with 14.28 in Unknown on line 0

c. Check an error-free PHP file for syntax errors. This uses the same command that CSS HTML Validator uses for PHP syntax checking.

$ wine php.exe -l -d display_errors=on /home/temp/TestFile-GOOD.php

No syntax errors detected in /home/temp/TestFile-GOOD.php

d. In the next test, the PHP file contains one syntax error.

$ wine php.exe -l -d display_errors=on /home/temp/TestFile-BAD.php

Parse error: syntax error, unexpected 'replace' (T_STRING) in /home/temp/TestFile-BAD.php on line 25
Errors parsing /home/temp/TestFile-BAD.php

e. You may close the Terminal window.

<Step 6> Configure CSS HTML Validator to do PHP syntax checking

a. Open CSS HTML Validator and press Ctrl+F4 to open the full Validator Engine options dialog. In case Ctrl+F4 does not work, the path through the menu is

Options > Validator Engine Options > Validator Engine Options [sic]

b. Scroll down the left column and click PHP Checker.

c. The Path to php.exe input field should contain C:\Program Files\PHP\php.exe. If it does not, enter it.

d. Put a check mark in the Enable PHP syntax messages box.

e. Click OK.

f. Set the Default Valuation Mode to Full. This is done by navigating the menu tree thusly.

Options > Validator Engine Options > Set Default Validation Mode > Full

g. Now, you can test PHP syntax checking by loading a web page that has some PHP code and deliberately inserting a syntax error. Click the Validate button in the toolbar (not the Validate menu option in the menu bar) to see what happens.

Image showing the location of the Validate command button

Facebook Logo   Twitter Logo   Reddit Logo   Quora Logo

Consider sharing your experience

Did you find this page helpful? Have constructive feedback? Wisdom to share?

Send email to Email Address

Privacy PolicyNew Window Icon

Graphic image of Athena pouring wine for Heracles, from 470 BC