Virtual Host set-up issues
Posted by: earlforfar (---.storm.ca)
Date: July 31, 2014 12:03AM

Windows 7 Prof. SP1
Wamp 2.5
Apache 2.4.9
MYSQL 5.6.17
PHP 5.5.12

Manager Icon = Orange

Looking for help with following:
I am working through the posted "How to create Virtual Host" but seem to have a couple of errors I can't track down.
Running - D:\wamp\bin\apache\apache2.4.9\bin>httpd -S

Resulted in - httpd: Syntax error on line 513 of D:/wamp/bin/apache/apache2.4.9/conf/httpd.conf:
Syntax error on line 48 of D:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:
Expected </Directory> but saw </VirtualHost>


D:/wamp/bin/apache/apache2.4.9/conf/httpd.conf:
#Virtual hosts
Include conf/extra/httpd-vhosts.conf ..................<<<Line 513



D:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:
<VirtualHost *:80>
DocumentRoot "d:/wamp/www"
ServerName localhost
ServerAlias localhost
<Directory "d:/wamp/www">
AllowOverride All
Require local
<Directory>
</VirtualHost> ...............................<<<Line 48

<VirtualHost *:80>
DocumentRoot "d:/wamp/www/Family_Connections"
ServerName Family_Connections
<Directory "d:/wamp/www/Family_Connections">
AllowOverride All
Require local
<Directory>
</VirtualHost>

Tks for any help available

Options: ReplyQuote
Re: Virtual Host set-up issues
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 31, 2014 12:39AM

The <Directory> tag has a start and an end so <Directory ......> ... </Directory>

You are missing the </Directory> and have coded andother <Directory>

Try this :-

D:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:
<VirtualHost *:80>
   DocumentRoot "d:/wamp/www"
   ServerName localhost
   ServerAlias localhost
   <Directory "d:/wamp/www">
        AllowOverride All
        Require local
   </Directory>
</VirtualHost> ...............................<<<Line 48

<VirtualHost *:80>
   DocumentRoot "d:/wamp/www/Family_Connections"
   ServerName Family_Connections
   <Directory "d:/wamp/www/Family_Connections">
        AllowOverride All
        Require local
   </Directory>
</VirtualHost>

---------------------------------------------------------------------------------------------
(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: Virtual Host set-up issues
Posted by: earlforfar (---.storm.ca)
Date: July 31, 2014 01:26AM

Thanks, that got me back to Green wampmanager. Feel kind of stupid, sometimes can't see the wood for the trees.
Ran httpd -S again with following result:

D:\wamp\bin\apache\apache2.4.9\bin>httpd -S
VirtualHost configuration:
*:80 is a NameVirtualHost
default server localhost (D:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:40)
port 80 namevhost localhost (D:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:40)
alias localhost
port 80 namevhost Family_Connections (D:/wamp/bin/apache/apache2.4.9/conf/extra/httpd-vhosts.conf:50)
ServerRoot: "D:/wamp/bin/apache/apache2.4.9"
Main DocumentRoot: "D:/wamp/www/"
Main ErrorLog: "D:/wamp/logs/apache_error.log"
Mutex default: dir="D:/wamp/bin/apache/apache2.4.9/logs/" mechanism=default
Mutex rewrite-map: using_defaults
PidFile: "D:/wamp/bin/apache/apache2.4.9/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
Define: APACHE24=Apache2.4

D:\wamp\bin\apache\apache2.4.9\bin>

Is there something more to do.?
A.. I notice that selecting localhost from wampserver there is no connection to displayed database
B.. There is no connection from database displayed under MyProjects
C.. There is no connection from database displayed under Virtual Hosts
D.. In fact the only connection of any sort seems to be to the tables under phpMyAdmin

Any further help would be appreciated
Tks

Options: ReplyQuote
Re: Virtual Host set-up issues
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 31, 2014 10:48AM

Your httpd -S looks OK


Is there something more to do.?
A.. I notice that selecting localhost from wampserver there is no connection to displayed database

Dont exactly follow this one! You create/view databases using phpMyAdmin

B.. There is no connection from database displayed under MyProjects

No there is not and should not be.

C.. There is no connection from database displayed under Virtual Hosts

Ditto

D.. In fact the only connection of any sort seems to be to the tables under phpMyAdmin

Correct


If phpMyAdmin can see the database then thats all you really need, but you can install any other tool that you like to aid in the design/development of database as long as it plays with MySQL.
I use MySQL Workbench. But if you try this, be careful to download only the workbench as one option will install another MySQL server and that will only server (pun intended) to confuse the issue.

There is a little script in \wamp\www\testmysql.php you can use to prove the connection between PHP and MySQL works.
You need to edit it to amend the parameters of the mysql_connect() function, like so


1. If you have not yet added a password to the root userid
<?php 
//$link = mysql_connect('hostname','dbuser','dbpassword'); 
$link = mysql_connect('127.0.0.1','root',''); 
if (!$link) { 
	die('Could not connect to MySQL: ' . mysql_error()); 
} 
echo 'Connection OK'; mysql_close($link); 
?>

2. If you have added a password to the root userid
<?php 
//$link = mysql_connect('hostname','dbuser','dbpassword'); 
$link = mysql_connect('127.0.0.1','root','YOUR_PASSWORD'); 
if (!$link) { 
	die('Could not connect to MySQL: ' . mysql_error()); 
} 
echo 'Connection OK'; mysql_close($link); 
?>

Then run it like this 'localhost/testmysql.php' (without the quotes)

This will actually test 2 things

1. That you can connect with PHP to MySQL, when you see Connection OK

2. That XDEBUG is working, as in PHP5.5.x the mysql_* extension, which this little tester uses, gives a depreceated message ( its not an error, just a informational warning).
If nothing else it serves as a warning/reminder not to use the mysql_* extension for any new code and to learn either mysqli_* or PDO.





---------------------------------------------------------------------------------------------
(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: Virtual Host set-up issues
Posted by: earlforfar (---.storm.ca)
Date: July 31, 2014 04:45PM

RiggsFolly
Thanks a million - Did as you suggested and got the "Connection OK".
What has thrown me is that after going through all the trouble of creating Virtual Host - If you look at the Windows directory structure we have a new directory added outside of Wamp called Websites with a sub of example.com. However the original www directory within wamp still contains the database and etc.
Should I have another directory 'mydatabase.com' under Websites containing all the info presently under 'wamp/www/mydatabase
Tks

Options: ReplyQuote
Re: Virtual Host set-up issues
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 31, 2014 05:26PM

Well you can move that databases to another place but it is not necessary.

As long as you remember that they are in \wamp\bin\mysql\mysqlx.y.z/data
If they are MYISAM databases then the data is held in sub folders of that where the subfolder is named after the database.


If they are INNODB databases, well it depends on how you configure the databases really. If you want to use INNODB you MUST read up on them on the MYSQL site, link provided on your WAMPServer homepage. They are a bit more complicated, and you are gona need to learn about backing up and recovering etc. A whole new bag of worms for you.

---------------------------------------------------------------------------------------------
(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: Virtual Host set-up issues
Posted by: earlforfar (---.storm.ca)
Date: August 01, 2014 02:38AM

Many THANKS RiggsFolly for all your help

I guess this could be closed now

Options: ReplyQuote


Sorry, only registered users may post in this forum.