Php files displayed as text in chrome
Posted by: tegg (---.om.om.cox.net)
Date: December 29, 2020 10:20PM

I am having an issue with php files not running in chrome, internet explorer, etc.
I have installed WAMP64 and have green icon in the tray.
I am running windows 10 64 bit version 20h2.
I have gone through the troubleshooting guide to no avail.
when I attempt to run them even something as basic as a "hello world" file the content of the file is displayed in the browser rather than running the php file. All I want to do is to test some php files locally on my windows computer.



My WAMP configuration report as follows.

1609275966
------ Wampserver configuration report
Tue, 29 Dec 2020 21:06:06 +0000
- Windows NT 10.0 build 18363 (Windows 10)
- Windows Charset: Windows-1252
- Wampserver version 3.2.3 - 64bit
- Wampserver install version 3.2.3
- Install directory: c:/wamp64
- Default browser: C:/Program Files (x86)/Google/Chrome/Application/chrome.exe
- Default text editor: C:/Users/t_egg/AppData/Roaming/CoffeeCup Software/Coffee.exe
- Default log viewer: C:/Users/t_egg/AppData/Roaming/CoffeeCup Software/Coffee.exe
- Apache 2.4.46 - Port 80
- Additional Apache listening ports:
- PHP 7.3.21
- MySQL 5.7.31 Port 3306
MySQL basedir = c:/wamp64/bin/mysql/mysql5.7.31
MySQL datadir = c:/wamp64/bin/mysql/mysql5.7.31/data
- MariaDB 10.4.13 Port 3307
MariaDB basedir = c:/wamp64/bin/mariadb/mariadb10.4.13
MariaDB datadir = c:/wamp64/bin/mariadb/mariadb10.4.13/data
- PHP 5.6.40 for CLI (Internal Wampserver PHP scripts)
- PhpMyAdmin 5.0.2 - Adminer 4.7.7
------ Wampserver configuration ------
AliasSubmenu = on - NotCheckVirtualHost = off
NotCheckDuplicate = off - VirtualHostSubMenu = on
HomepageAtStartup = off - VhostAllLocalIp = off
SupportMySQL = on - SupportMariaDB = on
ShowphmyadMenu = on - ShowadminerMenu = on
NotVerifyPATH = off - HostsLinesLimit = 5000
NotVerifyHosts = off - NotVerifyTLD = off
AutoCleanLogs = on - AutoCleanLogsMax = 1000
AutoCleanLogsMin = 50 - AutoCleanTmp = on
AutoCleanTmpMax = 1000 - CreateSymlink = symlink
BackupHosts = off - TraceProcess = off
------ C:/WINDOWS/system32/drivers/etc/hosts file contents ------
------ Limited to the first 30 lines ------
#
127.0.0.1 localhost
::1 localhost
127.0.0.1 eggertsen
::1 eggertsen
----------------------------------------------
-- c:/wamp64/bin/apache/apache2.4.46/conf/extra/httpd-vhosts.conf file contents --
------ Limited to the first 40 lines ------
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
#
<VirtualHost *:80>
ServerName eggertsen
DocumentRoot "c:/eggertsen"
<Directory "c:/eggertsen/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
----------------------------------------------
--------- wampmanager.ini (Last 4 lines) --------
[Options]
AeTrayMode=64 Bits
AeTrayOldMode=64bit
AeTrayVersion=3.2.3.3
--------------------------------------------------
State of services:
The service 'wampapache64' is started
Service Session : LocalSystem
The service 'wampmysqld64' is started
Service Session : LocalSystem
The service 'wampmariadb64' is started
Service Session : LocalSystem
all services are started - it is OK
all services BINARY_PATH_NAME are OK
--------------------------------------------------
*** Checking the DNS search order ***
Values of registry keys for
HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\ServiceProvider
are in correct order
--------------------------------------------------
Wampmanager (Aestan Tray Menu) 3.2.3.3 - 64bit
Compiler Visual C++ versions used:
PHP 5.6.40 Compiler => MSVC11 (Visual C++ 2012)
Architecture => x64
is compatible with Apache 2.4.46
PHP 7.3.21 Compiler => MSVC15 (Visual C++ 2017)
Architecture => x64
is compatible with Apache 2.4.46
PHP 7.4.9 Compiler => Visual C++ 2017
Architecture => x64
is compatible with Apache 2.4.46
MySQL Ver 5.7.31 for Win64 on x86_64 (MySQL Community Server (GPL))
MariaDB Ver 10.4.13-MariaDB for Win64 on AMD64 (mariadb.org binary distribution)
Apache 2.4.46 Apache Lounge VS16 Server built: Aug 2 2020 10:21:32
Architecture: 64-bit
--------------------------------------------------
VirtualHost configuration:
Default server: localhost
Virtual Host: localhost
Virtual Host: eggertsen
--------------------------------------------------
***** Check symbolic links *****
All symbolic links are OK
--------------------------------------------------
***** Test which uses port 80 *****
===== Tested by command netstat filtered on port 80 =====
Test for TCP
Your port 80 is used by a processus with PID = 18664
The processus of PID 18664 is 'httpd.exe' Session: Services
The service of PID 18664 for 'httpd.exe' is 'wampapache64'
This service is from Wampserver - It is correct
Test for TCPv6
Your port 80 is used by a processus with PID = 18664
The processus of PID 18664 is 'httpd.exe' Session: Services
The service of PID 18664 for 'httpd.exe' is 'wampapache64'
This service is from Wampserver - It is correct
===== Tested by attempting to open a socket on port 80 =====
Your port 80 is actually used by :
Server: Apache/2.4.46 (Win64) PHP/7.3.21
--------------------------------------------------
***** Test which uses port 3306 *****
===== Tested by command netstat filtered on port 3306 =====
Test for TCP
Your port 3306 is used by a processus with PID = 17732
The processus of PID 17732 is 'mysqld.exe' Session: Services
The service of PID 17732 for 'mysqld.exe' is 'wampmysqld64'
This service is from Wampserver - It is correct
Test for TCPv6
Your port 3306 is used by a processus with PID = 17732
The processus of PID 17732 is 'mysqld.exe' Session: Services
The service of PID 17732 for 'mysqld.exe' is 'wampmysqld64'
This service is from Wampserver - It is correct
--------------------------------------------------
***** Test which uses port 3307 *****
===== Tested by command netstat filtered on port 3307 =====
Test for TCP
Your port 3307 is used by a processus with PID = 19820
The processus of PID 19820 is 'mysqld.exe' Session: Services
The service of PID 19820 for 'mysqld.exe' is 'wampmariadb64'
This service is from Wampserver - It is correct
Test for TCPv6
Your port 3307 is used by a processus with PID = 19820
The processus of PID 19820 is 'mysqld.exe' Session: Services
The service of PID 19820 for 'mysqld.exe' is 'wampmariadb64'
This service is from Wampserver - It is correct
--------------------------------------------------
-------- Apache error log (Last 30 lines) --------
[Mon Dec 28 14:19:17.733871 2020] [mpm_winnt:notice] [pid 9664:tid 752] AH00430: Parent: Child process 4480 exited successfully.
[Mon Dec 28 14:19:19.905306 2020] [mpm_winnt:notice] [pid 2656:tid 752] AH00455: Apache/2.4.46 (Win64) PHP/7.3.21 configured -- resuming normal operations
[Mon Dec 28 14:19:19.905306 2020] [mpm_winnt:notice] [pid 2656:tid 752] AH00456: Apache Lounge VS16 Server built: Aug 2 2020 10:21:32
[Mon Dec 28 14:19:19.905306 2020] [core:notice] [pid 2656:tid 752] AH00094: Command line: 'c:\\wamp64\\bin\\apache\\apache2.4.46\\bin\\httpd.exe -d C:/wamp64/bin/apache/apache2.4.46'
[Mon Dec 28 14:19:19.905306 2020] [mpm_winnt:notice] [pid 2656:tid 752] AH00418: Parent: Created child process 12008
[Mon Dec 28 14:19:21.031645 2020] [mpm_winnt:notice] [pid 12008:tid 704] AH00354: Child: Starting 64 worker threads.
[Tue Dec 29 13:23:26.402079 2020] [mpm_winnt:notice] [pid 2656:tid 752] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Tue Dec 29 13:23:28.417323 2020] [mpm_winnt:notice] [pid 12008:tid 704] AH00364: Child: All worker threads have exited.
[Tue Dec 29 13:23:28.448570 2020] [mpm_winnt:notice] [pid 2656:tid 752] AH00430: Parent: Child process 12008 exited successfully.
[Tue Dec 29 13:23:36.151004 2020] [mpm_winnt:notice] [pid 20612:tid 676] AH00455: Apache/2.4.46 (Win64) PHP/7.3.21 configured -- resuming normal operations
[Tue Dec 29 13:23:36.151004 2020] [mpm_winnt:notice] [pid 20612:tid 676] AH00456: Apache Lounge VS16 Server built: Aug 2 2020 10:21:32
[Tue Dec 29 13:23:36.152001 2020] [core:notice] [pid 20612:tid 676] AH00094: Command line: 'c:\\wamp64\\bin\\apache\\apache2.4.46\\bin\\httpd.exe -d C:/wamp64/bin/apache/apache2.4.46'
[Tue Dec 29 13:23:36.157984 2020] [mpm_winnt:notice] [pid 20612:tid 676] AH00418: Parent: Created child process 18200
[Tue Dec 29 13:23:37.367720 2020] [mpm_winnt:notice] [pid 18200:tid 712] AH00354: Child: Starting 64 worker threads.
[Tue Dec 29 14:31:08.655596 2020] [mpm_winnt:notice] [pid 20612:tid 676] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Tue Dec 29 14:31:10.676899 2020] [mpm_winnt:notice] [pid 18200:tid 712] AH00364: Child: All worker threads have exited.
[Tue Dec 29 14:31:10.723718 2020] [mpm_winnt:notice] [pid 20612:tid 676] AH00430: Parent: Child process 18200 exited successfully.
[Tue Dec 29 14:49:46.268623 2020] [mpm_winnt:notice] [pid 8352:tid 792] AH00455: Apache/2.4.46 (Win64) PHP/7.3.21 configured -- resuming normal operations
[Tue Dec 29 14:49:46.268623 2020] [mpm_winnt:notice] [pid 8352:tid 792] AH00456: Apache Lounge VS16 Server built: Aug 2 2020 10:21:32
[Tue Dec 29 14:49:46.268623 2020] [core:notice] [pid 8352:tid 792] AH00094: Command line: 'c:\\wamp64\\bin\\apache\\apache2.4.46\\bin\\httpd.exe -d C:/wamp64/bin/apache/apache2.4.46'
[Tue Dec 29 14:49:46.268623 2020] [mpm_winnt:notice] [pid 8352:tid 792] AH00418: Parent: Created child process 13456
[Tue Dec 29 14:49:47.455843 2020] [mpm_winnt:notice] [pid 13456:tid 704] AH00354: Child: Starting 64 worker threads.
[Tue Dec 29 15:04:52.012824 2020] [mpm_winnt:notice] [pid 8352:tid 792] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Tue Dec 29 15:04:54.041828 2020] [mpm_winnt:notice] [pid 13456:tid 704] AH00364: Child: All worker threads have exited.
[Tue Dec 29 15:04:54.061954 2020] [mpm_winnt:notice] [pid 8352:tid 792] AH00430: Parent: Child process 13456 exited successfully.
[Tue Dec 29 15:04:57.886231 2020] [mpm_winnt:notice] [pid 18664:tid 756] AH00455: Apache/2.4.46 (Win64) PHP/7.3.21 configured -- resuming normal operations
[Tue Dec 29 15:04:57.886231 2020] [mpm_winnt:notice] [pid 18664:tid 756] AH00456: Apache Lounge VS16 Server built: Aug 2 2020 10:21:32
[Tue Dec 29 15:04:57.886231 2020] [core:notice] [pid 18664:tid 756] AH00094: Command line: 'c:\\wamp64\\bin\\apache\\apache2.4.46\\bin\\httpd.exe -d C:/wamp64/bin/apache/apache2.4.46'
[Tue Dec 29 15:04:57.886231 2020] [mpm_winnt:notice] [pid 18664:tid 756] AH00418: Parent: Created child process 23620
[Tue Dec 29 15:05:00.125821 2020] [mpm_winnt:notice] [pid 23620:tid 560] AH00354: Child: Starting 64 worker threads.
--------------------------------------------------
-------- Apache access log (Last 30 lines) --------
::1 - - [28/Dec/2020:14:07:40 -0600] "GET /wampthemes/classic/img/pngWrench.png HTTP/1.1" 200 741
::1 - - [28/Dec/2020:14:08:45 -0600] "GET /add_vhost.php?lang=english HTTP/1.1" 200 4964
::1 - - [28/Dec/2020:14:08:45 -0600] "GET /img/gifLogo.gif HTTP/1.1" 404 281
::1 - - [28/Dec/2020:14:08:45 -0600] "GET /img/pngWrench.png HTTP/1.1" 404 281
::1 - - [28/Dec/2020:14:14:52 -0600] "GET /add_vhost.php?lang=english HTTP/1.1" 200 4964
::1 - - [28/Dec/2020:14:14:52 -0600] "GET /img/gifLogo.gif HTTP/1.1" 404 281
::1 - - [28/Dec/2020:14:14:52 -0600] "GET /img/pngWrench.png HTTP/1.1" 404 281
::1 - - [28/Dec/2020:14:18:15 -0600] "POST /add_vhost.php?lang=english HTTP/1.1" 200 3752
::1 - - [28/Dec/2020:14:18:16 -0600] "GET /img/gifLogo.gif HTTP/1.1" 404 281
::1 - - [28/Dec/2020:14:19:15 -0600] "-" 408 -
::1 - - [28/Dec/2020:14:20:11 -0600] "GET / HTTP/1.1" 200 561
::1 - - [28/Dec/2020:14:20:11 -0600] "GET /icons/blank.gif HTTP/1.1" 200 148
::1 - - [28/Dec/2020:14:20:11 -0600] "GET /favicon.ico HTTP/1.1" 404 281
::1 - - [28/Dec/2020:14:21:10 -0600] "-" 408 -
::1 - - [28/Dec/2020:14:52:58 -0600] "GET / HTTP/1.1" 200 6081
::1 - - [28/Dec/2020:14:53:11 -0600] "GET / HTTP/1.1" 200 561
::1 - - [28/Dec/2020:14:53:58 -0600] "-" 408 -
::1 - - [28/Dec/2020:14:54:11 -0600] "-" 408 -
::1 - - [28/Dec/2020:14:57:30 -0600] "GET / HTTP/1.1" 200 6081
::1 - - [28/Dec/2020:14:58:04 -0600] "GET / HTTP/1.1" 200 2930
::1 - - [28/Dec/2020:14:58:30 -0600] "-" 408 -
::1 - - [28/Dec/2020:14:59:04 -0600] "-" 408 -
::1 - - [28/Dec/2020:15:00:47 -0600] "GET /add_vhost.php HTTP/1.1" 200 5273
::1 - - [28/Dec/2020:15:00:47 -0600] "GET /img/gifLogo.gif HTTP/1.1" 404 281
::1 - - [28/Dec/2020:15:00:47 -0600] "GET /img/pngWrench.png HTTP/1.1" 404 281
::1 - - [28/Dec/2020:15:01:47 -0600] "-" 408 -
192.168.1.18 - - [29/Dec/2020:13:58:43 -0600] "GET / HTTP/1.1" 200 6081
192.168.1.18 - - [29/Dec/2020:13:58:49 -0600] "GET /HNAP1/ HTTP/1.1" 404 284
127.0.0.1 - - [29/Dec/2020:14:51:20 -0600] "GET / HTTP/1.1" 200 6081
127.0.0.1 - - [29/Dec/2020:15:06:04 -0600] "GET / HTTP/1.1" 200 6081
--------------------------------------------------
-------- PHP error log (Last 30 lines) --------
- Wampserver trace report -
File created by Wampserver install
--------------------------------------------------
-------- MySQL error log (Last 30 lines) --------
- Wampserver trace report -
File created by Wampserver install
2020-12-26T21:33:14.981048Z 0 [Warning] InnoDB: Resizing redo log from 2*3072 to 2*16384 pages, LSN=2720658
2020-12-26T21:33:15.173239Z 0 [Warning] InnoDB: Starting to delete and rewrite log files.
100 200
100 200
2020-12-26T21:33:28.816162Z 0 [Warning] InnoDB: New log files created, LSN=2720658
--------------------------------------------------
-------- MariaDB error log (Last 30 lines) --------
2020-12-29 15:04:55 0 [Note] InnoDB: FTS optimize thread exiting.
2020-12-29 15:04:55 0 [Note] InnoDB: Starting shutdown...
2020-12-29 15:04:55 0 [Note] InnoDB: Dumping buffer pool(s) to c:\wamp64\bin\mariadb\mariadb10.4.13\data\ib_buffer_pool
2020-12-29 15:04:55 0 [Note] InnoDB: Buffer pool(s) dump completed at 201229 15:04:55
2020-12-29 15:04:56 0 [Note] InnoDB: Shutdown completed; log sequence number 61488; transaction id 22
2020-12-29 15:04:56 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-12-29 15:04:56 0 [Note] wampmariadb64: Shutdown complete
InnoDB: using atomic writes.
2020-12-29 15:05:00 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2020-12-29 15:05:00 0 [Note] InnoDB: Uses event mutexes
2020-12-29 15:05:00 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-12-29 15:05:00 0 [Note] InnoDB: Number of pools: 1
2020-12-29 15:05:00 0 [Note] InnoDB: Using SSE2 crc32 instructions
2020-12-29 15:05:00 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2020-12-29 15:05:00 0 [Note] InnoDB: Completed initialization of buffer pool
2020-12-29 15:05:01 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-12-29 15:05:01 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-12-29 15:05:01 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-12-29 15:05:01 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB.
2020-12-29 15:05:01 0 [Note] InnoDB: Waiting for purge to start
2020-12-29 15:05:01 0 [Note] InnoDB: 10.4.13 started; log sequence number 61488; transaction id 21
2020-12-29 15:05:01 0 [Note] InnoDB: Loading buffer pool(s) from c:\wamp64\bin\mariadb\mariadb10.4.13\data\ib_buffer_pool
2020-12-29 15:05:01 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-12-29 15:05:01 0 [Note] InnoDB: Buffer pool(s) load completed at 201229 15:05:01
2020-12-29 15:05:01 0 [Note] Server socket created on IP: '::'.
2020-12-29 15:05:01 0 [Note] Reading of all Master_info entries succeeded
2020-12-29 15:05:01 0 [Note] Added new Master_info '' to hash table
2020-12-29 15:05:01 0 [Note] wampmariadb64: ready for connections.
Version: '10.4.13-MariaDB' socket: '' port: 3307 mariadb.org binary distribution
--------------------------------------------------

Re: Php files displayed as text in chrome
Posted by: Otomatic (Moderator)
Date: December 30, 2020 08:56AM

Hi,

Thank you for putting the Wampserver configuration report. It is flawless.

What would have been nice is to READ (and answer) BEFORE YOU ASK A QUESTION

> I attempt to run them even something as basic as a "hello world"
How do you run this file which contains "hello world" and where is this file and under what name?

------------------------------------------------------------------------------------------------------------
Wampserver 3.2.7 32 bit - Apache 2.4.51 - PHP 8.1.0…5.6.40 - MySQL 5.7.36 - MariaDB 10.5.13/10.6.5
Wampserver 3.2.7 64 bit - Apache 2.4.51 - PHP 8.1.0…5.6.40 - MySQL 5.7.36/8.0.27 - MariaDB 10.5.13/10.6.5
PhPMyadmin 5.1.1 - MysqlDumper 1.24.5
on W10 and W7 Pro 64 bit
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons
« Ce n'est pas parce qu'ils sont nombreux à avoir tort, qu'ils ont forcément raison. Coluche »
« It's not because they are many to be wrong, they are necessarily right. Coluche »

Re: Php files displayed as text in chrome
Posted by: RiggsFolly (Moderator)
Date: December 30, 2020 11:06AM

Please remember, you have to run your PHP scripts through the webserver.

So your address bar should look like `[localhost]` or `localhost`

If your address bar starts with `file:///` then you are running the script but not through the web server. Only the web server has access to the PHP interpreter.
It can be a little confusing at first as javascript and css and all the other stuff can work quite happily using `file:///` but PHP will not

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.2.5 32bit & 64bit)
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Sorry, only registered users may post in this forum.