Re: Trouble connecting virtual host to MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Date: Saturday, April 09, 2016 15:18:04 +0200
> From: Roparzh Hemon <roparzhhemon@xxxxxxxxx>
>
>   Some time ago, some people on this list helped  me setting
> up virtual hosts on my Mac.
>   Everything worked fine until I started adding MySQL stuff to
> my website ; then something strange started to happen : the MySQL
> is correctly found and displayed if I apply some curious workaround,
> but not if I do things the normal way.
> 
>   Here are the relevant details : My /private/etc/hosts file
> contains the following lines :
> 
> 127.0.0.1 localhost
> 127.0.0.1 localmicael.com www.localmicael.com
> ::1             localhost
> 
> My /private/etc/apache2/extra/httpd-vhosts.conf contains the
> following lines :
> 
> <VirtualHost *:80>
>     ServerName localmicael.com
>     ServerAlias www.localmicael.com
>     DocumentRoot
> "/Users/myusernamehere/Documents/Sites/Mikeal/public_html"
> ErrorLog "/private/var/log/apache2/localmicael.com-error_log"
> CustomLog "/private/var/log/apache2/localmicael.com-access_log"
> common     ServerAdmin web@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
>     LoadModule php5_module /usr/libexec/apache2/libphp5.so
> <Directory /Users/myusernamehere/Documents/Sites/Mikeal/public_html>
> Require all granted
> DirectoryIndex index.php
> </Directory>
> </VirtualHost>
> 
> If I type localhost:8888/Mikeal in my browser, the index page is
> displayed correctly.
> If I type http://www.localmicael.com, however, I get an error
> message telling me the MySQL database could not be found.
> 
> How can I fix this ? Any help appreciated.
>

You are (likely) getting to two different places with these requests.

The url: <http://www.localmicael.com> is getting you to
"Mikeal/public_html", while [<http://]localhost:8888/Mikeal> is
probably getting you to the level above. Exactly what is going on is
somewhat obscured because you don't show the configuration for your
server at ":8888". Also is "Mikeal/public_html" a directory or a
file? It should be a directory.

In short, you should look at what you have in your "index.php"
file(s) that you are reaching. This isn't really an apache issue,
rather you seem to have two virtual hosts configured (one at :80 and
one at :8888) and the php files have different references for mysql.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux