Wampserver "green" but "offline", "php include" doesn't work
Posted by: Hogwash (---.w92-136.abo.wanadoo.fr)
Date: December 31, 2014 06:23PM

I have just installed and configured WAMP. Reason: I want to be able to try out "php include" stuff on a local server. My test files work flawlessly when uploaded to my actual website (OK, did have to add an item to the .htaccess).

Situation:

WampServer 2.5 (Apache 2.4.8, PHP 5.5,12, MySQL 5.6.17); Windows 7, 32bit.
WAMP icon is green
wampapache service is running
wampmysqld service is running
no, I don't have Skype on my PC

In Apache httpd.config: all references to port 80 have been changed to 8080, and "AddType application/x-httpd-php .html" has been added to <IfModule mime_module> ....... </IfModule>

localhost and localhost/:8008 both correctly show the server configuration.

WAMP --> PHP settings --> "allow url fopen" and "allow url include" are "on" ( = has check mark)

WAMP--> Apache --> Apache Modules --> "include module" is "on"

But: "WAMPSERVER - server Offline"

When trying to execute the "testmysql.php" that is installed by default in the wamp/www directory, I get a screen with the following erros messages: "Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\Program Files\wamp\www\testmysql.php on line 2"

My "include-test.htm" test file is simply:

WAMPServer forum: Hogwash, fmgd@hot, Tallyho1
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body>
<?php include("external.htm"winking smiley; ?>
<?php include("test.txt"winking smiley; ?>
</body>
</html>

The "external.htm" and "test.txt" are also in the WAMP "www" directory.

When executing "[localhost]; with my browser (the one used by/with WAMP), the "include-test.htm" executes without performing the "include". Using "inspect element" in Firefox confirms that the "php include" is being ignored / does not get parsed:

<html>
<head>
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type"></meta>
<title></title>
</head>
<body>
<!--?php include("external.htm"winking smiley; ?-->
<!--?php include("hell-cam-freq.txt"winking smiley; ?-->
</body>
</html>

Would appreciate any and all help!

Thanks,

Fred

Options: ReplyQuote
Re: Wampserver "green" but "offline", "php include" doesn't work
Posted by: RiggsFolly (---.as43234.net)
Date: January 01, 2015 01:35AM

Have you added these entries to the HOSTS file

c:\windows\system32\drivers\etc\hosts

127.0.0.1  localhost

::1  localhost

If not, they shoudl be added

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<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-

Options: ReplyQuote
Re: Wampserver "green" but "offline", "php include" doesn't work
Posted by: Hogwash (---.w92-136.abo.wanadoo.fr)
Date: January 01, 2015 10:29AM

I have now changed the hosts file (and even rebooted my PC) - no change in status or symptoms.

I did notice that there are two httpd.exe "Apache server" processes running, but that may be normal...

The error-logs also do not appear to reveal anything additional:

apache_error_log:

[Wed Dec 31 12:36:20.182601 2014] [mpm_winnt:notice] [pid 3124:tid 312] AH00364: Child: All worker threads have exited.
[Wed Dec 31 12:36:20.192601 2014] [mpm_winnt:notice] [pid 5720:tid 380] AH00430: Parent: Child process 3124 exited successfully.
[Wed Dec 31 12:36:21.846608 2014] [mpm_winnt:notice] [pid 5832:tid 380] AH00455: Apache/2.4.9 (Win32) PHP/5.5.12 configured -- resuming normal operations
[Wed Dec 31 12:36:21.846608 2014] [mpm_winnt:notice] [pid 5832:tid 380] AH00456: Apache Lounge VC11 Server built: Mar 16 2014 12:13:13
[Wed Dec 31 12:36:21.846608 2014] [core:notice] [pid 5832:tid 380] AH00094: Command line: 'C:\\Program Files\\wamp\\bin\\apache\\apache2.4.9\\bin\\httpd.exe -d C:/Program Files/wamp/bin/apache/apache2.4.9'
[Wed Dec 31 12:36:21.856608 2014] [mpm_winnt:notice] [pid 5832:tid 380] AH00418: Parent: Created child process 4604



php_error_log:

[01-Jan-2015 10:54:17 Europe/Paris] PHP Stack trace:

[01-Jan-2015 10:54:17 Europe/Paris] PHP 1. {main}() C:\Program Files\wamp\www\testmysql.php:0

[01-Jan-2015 10:54:17 Europe/Paris] PHP 2. mysql_connect() C:\Program Files\wamp\www\testmysql.php:2

[01-Jan-2015 10:54:20 Europe/Paris] PHP Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\Program Files\wamp\www\testmysql.php on line 2

[01-Jan-2015 10:54:20 Europe/Paris] PHP Stack trace:

[01-Jan-2015 10:54:20 Europe/Paris] PHP 1. {main}() C:\Program Files\wamp\www\testmysql.php:0

[01-Jan-2015 10:54:20 Europe/Paris] PHP 2. mysql_connect() C:\Program Files\wamp\www\testmysql.php:2

[01-Jan-2015 10:54:20 Europe/Paris] PHP Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\Program Files\wamp\www\testmysql.php on line 2

[01-Jan-2015 10:54:20 Europe/Paris] PHP Stack trace:

[01-Jan-2015 10:54:20 Europe/Paris] PHP 1. {main}() C:\Program Files\wamp\www\testmysql.php:0

[01-Jan-2015 10:54:20 Europe/Paris] PHP 2. mysql_connect() C:\Program Files\wamp\www\testmysql.php:2



mysql_log:

015-01-01 10:58:34 3924 [Note] Plugin 'FEDERATED' is disabled.
2015-01-01 10:58:34 3924 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-01-01 10:58:34 3924 [Note] InnoDB: The InnoDB memory heap is disabled
2015-01-01 10:58:34 3924 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2015-01-01 10:58:34 3924 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-01-01 10:58:34 3924 [Note] InnoDB: Not using CPU crc32 instructions
2015-01-01 10:58:34 3924 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2015-01-01 10:58:34 3924 [Note] InnoDB: Completed initialization of buffer pool
2015-01-01 10:58:34 3924 [Note] InnoDB: Highest supported file format is Barracuda.
2015-01-01 10:58:35 3924 [Note] InnoDB: 128 rollback segment(s) are active.
2015-01-01 10:58:35 3924 [Note] InnoDB: Waiting for purge to start
2015-01-01 10:58:35 3924 [Note] InnoDB: 5.6.17 started; log sequence number 1626087
2015-01-01 10:58:35 3924 [Note] Server hostname (bind-address): '*'; port: 3306
2015-01-01 10:58:35 3924 [Note] IPv6 is available.
2015-01-01 10:58:35 3924 [Note] - '::' resolves to '::';
2015-01-01 10:58:35 3924 [Note] Server socket created on IP: '::'.
2015-01-01 10:58:35 3924 [Note] Event Scheduler: Loaded 0 events
2015-01-01 10:58:35 3924 [Note] wampmysqld: ready for connections.
Version: '5.6.17' socket: '' port: 3306 MySQL Community Server (GPL)



Edited 1 time(s). Last edit at 01/01/2015 11:08AM by Hogwash.

Options: ReplyQuote
Re: Wampserver "green" but "offline", "php include" doesn't work
Posted by: RiggsFolly (---.as43234.net)
Date: January 01, 2015 03:51PM

I assume you are aware that you have to edit that file to get it to run!

It is delivered like this :-

<?php 
$link = mysql_connect('hostname','dbuser','dbpassword'); 
if (!$link) { 
	die('Could not connect to MySQL: ' . mysql_error()); 
} 
echo 'Connection OK'; mysql_close($link); 
?>

and you have to change it to work with any other chnages you may have made to the MYSQL Configuration.

If you have changed nothing to do with MySQL then amend it to :-

<?php 
$link = mysql_connect('127.0.0.1','root',''); 
if (!$link) { 
	die('Could not connect to MySQL: ' . mysql_error()); 
} 
echo 'Connection OK'; mysql_close($link); 
?>

And try again

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<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-

Options: ReplyQuote
Re: Wampserver "green" but "offline", "php include" doesn't work
Posted by: Hogwash (---.w92-136.abo.wanadoo.fr)
Date: January 02, 2015 10:57AM

Please forgive my ignorance. I thought WAMP would simply give me a local emulation of a real webserver, without having to change the files of my website to make them work with WAMP. IMHO that defeats the purpose of having a local server.

My files with "php include" work without any problem on a real webserver that supports php, after merely adding the following to the .htaccess file: "AddType php .html .htm" and "AddHandler application/x-httpd-php .html .htm." No need to do any server or MySQL related stuff inside my .htm files. I had hoped/expected that a local server would behave the same way. Maybe WAMP also has .htaccess hidden somewhere?

Options: ReplyQuote
Re: Wampserver "green" but "offline", "php include" doesn't work
Posted by: RiggsFolly (---.as43234.net)
Date: January 02, 2015 01:55PM

WAMPServer is not an emulation of a real web server, It is a real Apache web server

WAMPServer does not have any hidden .htaccess file(s).

It sounds like you have not actually chnaged Apache's config to make it parse .htm/.html files properly.

I once, many years ago did this, before I understood properly what I was doing. Adding this to the .htaccess did the trick for me.

Add a file called .htaccess to the folder containing the root of the site you want thsi to work on

AddHandler application/x-httpd-php .html
DirectoryIndex index.html index.php


Quote

WAMP --> PHP settings --> "allow url fopen" and "allow url include" are "on" ( = has check mark)

NOT RELEVANT


Quote

WAMP--> Apache --> Apache Modules --> "include module" is "on"

NOT RELEVANT, Is related to SSI ( Server Side Includes ) This is not what you are doing !!!

Quote

But: "WAMPSERVER - server Offline"
NOT RELEVANT. This just means that Apache can only be accessed from the PC running WAMPServer. Its a security measure to protect those that dont yet fully understand.




PS.

Just because WAMPServer is easy to install and use, does not make it an out of the box experience for everybody.
You are using a NON STANDARD approach to running PHP so you are going to have to research how it is done, and not just howl at the moon when things dont just fall into place.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<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-

Options: ReplyQuote


Sorry, only registered users may post in this forum.