Pages: 12Next
Current Page: 1 of 2
Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 16, 2013 07:03PM

I notice on windows.php.net/download there is a 5.5.7 version available but I don't see that version (or any other version past 5.4) Is it possible to upgrade? If so how?

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: RiggsFolly (---.as13285.net)
Date: December 17, 2013 10:34AM

HOW TO MANUALLY INSTALL A NEW RELEASE OF PHP INTO THE WAMP ENVIRONMENT

Before you start

On Apache and PHP you will see the acronyms VC6, VC9, VC10 or VC11. This denotes the compiler version used to compile that program or dll.
Unfortunately you cannot mix the two when it comes to Apache and PHP, although some docuentation suggestst that VC10 and VC11 are compatible with each other, I make no guarantee of this.
So first you must find out which compiler was used to compile the Apache you are currently using, so you can get the PHP that was compiled with the same version of the compiler.
As time goes on this becomes more complicated as newer versions of PHP are not being compiled and linked with older versions of the compilers. VC6 seems to have been dropped a little while ago. So if you want to use a new PHP you will probably have to upgrade your version of Apache as well so you have a version that is compiled with at least VC9



The way PHP and Apache interact in the default WAMPServer install is that Apache launches the PHP Interpereter as a dll (php5apachex_y.dll) as this is a very close relationship i.e. not communication via a TCP port like PHP and MySQL, so they both have to have been compiled using the same version of Microsoft Visual C Compiler.


1. From WampManager "Stop All Services".

2. Download the PHP Release you want to install from www.php.net/download or if its not a current release try 'http://windows.php.net/downloads/releases/archives'
You should use the Thread Safe build. Usually the Not Thread Safe version has the acronim NTS and the thread safe version does not.
You should download the ZIP and not an .msi
Make sure its built with the same compiler versions as you Apache ( VC6 / VC9 / VC10 / VC11 ), you its a mine field.

3. Create a new folder under c:\wamp\bin\php\ with the name = the version you are installing
So, for example, make a folder called php5.5.11.

4. Now from the folder containing your most recent ( and working ) verions of PHP copy the file called wampserver.conf and paste it into your new PHP folder created in the previous setp.
This file is required by wamp server to properly identify that this is a valid PHP version folder.
The file contains references to the names of the dll files that contain the PHP interpreter, so that the correct file can be copied to the Apache folder when you activate this new version of the PHP interpreter.

The file should look like this, if you are moving from a very old version of PHP you may need to add some new sections from here to your file.

<?php

$phpConf['phpIniDir'] = '.';
$phpConf['phpExeDir'] = '.';
$phpConf['phpConfFile'] = 'php.ini';


$phpConf['apache']['1.3']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['1.3']['LoadModuleFile'] = 'php5apache.dll';
$phpConf['apache']['1.3']['AddModule'] =  'mod_php5.c';

$phpConf['apache']['2.0']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['2.0']['LoadModuleFile'] = 'php5apache2.dll';
$phpConf['apache']['2.0']['AddModule'] =  '';

$phpConf['apache']['2.2']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['2.2']['LoadModuleFile'] = 'php5apache2_2.dll';
$phpConf['apache']['2.2']['AddModule'] =  '';

$phpConf['apache']['2.4']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['2.4']['LoadModuleFile'] = 'php5apache2_4.dll';
$phpConf['apache']['2.4']['AddModule'] =  '';

?>


5. Now unzip the downloaded PHP into your new folder, make sure the folder hierarchy looks like this.


6. Now in your new folder copy the file php.ini_development into a new file called php.ini

Do the same again but paste into a file called phpForApache.ini
You should now have the original file called php.ini_development PLUS 2 more, one called php.ini and one called phpForApache.ini

The php.ini file is used if you are using the PHP CLI i.e. running php from the command line > php script.php
The phpForApache.ini is the php config used by Apache. This file is copied into the currently active Apache's folder and renamed to php.ini by WAMPmaneger when you activate this version of PHP.

It should look something like this:


7. We must now make some change to the php.ini files to WAMPise them.
Edit the newly created phpForApache.ini file

Search for extension_dir and change to
extension_dir = "d:/wamp/bin/php/phpx.y.z/ext/" <- where x,y,z match the folder you are putting the new PHP into.

Search for ;error_log = php_errors.log and change to
error_log = c:\wamp\logs\php_errors.log
Search for anything 'php/' and make sure you change it to you c:\wamp\bin\php\php.x.y.z folder name.

As of PHP5.4 the timezone need to be set
Search for [Date] and put an entry into the date.timezone field as a minimum

date.timezone = "Europe/London"
date.default_latitude = 0.0
date.default_longitude = 51.502973

look here for a list of supported timezone values [www.php.net]

PHP5.5 specific changes
a. All the PHP extensions are commented out, so you need to manually uncomment at least some of them
Check your last used php.ini to see what you need, remember some extensions may have been included in the core of php so you may need to check the php change log for details.


Now there may well be other configuration changes you had made to your existing PHP, these you will have to find and transfer yourself.
I suggest you compare your last \wamp\bin\apache\apachex.y.z\bin\php.ini with this new one and move over anything you believe is relevant.


DONT FORGET, if you are using th PHP CLI you will also need to do this to the php.ini file as well.

8. Make sure all services are stopped in wampmanager, and then right click over the wamp manager icon in the system tray and select the 'refresh' menu item.
When you left click on wamp manager -> PHP -> Version you should see your new version in the list.

If the new version does not appear, then you have probably spelt the phpForApache.ini file name wrong. Correct it and redo the 'refresh'.

9. You can now 'restart all services' from the wamp manager menus.

NOTE: You have not actually changed anything yet, so if wamp,Apache,PHP etc were working before they still should be.

10. Activate your new PHP version.
Using the wamp manager menus again you just need to click on the new version number to activate it.
wamp manager -> PHP -> Version -> 5.5.11 ( <- or whatever the version number is you have just added )

This will cause wamp manager to stop Apache ( the icon will go Orange )
Copy the correct files from the PHP folder to the Apache folder
php5apachex_y.dll, the php interpreter dll used by Apache
phpForApache.ini the php config file
etc

And then restart Apache. So the wamp manager icon should go GREEN again.

If the wamp manager icon stays ORANGE, then you have missed something, probably a file name spelt wrong. The phpForApache.ini file must exists.

11. Now run localhost from the wamp manager menu, and check the wamp server home page. It should tell you which version of PHP is loaded.




TROUBLE SHOOTING
If it all goes wrong when you activate the new PHP, you can easily back out of trouble by just activating whatever version of PHP you were using before, and then going back to see what you did wrong.


ADDING IONCUBE

Ioncube for PHP5.5 is not yet released as of 13/09/2013, they say they are waiting for PHP 5.5 to become stable and secure and hosting providers to adopt PHP 5.5 before they release their upgrade. They comment that it can take a year or more for hosting companies to adopt new versions of PHP and this I guess is their schedule.


You must ensure that you download the correct version to match your PHP :-
compiler( VC6/VC9 etc ) compiled ionCube dll
correct 32 or 64 bit code
and the Thread Safe version which is the one that is not NON-TS


1. Download the correct ionCube loader from [www.ioncube.com]
2. Place it somewhere on your disk, but not in the WAMP folder.
for example c:\webstuff\ioncube\vc9\
2. Edit the new php.ini Using the wamp manager menus
Add these 2 lines at the bottom of the file.
Remeber the version you load will depend upon which MAJOR version of PHP you are using i.e. 5.2,5.3 or 5.4

NOTE on IONCUBE and PHP5.5
Ioncube for PHP5.5 is not yet released as of 13/09/2013, they say they are waiting for PHP 5.5 to become stable and secure and hosting providers to adopt PHP 5.5 before they release their upgrade. They comment that it can take a year or more for hosting companies to adopt new versions of PHP and this I guess is their schedule.



;ioncube Extension
zend_extension = "c:/webstuff/ioncube/vc9/ioncube_loader_win_5.3.dll"



ADDING XDEBUG
XDEBUG comes with WAMP Server and is incredibly useful for debugging CLI or WEB scripts.
But it does not come with the PHP you have downloaded from the PHP website.
When upgrading PHP to a major version release you may need to get an up to date version of xdebug from
http://xdebug.org/download.php
For a minor version upgrade you can probably use the existing xdebug version you already have on disk.

So for a minor PHP version upgrade, copy the folder c:\wamp\bin\php\php5.y.z\zend_ext from your old PHP to your new php folder.
For a major PHP version upgrade get a new dll from the xdebug website and put it in a newly created folder called c:\wamp\bin\php\php5.y.z\zend_ext

Now add a line like this ( version specific of course ) to your php.ini ( using the wamp manager menus, to ensure you are editing the correct file )

;XDEBUG Extension
zend_extension = "d:/wamp/bin/php/phpx.y.z/zend_ext/php_xdebug-2.2.2-5.3-vc9.dll"

[xdebug]
xdebug.remote_enable = off
xdebug.profiler_enable = off
xdebug.profiler_enable_trigger = off
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.profiler_output_dir = "d:/wamp/tmp"

---------------------------------------------------------------------------------------------
(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: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 17, 2013 03:26PM

I am assuming that the versions of Apache on the WAMP site are VC10? The first upgrade would seem that I need to find Apache that was compiled with VC11. Where do I get that? Should I also be looking for a MySQL version that was compiled with VC11?

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: RiggsFolly (---.as13285.net)
Date: December 17, 2013 04:23PM

It's not particularly amusing, its a royal pain.

But as those greater mortals that compile these pieces of sortware for us are moving to more modern compilers life for us just mortals gets a little more complicated.

It also seems in general that Apache and PHP developers are making it more difficult to locate and use older versions of their software in an effort to make everybody catch up to the more recent versions. It has to make sense, but it can also make life more difficult when trying to match a testing environment to an existing live environment.

Anyway, for what ts worth, here is a how to role your own Apache upgrade in WAMP.



No you dont need a new MySQL as far as I know.





HowTo: Install a new version of APACHE into WAMP yourself.


This is not intended to replace the wamp addons mechanism of downloading apache version. If the version you require is available as an addon, use that mechanism, its just so easy.


This tutorial is not really for the absolute beginner. It would help if you had a basic knowledge of how apache/php work together and seperately and their individual configuration, as well as an understanding of what wamp is and does for you.


Read all this document before starting any actual attempt to install an apache version.


This guide assumes you are installing a minor version of an apache you already have installed i.e. apache 2.2.x to apache2.2.y.
I will use the versions 2.2.22 and 2.2.23, the tutorial uses these folder names but of course you will probably be installing different versions.

So here is the process:

1. Download the ZIP version of the Apache you want to run ( not the msi installer, only because I dont know what it may do or assume when it installs )
Suggestion only
[www.apachelounge.com]

2. From wamp manager, Stop all services.

3. Go to c:\wamp\bin\apache\ and create a new folder named appropriately for the release you are installing i.e apache.2.2.23

4. Unzip the Apache downloaded and copy the contents of the unzipped apache folder into your newly created folder in the wamp folder structure. apache2.2.23 in this example.
Make sure the directory levels are the same as your existing apache folder i.e. all the folders get unzipped into a folder called something like apache2, just copy all the subfolders to your new folder wamp\bin\apache\apache.2.2.23 folder. I suggest you unzip it somewhere else and then copy that to the wamp folder.

5. Copy c:\wamp\bin\apache\apache2.2.22\wampserver.conf to c:\wamp\bin\apache\apache2.2.23\wampserver.conf
All the folders in here are relative to where this file lives, so normally nothing need changing in here.
Wamp will not see your new install properly if you forget this step.

6. Now you need to bring your existing httpd.conf file from your current instance of apache.

Be carefull here, things change in the httpd.conf file, parameters get deprecated, new ones get created etc. So use the new httpd.conf as the master and only move over parameters you know you have changed for your actual requirements.

First make a backup of the new wamp\bin\apache\apache2.2.23\httpd.conf as wamp\bin\apache\apache2.2.23\httpd.original.conf ( for example )


Now this new httpd.conf file assumes the location of Apache is the default i.e. c:\apache\....
So there are parameter in YOUR NEW httpd.conf file that MUST BE CHECKED against your old WAMP oriented one
Some but maybe not all are listed here:-

Listen
ServerRoot
ServerAdmin
ServerName
DocumentRoot
<Directory....> Check all the directory parameters match the wamp file structure
ErrorLog
CustomLog
LoadModule
AddType
MimeType
DirectoryIndex Add index.php to this list


Now we must configure apache to use the correct version of PHP.
'LoadModule'
Wamp default is to runs PHP as an apache handler, that means apache loads the PHP interpreter as an apache module. ( see below )
Remember the Apache conf does not assume you are a PHP user so you will have to add this to the new conf file rather than change it.
So you must also check you are loading the correct handler for the version of apache and PHP you want to use.
The PHP folder should contain 1 or more of these handlers ( dll's ) depending on which versions of php it has been compiled for ( not all php version will run with all apache's ).
You must load the correct dll to match the apache version and the php version you want to use.


Ok I am afraid we need a bit of Techy Stuff here.
When PHP is compiled, by cleverer people than us! It is actually compiled more than once for various situations.
If you look in the php/phpx.y.z folder you will see a php.exe, php-win.exe, php-cgi.exe, all of which are irrelivant in the context of this document.

You will also see one or more dll files with names like php5apache2.dll, php5apache2_2.dll, php5apache2_4.dll, again depending on which apache you have download.
These are the php interpreter compiled into a dll for use as an apache handler.
The version of apache that this php is comiled to run with, is denoted by the apache2 (apache 2.0 or 2.1) or apache2_2 (apache 2.2 or 2.3) or apache2_4 ( apache 2.4 ) part of the filename.
The php5 part denotes it is a version of php5 ( but does not tell you which version of php5 ).
The version of php is denoted by the fact that you downloaded php5.3.13 and have luckily loaded it into a folder called php5.3.13 so you know whats what.


If you are using PHP 5.4 with an apache 2.4.x instance:
LoadModule php5_module "d:/wamp/bin/php/php5.4.x/php5apache2_4.dll" for using PHP 5.4

If you are using PHP 5.2 or PHP 5.3 with an apache 2.2.x instance:
LoadModule php5_module "d:/wamp/bin/php/php5.2.x/php5apache2_2.dll"

If you want to use PHP with an apache 2.0.x or 2.1.x instance:
LoadModule php5_module "d:/wamp/bin/php/php5.1.x/php5apache2.dll" for using PHP

NOTE:
This parameter is in the httpd.conf but is loading a file from a PHP folder.

If the php version folder does not contain a handler that matches apache version you want to run then that version of php wont run with that version of apache or your php download has not been compiled for that version of apache, normally the former.

Armed with this information you should be able to find the correct handler for the version of apache and php that you want to run together.


7. If you are using Virtual Servers you will also need to copy the conf\extras\httpd-vhosts.conf file from your old Apache version folder to your new folder.

8. We should be nearly done, so
Right click wampmanager -> refresh

This will tell wamp manager to re-configure itself and go look for anything new in its folder structure i.e. your new apache.
Check it has worked by: left click wampmanager -> Apache -> Versions, you should see your new one appear in the list.

8. Now Left click wamp manager -> Apache -> Versions -> and click your new version numbers to activate the new version of Apache.
This will restart apache and run your new version.

If apache fails to start ( wamp manager stays orange ) either you or I have missed a step. I hope its you!


TROUBLE SHOOTING
If you make a mistake check the apache error log for clues, or the windows event viewer, apache writes errors to this as well as its error log.

If all else fails, delete the new apache.x.y.z folder and re run the Right click on wamp manager -> Refresh and it will re configure itself without your new apache and you can start 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: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 17, 2013 05:22PM

Thank you very much. I seem to be missing the first step. I am not sure where to download the latest Apache Web server. If I go to apache.org there is an installer and the only zip is for mod_fcgid and it has a version of 2.3.6. From what I can tell the stable release seems to be 2.2x but WAMP has 2.4.4. Any hints to where I can download 2.4.7 compiled with VC11?

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 17, 2013 09:59PM

Again thank you very much. This has been most instructive. I went to www.apachelounge.com and found the zip there and I got all the way down to the step

8. We should be nearly done, so
Right click wampmanager -> refresh

I don't see a refresh. I only see 'start Wamp Server' or on the icon try (the green 'W') I see status for each of the components but I don't see a refresh. Where should I look?

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: RiggsFolly (---.as13285.net)
Date: December 17, 2013 09:59PM

Sorry Kevin I thought there was a link to apachelounge in that howto.

Try [www.apachelounge.com]


EDIT - The Key piece of information in that bit is RIGHT CLICK on the wampmanager icon ( thats the W icon that sits in the system tray )

---------------------------------------------------------------------------------------------
(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-



Edited 2 time(s). Last edit at 12/17/2013 10:43PM by RiggsFolly.

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 17, 2013 10:48PM

You have been most helpful.

OK I think I am almost there. I have been through the instructions that you sent kind of in reverse order since I did Apache first then PHP. Anyway here is my state. I have check marks on the versions of PHP and Apache that I want (5.5.7 and 2.4.7 respectively). The old version of PHP that came with the installer no has a triangle with an exclamation sign in it I am guessing that this version of PHP is no longer compatible with the Apache that I am running (since I am running 2.4.7 comipiled with VC11). Everything seems good to me but the 'W' remains ORANGE. I am not sure where to look for what I missed. Ideas?

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 17, 2013 11:01PM

I tried to start the Apache service directly and then I received some event log information. The error says that there is a syntax error with this line:

LoadModule php5_module "c:/wamp/bin/php/php5.5.7/php5apache2_4.dll"

I cannot see the problem. Can you?

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 17, 2013 11:08PM

I didn't read far enough the event log entry actually says:

The Apache service named reported the following error:
>>> httpd.exe: Syntax error on line 173 of C:/wamp/bin/apache/Apache2.4.7/conf/httpd.conf: Cannot load c:/wamp/bin/php/php5.5.7/php5apache2_4.dll into server: The Apache service named is not a valid Win32 application. .

Why isn't it a valid service? What constitutes a valid service?

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: RiggsFolly (---.as13285.net)
Date: December 18, 2013 01:04AM

Have you installed a 32bit Apache and a 64 bit PHP or a 64bit Apache and a 32 bit PHP.

They must both be compiled the same i.e. both 32 or 64 bit

---------------------------------------------------------------------------------------------
(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: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 18, 2013 01:50AM

Thanks again that was the exact problem. The icon shows green so I guess everything is working. How worried should I be that the x64 builds for PHP are marked 'experimental'?

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 18, 2013 02:04AM

Sorry to keep this thread up but the permissions must have changed for Apache because now I try localhost/moodle26 and I get a 'Forbidden' response. I wasn't getting this before. My config file looks like:

Alias /moodle26 "c:/wamp/apps/moodle26/"

# to give access to moodle26 from outside
# replace the lines
#
# Order Deny,Allow
# Deny from all
# Allow from 127.0.0.1
#
# by
#
# Order Allow,Deny
# Allow from all
#

<Directory "c:/wamp/apps/moodle26/">
Options Indexes FollowSymLinks ExecCGI
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
</Directory>

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: RiggsFolly (---.as13285.net)
Date: December 18, 2013 11:12AM

RE: 64bit builds, Experimental.

Well spotted, you are the first to comment on that. Unfortunately I can't definitively answer that other than to say it bothers me.
It could be that it was a message that was added ages ago and it has been forgotten about and not removed, but I dont know.

I personally use the 32bit code. One obvious reason being that some of the PHP extensions have not actually been converted to 64bit yet. If you find you want to use one of the lesser used and maintained extension you may not find it in 64 bit, but I dont think the reverse applies, and thats my reason for staying 32bit at least for a while yet.


RE: Forbidden

Sorry cannot be much help here, that config looks ok but I never use the aliasing feature.

I personally use Virtual Hosts for all the sites I work on. If you are interested here is my HOWTO VHOST notes.
You are going to have a complete set soon.


HowTo: Create Virtual Hosts in WAMP

BEFORE DOING ANY OF THIS PLEASE ENSURE APACHE AND MYSQL ARE WORKING PROPERLY FIRST!!!

1. Create a new folder outside the wamp directory structure.
for example
C:\websites\www
but this can be on any disk drive visible to the PC running wamp


2. Create a subfolder in c:\websites for each site you want to create.
for example:
C:\websites\www\site1
C:\websites\www\site2


3. Edit the file C:\wamp\bin\apache\apachex.y.z\conf\extra\httpd-vhosts.conf
where x,y and z are the version numbers of apache that you actually have installed.

NOTE: If you are switching between 2 or more versions of apache this will have to be done to all your versions of apache in turn.

SUGGESTION: I like to use the format sitename.dev to make it obvious to me that I am dealing with my localhost development copy of a site, you may prefer another notation, thats ok, the word dev has no actual defined meaning in this case, its just my way of naming my development versions of a live site.

NOTE: Remove ot better still comment out ( using the # in column 1 ) the lines that already exists in this file. They are just examples.

example contents:
	#
	# Use name-based virtual hosting.
	#
	NameVirtualHost *:80

	## must be first so the the wamp menu page loads when you use just localhost as the domain name
	## Also NEVER change the security to anything other than Allow from 127.0.0.1 localhost ::1
	## Then a drive by Ip address hack should return a 403 denied access
    <VirtualHost *:80>
       DocumentRoot "C:/wamp/www"
       ServerName localhost
       ServerAlias localhost
       ## Using Apache 2.2 syntax
       <Directory  "C:/wamp/www">
          Order Deny,Allow
          Deny from all
          Allow from 127.0.0.1 localhost ::1
          ## For every ip in the subnet, just use the first 3 numbers of the subnet
          ## Check you actual subnet for the actual values to use here
          Allow from 192.168.0
       </Directory>

      ## Using Apache 2.4 syntax
      <Directory  "C:/wamp/www">
          Require local
          ## And possibly allow access from you local network
          ## Check you subnet for the actual values to use here
          Require ip 192.168.0
      </Directory>

    </VirtualHost>


	<VirtualHost *:80>
	    DocumentRoot "C:/websites/www/site1"
	    ServerName site1.dev
	    ServerAlias www.site1.dev
	    Options Indexes FollowSymLinks
	    ## Using Apache 2.2 syntax
	    <Directory "C:/websites/www/site1">
			AllowOverride All
			Order Deny,Allow
			Deny from all
			Allow from 127.0.0.1 localhost ::1
		    #If you want to allow access from your internal network
		    # For specific ip addresses add one line per ip address
		    #Allow from 192.168.0.nnn
	    	# For every ip in the subnet, just use the first 3 numbers of the subnet
	    	#Allow from 192.168.0
	    	# If you want to allow access to everyone
	    	#Allow from all
		</Directory>

		## Using Apache 2.4 syntax
	    <Directory "C:/websites/www/site1">
			AllowOverride All
			Require local
		    #If you want to allow access from your internal network
		    # For specific ip addresses add one line per ip address
		    #Require ip 192.168.0.nnn
	    	# For every ip in the subnet, just use the first 3 numbers of the subnet
	    	#Require ip 192.168.0
	    	# If you want to allow access to everyone
	    	#Require all granted
		</Directory>

	</VirtualHost>

Add as many <VirtualHost> as you require so each of your sites have one, changing the DocumentRoot, ServerName and any other of the parameters as appropriate.
This also allows you to make SITE SPECIFIC changes to the configuration.

NOTE: This will make the wamp manager "Put Online" function no longer have any effect on these new vhost'ed sites as the security for each one is now part of the vhost definition, so leave WAMP, OFFLINE.
If you want to put one or more sites online you will have to change the Allow commands MANUALLY in the httpd-vhosts.conf file.

To check your subnet do the following:
Launch a command window, and run
    >ipconfig
Look for the line "Default Gateway" in the output and use the third number in your Allow commands.


4. Edit your httpd.conf file and search for these lines, they are near the bottom of the file.
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf

Remove the '#' comment character on this line to Include your newly changed vhosts, this will cause apache to register their existance.
eg
# Virtual hosts
Include conf/extra/httpd-vhosts.conf

5. While still editing your httpd.conf file search for
	#   onlineoffline tag - don't remove
	    Order Deny,Allow
	    Deny from all
	    Allow from 127.0.0.1

	</Directory>
DO NOT CHANGE THESE LINES!

Add the following after the <\Directory> tag to secure your new C:\websites folder.

<Directory "C:/websites/">
    Order Deny,Allow
    Deny from all
    Allow from 127.0.0.1
</Directory>

This is to set security on your new directory structure so that access to these new sites is only allowed from 127.0.0.1 (localhost) unless amended from within a specific VHOST.
P.S. Your internal network will probably be something like 192.168.x.y, check your system first!


6. Now in order for your browser to know how to get to these new domain names i.e. site1.dev and site2.dev, we need to tell windows what IP address they are located on. There is a file called HOSTS that is a hangover from the days before Domain Name Servers (DNS) were invented. It is a way of giving nice easy rememberable names to IP address's, which of course is what DNS Servers do for us all now.

Edit your HOSTS file, this can be found in C:\windows\system32\drivers\etc , the file does not have an extension.
Windows protects this file so you must be an Administrator to be allowed to save changes to this file.

If you are using VISTA or Windows7/8 you may think you are an Administrator BUT YOU ARE NOT!!!!
So to edit this file you must launch your editor, or Notepad in a specific way to gain Administrator rights. To do this find your editors icon and launch it using the following key strokes:
Shift + Right Click over its icon, this will display a menu, click the item "Run as Administrator", and click "Allow" on the challenge dialog that will appear.

Now you are ready to edit the hosts file so navigate your editor to c:\windows\system32\drivers\etc\hosts

Add the following lines to this file

   127.0.0.1   site1.dev
   127.0.0.1   site2.dev
NOTE: You will need to add one line in this file for each of your new virtual hosts.

Once you have saved these changes you need to make windows refresh its 'domain name - ipaddress cross reference' cache.

To do this launch a command window as an Administrator ( Shift + Left Click over the command window icon ) and run these 2 commands.

>net stop "DNS Client"
>net start "DNS Client"
Note: The quotes are required as there is a space in the services name.



7. In order for Apache to pick up these changes you must bounce ( restart ) apache.
Do this by: Wamp manager -> Apache -> Service -> Restart Service


You should now be able to use the address site1.dev in your browser to get to your new sites.
Copy your sites code into the "C:/websites/xxxx" folder if you already have a site coded or,
place a quick and simple index.php file into the "c:\websites\xxxx" folder to proove it all works.

example:
   <!DOCTYPE html>
   <html lang="en-US">
   <head>
   <meta charset="UTF-8">
   <title>SITE1</title>
   </head>
   <body>
   <?php
        echo '<div style="background-color:red;color;white;text-align:center;font-size:18px">HELLO FROM Site1</div>';
   ?>
   </body>
   </html>



TROUBLE SHOOTING:
If you have used the new domain name ( site1.dev ) and it has not found the site.
a. Check the changes to the hosts file.
b. Restart the "DNS Service" that runs in windows. This caches all doman names that you use in a browser so that the browser does not have to query a DNS Server each time you re-use a domain name. This may have cached your failed attempt but a restart is easy and should solve the problem and is quicker that re-booting windows, which should also work.

---------------------------------------------------------------------------------------------
(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: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 18, 2013 02:45PM

As far as 32-bit versus 64-bit, I kind of went with 64 bit by default. As you saw my initial PHP installation was 32-bit. The only reason that I went to 64-bit PHP was to satisfy the constraint with Apache. So eventually I will probably get a 32-bit Apache and put in a 32-bit PHP.

Thank you for the info in vhosts. I will keep it in mind. Right now I don't want to have too many moving parts so I will stick with alias. I looks like the permission structure is pretty much the same for vhosts. I guess you are not aware of anyway of tellling *why* a client request is denied with forbidden? I can make it work by doing something like:

#
# Controls who can get stuff from this server.
#
Require all granted

In fact if I just add this line (Require all granted) to the directory permissions that I posted earlier I no longer get the Forbidden error. Can I tell what is the name of the user making the request?

But I would like to understand how to set permissions and why the current settings are not working. Like I said it worked before so something changed and the only thing I know of changing was the version of Apache.

What is the connection between php.ini, phpForApache.ini, and the wampserver PHP extension checkboxes. I could not see any changes in php.ini by checking or unchecking the extensions. I changed to 32 bit and it seems that when I add an extension via the wampserver interface it doesn't "take". I can go back and right click and it doesn't seem that the check that I previously set gets set. For example when I invoke phpmyadmin I get the error:

Fatal error: Call to undefined function mb_detect_encoding() in C:\wamp\apps\phpMyAdmin-4.1.0-english\libraries\php-gettext\gettext.inc on line 177

So I stop all services and click on the php_mbstring and php_exif under the php_extensions but it doesn't seem that they get set. I also still get the same error.

If I right click on the php.ini menu under the WAMP manager it seems to try and open a php.ini in Apache2.4.7 folder. Something is wrong.

Right clicking on the WAMP Server localhost and going to phpinfo. I see that the 'Configuration File (php.ini) Path is C:\Windows. This is wrong how should I change it?

Also looking in php.ini in Apache bin folder I see:
.......

extension=php_intl.dll
......

[intl]
intl.default_locale = en_utf8
intl.error_level = E_WARNING

But phpinfo doesn't show the settings? Same with opcache?



Edited 7 time(s). Last edit at 12/18/2013 06:26PM by rkevinburton.

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: RiggsFolly (---.as13285.net)
Date: December 19, 2013 01:39AM

If I right click on the php.ini menu under the WAMP manager it seems to try and open a php.ini in Apache2.4.7 folder. Something is wrong.

This is the correct file, the php.ini shoudl exist in the apache folder.

Right clicking on the WAMP Server localhost and going to phpinfo. I see that the 'Configuration File (php.ini) Path is C:\Windows. This is wrong how should I change it?

Then you have an old config lieing around in C;\windows, DELETE IT, Its probably from when you tried to do all this by installing APache/PHP and MySQL individually and manually.

What is the connection between php.ini, phpForApache.ini, and the wampserver PHP extension checkboxes. I could not see any changes in php.ini by checking or unchecking the extensions. I changed to 32 bit and it seems that when I add an extension via the wampserver interface it doesn't "take". I can go back and right click and it doesn't seem that the check that I previously set gets set. For example when I invoke phpmyadmin I get the error:

The php.ini file in the \wamp\bin\php\phpx.y.z folder is for the PHPCLI ( Command Line interface )

The php.ini in the \wamp\bin\apache\apache.a.b.c\bin folder is what the php used by apache ( i.e. web site access ) should use.

The phpForApache.ini is used when switching versions of Apache and PHP,
When you switch versions of Apache Wamp copies the \wamp\bin\apache\apache.a.b.c\bin\php.ini to the phpForApache.ini file in the \wamp\bin\php\phpx.y.z. Then switches versions of apache and then in the new Apache copies the \wamp\bin\php\phpx.y.z\phpForApache.ini back into the new \wamp\bin\apache\apache.d.e.f\bin\php.ini

Also when you change versions of PHP it does a similiar thing but then creates the php.ini under that apache folder from the phpForApache.ini file in the new version of PHP's php folder.

Or rather it does if you apply the fix [forum.wampserver.com]

---------------------------------------------------------------------------------------------
(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: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.dhcp.mdsn.wi.charter.com)
Date: December 19, 2013 01:53AM

There was no php.ini only a pear.ini (which I removed).

So what consitues a "switch"? Is that when I right click and refresh? The extensions listed on the WAMP manager PHP extensions seem to have nothing to do with the .ini settings. Where is this info stored? When I check or uncheck an extension I don't see a cooresponding change to the .ini file(s).

Thank you.

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: RiggsFolly (---.as13285.net)
Date: December 19, 2013 10:56AM

I assume thats because you are looking at the php.ini file in the wrong place (C:\windows).

Using the wampmanager menus will edit the right php.ini which will be the one in \wamp\bin\apache\apachex.y.z\bin\php.ini of the currently running apache version.

Get rid of the one in c\windows its just messing up WAMP


Switching:
In wamp you can install more than one version of Apache or/and PHP or/and MySQL
Again using the wampmanager menus you can get wamp to switch the currently running version of Apache or PHP or MySQL.

When switching a version of Apache or PHP wamp has to make sure it has the correct php.ini file in the currently active ...apachez.y.x/bin folder. So there is a bit of file copying has to go on behind the scenes to get everything in the right place (not just the php.ini file )

That is what the phpForApache.ini file is used for, its just a store for the ini file that should be used by the apache.

This is quite complex to write about, maybe you would like to install TeamViewer and we could get together on that and I can explain and show you what goes on.

---------------------------------------------------------------------------------------------
(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: Upgrading PHP to 5.5.7?
Posted by: rkevinburton (---.sonicfoundry.com)
Date: December 19, 2013 02:50PM

Like I said there is no php.ini in C:/Windows but phpinfo() does report that the php.ini that is loaded (as opposed to the location) is from the Apache folder. I still am having a hard time reconciling the php.ini and the checks that I select from wampmanager.

If it is not too much trouble I wouldn't mind installing TeamViewer. What do I do?

Options: ReplyQuote
Re: Upgrading PHP to 5.5.7?
Posted by: RiggsFolly (---.as13285.net)
Date: December 19, 2013 06:10PM

Install TeamViewer ( its free ) find it with a google search, then run it.

Do this before attempting a connection.

How to Configure Team Viewer so it does not require port 80 or 443 and therefore get in the way of Apache.

Run TV
Extras -> Options -> Advanced -> Press the Advanced Button -> Advanced Network Connections

Check the checkbox saying [ Dont use incomming port 80 (recommended for web servers only ) ]
Stop and restart TV.

Then
Send me a Private Message containing the TV ID and PASSWORD so I can connect.
Leave TV running as it will change the password each time you restart it.

I am on UK time (GMT).We had better arrange a time that suits us both. I am around this evening after 8 or tomorrow morning.


If you have skype as well we can chat, you can chat through TV but mine is not setup for that ( running it on a VM using Ubuntu and I have not figured out yet how to share all the right resources )

---------------------------------------------------------------------------------------------
(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-



Edited 1 time(s). Last edit at 12/19/2013 06:12PM by RiggsFolly.

Options: ReplyQuote
Pages: 12Next
Current Page: 1 of 2


Sorry, only registered users may post in this forum.