PHP Not Loading on Local Virtual Hosts
Posted by: drc0369 (---.biz.spectrum.com)
Date: April 22, 2021 04:12PM

Hello Group,

Problem listed below in question #10.


1 - Windows version used:
Edition: Windows 10 Home
Version: 2004
OS Build: 19041.928

2 - Version WampServer: 3.1.9 - 64bit

3 - Apache Version: 2.4.39

4 - PHP Version: 7.2.18

5 - MySQL Version: 5.7.26 - Port defined for MySQL: 3306 - Default DBMS

5a - MariaDB version if applicable: 10.3.14 - Port defined for MariaDB: 3307

6 - What color is the WampServer icon: Green

7 - In the file c:\Windows\System32\drivers\etc\hosts, what are the active lines?:
No # at the beginning of each line, but there is one at the very top of the hosts file (line 1)

8 - Do you have access to localhost?: Yes

8a - If so, is there an error message at the bottom of the page?:
No error shown (but in the left click taskbar icon menu, there is an error saying that the "Default text editor does not exists". It's pointing to an old text editor path and I don't see how to change it in WAMP Server)

9 - Do you have access to phpMyAdmin?: Yes

10 - If you refer to an error message, please include the EXACT wording of the error in your post:
No direct error message, I have PHP include lines in my HTML code for local dev sites and the virtual hosts were loading fine. Today, I get a Opening popup error: "You have chosen to open: which is: application/x-httpd-php from: [dev.virtualdomainname.com"];. I get this same message when trying to open each of my virtual host sites locally.

I believe it has something to do with the HTACCESS file. This is what I have in the file in order to allow PHP to run in the HTML and be recognized. I have to change it when I publish the sites live as it's a different set of commands on the live side (GoDaddy hosting). Did anything change in the PHP or do I need to change/add anything else to the local HTACCESS file to allow the local sites to be opened?

I restarted all three services and still get the Opening popup window.

(NOTE: converting all the HTML to PHP is not a viable option in case this is one of the answers, but then again, PHP is the main issue here)

Local HTACCESS file:
AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm

Live HTACCESS file:
Options +ExecCGI
AddHandler application/x-httpd-lsphp .html

11 - If you use an Antivirus and/or Firewall, please include the names of these: IObit Malware Fighter

12 - What is the full path to the installation of WampServer: C:\wamp64\

13 - If you have one or more Virtual Hosts defined, please show their definition(s):
dev.divinedesignks.com
dev.c2ministries.org
dev.forerunner-ministries.org
dev.ekklesiaglobalconference.org
dev.drdianna.com
dev.divinedesignkslanding.com
dev.drdiannacomingsoon.com

Options: ReplyQuote
Re: PHP Not Loading on Local Virtual Hosts
Posted by: Otomatic (Moderator)
Date: April 22, 2021 06:45PM

Hi,

> Version WampServer: 3.1.9 - 64bit

- Verify that all VC ++ packages are installed and with the latest versions.
To do this, use the tool:
Checks VC++ packages installed
Do not use a previously loaded tool. Make a new download to make sure you are using the correct version.
To download missing packages, do not rely on Microsoft links, they are not reliable, download packages on http://wampserver.aviatechno.net in section Visual C++ Redistribuable Packages
Do not forget that if you have a 64 bit Windows, you must install both 32 and 64 bit versions of each package.
You must install each package "as an administrator", so right-click the exe file and then run as Administrator.

- If it is not already done, apply Update 3.2.5 to your version of Wampserver
Wampserver update 3.2.5

> error saying that the "Default text editor does not exists". It's pointing to an old text editor path
> and I don't see how to change it in WAMP Server)
- Exit Wampserver
- Edit c:\wamp64\wampmanager.conf file to write the complete path to the text editor used :
;Path of the Text Editor used by Wampserver
;May be modfied with the absolute path of the Text Editor exe file
;(Use / instead of \)
editor ="C:/Util/Notepad++/notepad++.exe"
logviewer ="C:/Util/Notepad++/notepad++.exe"

> 7 - In the file c:\Windows\System32\drivers\etc\hosts, what are the active lines?:
Since you have seven VirtualHosts defined, you must have sixteen lines in the hosts file.
127.0.0.1 localhost
::1 localhost

127.0.0.1 mysite1
::1 mysite1

127.0.0.1 mysite2
::1 mysite2

and so on

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: PHP Not Loading on Local Virtual Hosts
Posted by: drc0369 (---.biz.spectrum.com)
Date: May 18, 2021 10:03PM

Hey Otomatic,

I've applied Update 3.2.5 to Wampserver. I also verified all VC ++ packages are installed with the latest versions. Still getting the Open/Save File pop up error when opening the virtual host sites:

You have chosen to open:


which is : application/x-httpd-php (3.4Kcool smiley
from: [dev.virtualhostdomain.com]


It looks like it's tied to my htaccess files that have the following items in order to read the PHP Include lines in my html files.

Local HTACCESS file:
AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm


Daniel C.

Options: ReplyQuote
Re: PHP Not Loading on Local Virtual Hosts
Posted by: Otomatic (Moderator)
Date: May 19, 2021 10:44AM

Hi,

> AddType application/x-httpd-php .html
> AddType application/x-httpd-php .htm

You should instead add these directives to the httpd.conf file under the existing lines:

AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3

You may need to add:

AddHandler application/x-httpd-php .html .htm

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons



Edited 1 time(s). Last edit at 05/19/2021 10:54AM by Otomatic.

Options: ReplyQuote
Re: PHP Not Loading on Local Virtual Hosts
Posted by: drc0369 (---.biz.spectrum.com)
Date: June 07, 2021 03:40PM

Hey Otomatic,

Unfortunately, I don't have to luxury right now for my live sites as they are on shared hosting so I have to use the HTACCESS file until this changes not to mention, the live HTACCESS file lines are different than my local code. I can update my local WAMPServer file to see if that fixes the issue locally though.


Daniel C.

Options: ReplyQuote
Re: PHP Not Loading on Local Virtual Hosts
Posted by: drc0369 (---.biz.spectrum.com)
Date: June 07, 2021 03:57PM

Hey Otomatic,

Do I add it to this section in the httpd.config file?

The AddType lines were already in the file, So I just need to add the AddHandler line to the AddHandler section and make sure it's not commented out as below?


<IfModule mime_module>
#
# TypesConfig points to the file containing the list of mappings from
# filename extension to MIME-type.
#
TypesConfig conf/mime.types

#
# AddType allows you to add to or override the MIME configuration
# file specified in TypesConfig for specific file types.
#
#AddType application/x-gzip .tgz
#
# AddEncoding allows you to have certain browsers uncompress
# information on the fly. Note: Not all browsers support this.
#
AddEncoding x-compress .Z
AddEncoding x-gzip .gz .tgz
#
# If the AddEncoding directives above are commented-out, then you
# probably should define those extensions to indicate media types:
#
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3

#
# AddHandler allows you to map certain file extensions to "handlers":
# actions unrelated to filetype. These can be either built into the server
# or added with the Action directive (see below)
#
# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
#AddHandler cgi-script .cgi
AddHandler application/x-httpd-php .html .htm

# For type maps (negotiated resources):
#AddHandler type-map var

#
# Filters allow you to process content before it is sent to the client.
#
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddType text/html .shtml
#AddOutputFilter INCLUDES .shtml
</IfModule>



Daniel C.

Options: ReplyQuote
Re: PHP Not Loading on Local Virtual Hosts
Posted by: Otomatic (Moderator)
Date: June 07, 2021 05:03PM

Hi,

> o I just need to add the AddHandler line to the AddHandler section and make sure
> it's not commented out as below?
I think so. You don't risk anything by trying, if it doesn't work just go back.
Don't forget to restart Apache after each modification.

This kind of question is not the domain of this forum.
It would be better to go to the Apache Lounge Apache forum: [www.apachelounge.com]

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.