I just installed on my development box the WAMP EasyPHP 12.0 which includesPHP 5.4.4 VC9 | PHP 5.3.14 VC9 | PHP 5.2.17 Apache 2.4.2 VC9 + MySQL 5.5.25a + PhpMyAdmin 3.5.1 + Xdebug 2.2.0.

The problem: Old PHP pages are parsed by Apache and load correctly. However, any new pages created in the same directory as the old PHP pages are not parsed and only raw code is displayed. This is true even for a simple page like <?php echo 'Hello, World';?>

I could understand that if no .php files were parsed I would look for a problem with in the directory settings in the /httpd.conf. But I'm mystified why new pages are being ignored.

Any ideas? Thanks very much,
Rob

Dani AI

Generated

Quick expert note: this turned out to be an encoding issue (credit to for tracking it down). When old PHP files run but newly created ones show raw source, the file’s byte encoding is a common, easy-to-miss cause — especially if an editor saved the new files as UTF-16 or added a BOM.

Why this happens: PHP expects source files in an ASCII‑compatible, single‑byte encoding (UTF‑8 without a BOM is the safe default). UTF‑16 stores ASCII characters as two bytes (often inserting zero bytes between characters) and/or starts with a UTF‑16 BOM; that changes the byte sequence so the PHP opener (<?php) isn’t recognized and the file is served as plain text. The general explanation and pitfalls around encodings are covered in the encoding primer and the Unicode spec. (kunststube.net)

Quick diagnostic + fixes:

  1. Check your editor’s encoding setting (Notepad++, VS Code, Sublime etc.) and make sure new PHP files default to UTF‑8 (no BOM).

  2. Inspect the first bytes with a hex tool to spot signatures:

    xxd -l 4 file.php
    hexdump -C file.php | head -n 1

    Look for EF BB BF (UTF‑8 BOM), FF FE or FE FF (UTF‑16 BOM).

  3. Lint the file to see parse errors:

    php -l file.php
  4. Convert if needed — editor “Save as UTF‑8 (without BOM)” or command line:

    iconv -f UTF-16 -t UTF-8 infile.php > outfile.php

Editor-specific tips and how-to’s for saving as UTF‑8 without BOM are documented for common editors. (stackoverflow.com)

Prevention: set your IDE/editor default to UTF‑8 (no BOM), avoid UTF‑16 for source, and add a quick preflight (hex check or php -l) when a new file behaves oddly. Note that a UTF‑8 BOM can still cause “headers already sent” problems, so prefer UTF‑8 without BOM for PHP source. (stackoverflow.com)

Thanks to for posting the cause and to for the follow-up.

I finally figured it out after hours of checking permissions, apache & php config files. I'm embarrassed to say it was something very simple. I somehow set my text editor to save as UTF-16 instead of UTF-8. Resaving the unparsed files as UTF-8 fixed the problem.

Glad you solved your problem. And thank you for taking the time to post the solution.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.