/go/removebom: removebom from the Command Line

A byte order mark (BOM) is a three-byte marker (EF BB BF) that some text editors put at the very start of a UTF-8 file. In a PHP file it is sent to the browser before any code runs. It is invisible, but it often causes: /go/removebom strips the BOM from the first line of every .php file in the place you choose, including all subfolders. It can run on: Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Fix one site (its /home/<domain>/www folder)
/go/removebom example.com

# Fix every site
/go/removebom all

Options

Argument Required Default Notes
<domain> One of the three — The full domain of a hosted site, for example example.com.
<path> One of the three — A folder or a single file. Paths with spaces don’t work.
all One of the three — Everything under /home. This can take a long time.

Examples

# One site
/go/removebom example.com

# One theme folder
/go/removebom /home/example.com/www/wp-content/themes/mytheme

# One file
/go/removebom /home/example.com/www/index.php

# Check whether a file starts with a BOM (shows "efbb bf" at the start if it does)
head -c 3 /home/example.com/www/index.php | xxd

Output

Outcome What you get
Files processed Nothing. The command is silent on success.
The target can’t be found <argument> does not exist and exit status 1.

Notes on the output:

  • There is no list of changed files and no count. To see what was affected, run findbom before and after.
  • With no argument, the message is does not exist (empty name), and there is no usage text.
  • A single file that doesn’t end in .php is skipped without any message.
  • Every run is logged with a timestamp and its arguments to /var/log/go/removebom.log.

See the full reference at /go/removebom and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *