phpMyAdmin - Mostly Resolved

17 posts / 0 new
Last post
#1 Sat, 11/15/2008 - 22:57
tbirnseth

phpMyAdmin - Mostly Resolved

I setup VM to install phpMyAdmin via the default Script Installer for my Virtual Server template.

It copied the full path/directory structure to public_html (not sure why it wants to copy versus a directive to link to the installed location).

However, when I open the page in the browser, the phpMyAdmin index page comes up fine but it does not have any databases configured. There is a database associated with this server (test_com_cart - since ${PREFIX} is broken) and I would have expected the installer to adjust the configuration file(s) appropriately so the user would see their database(s).

What am I missing? I selected the 'Main Database' option for the 'DB name'. Maybe this is wrong.

Is there a reason the whole tree of the home location for phpMyAdmin is copied (rather than referenced) in the public_html directory? Seems that if VM created a config file in the installed directory then either an s-link or an alias might work to keep everything referenced versus copied.

How do I tell it to use the virtual server's databases? I.e. all databases that the user has permissions to see or act on?

thanks, tony<br><br>Post edited by: tbirnseth, at: 2008/11/20 08:01

Sat, 11/15/2008 - 23:09
tbirnseth

Okay, selecting None for the DB name seems to work. Would still like to know if there's a more effecient way of associating phpMyAdmin to a site rather than copying the whole tree to each server's public_html.

Sun, 11/16/2008 - 08:53 (Reply to #2)
andreychek

Well, the way I do that is to offer customers a central page they can go to that offers links to all the services being offered -- Roundcube, Squirrelmail, Usermin, phpMyAdmin, etc etc.

Each of those applications are setup within the primary domain of the server.

And then, I bought an SSL cert for the primary domain I can use for each of those apps.
-Eric
I definitely wouldn't setup a phpMyAdmin instance for each Virtual Server though, that'd be a pain to maintain ;-)

Sun, 11/16/2008 - 10:18 (Reply to #3)
tbirnseth

Can you provide any details on how you set this up by reference?
Let's say I have VM setup with the primary domain as 'root.com' (just an example). Do you mean that you create a virtual server of 'root.com' and then have all the other domains as sub domains within it so they can be aliased to different sub-directories of the parent domain?

I'm new at this so please account for my lack of understanding....

Right now I have each domain being created as a separate virtual server with an alias setup to another top-level domain on the server. I.e. I have 'root.com' and 'test.com'. I have it setup so that an alias is created for 'test.root.com' for each new virtual server that is created.

Are you saying that I can then just add phpMyAdmin to 'root.com' and then do a rewrite rule that says something like: &quot;if file accessed is 'test.com/phpmyadmin' then redirect to 'root.com/phpmyadmin'?

Sorry if this is long and may not use terms correctly....

tony

Sun, 06/07/2009 - 07:32 (Reply to #4)
andreychek

Hey Tony,

Well, what you're saying is fairly close to what I have setup.

I did indeed make root.com a Virtual Server -- and I setup phpMyAdmin within it (amongst some others).

But no other domains are sub-servers of it.

So, let's say I go to create a new Virtual Server (test.com) -- I set it up to create a DNS CNAME for phpmyadmin.test.com (which I configured in the DNS Server Template).

At that point, if I were to browse to phpmyadmin.test.com, since it's not currently aliased to any Virtual Host, I'd end up viewing the default Virtual Host, which I setup to be root.com (to make it the default, it just has to be the first Virtual Host listed in the Apache config).

Then, I edited the Apache Virtual Host config for root.com, and added this:

RewriteCond %{HTTP_HOST} ^phpmyadmin\..*$ [NC]
RewriteRule ^(.*) https://root.com/phpmyadmin/

That says that anytime a URL beginning with &quot;phpmyadmin.&quot; is seen, to redirect to &quot;https://root.com/phpmyadmin&quot;.

And that's it -- now, anytime a new Virtual Server is added -- it creates a DNS CNAME for phpmyadmin, and whenever they go to it, it redirects to the central phpMyAdmin install in root.com.
-Eric

Sun, 06/07/2009 - 07:32 (Reply to #5)
andreychek

Hey Tony,

Well, what you're saying is fairly close to what I have setup.

I did indeed make root.com a Virtual Server -- and I setup phpMyAdmin within it (amongst some others).

But no other domains are sub-servers of it.

So, let's say I go to create a new Virtual Server (test.com) -- I set it up to create a DNS CNAME for phpmyadmin.test.com (which I configured in the DNS Server Template).

At that point, if I were to browse to phpmyadmin.test.com, since it's not currently aliased to any Virtual Host, I'd end up viewing the default Virtual Host, which I setup to be root.com (to make it the default, it just has to be the first Virtual Host listed in the Apache config).

Then, I edited the Apache Virtual Host config for root.com, and added this:

RewriteCond %{HTTP_HOST} ^phpmyadmin\..*$ [NC]
RewriteRule ^(.*) https://root.com/phpmyadmin/

That says that anytime a URL beginning with &quot;phpmyadmin.&quot; is seen, to redirect to &quot;https://root.com/phpmyadmin&quot;.

And that's it -- now, anytime a new Virtual Server is added -- it creates a DNS CNAME for phpmyadmin, and whenever they go to it, it redirects to the central phpMyAdmin install in root.com.
-Eric

Sun, 11/16/2008 - 21:08
tbirnseth

Hi Eric,

Thanks for the concise and precise description...
Isn't this basically what the aliasing is supposed to do in VM? I haven't started playing with aliasing yet but it seems that is close to what it does without having to modify the DNS records. But I can do this if I can't figure out the aliasing part...

thanks again...

tony

Sun, 11/16/2008 - 23:16 (Reply to #7)
tbirnseth

Okay, I set things up as you indicated for phpmyadmin and for roundcube. It seems to redirect properly (physically) but phpmyadmin gives me an &quot;you don't have permission to access /phpmyadmin/ on this server&quot; message. I am not using https, but only http in the rewrite rule. Could this be the culprit?

Also, I would have thought I'd have an email in the inbox in roundcube from the server creation. But there's nothing.

Interesting though since I have 'test.com' setup as an alias for 'test.ez-ms.com', the &quot;Sent From&quot; in roundcube is showing 'test@test.ez-ms.com' but when the test message arrived, it was from 'test@test.com'.... Any idea why it's seeing the aliased server?

I want to create alias servers for each domain created so clients can access their sites before DNS is turned on.

toughts?

tony

Mon, 11/17/2008 - 05:11 (Reply to #8)
andreychek

Well, you're right, and there's certainly plenty of ways to accomplish this, there definitely isn't just one.

If you'd rather create an alias domain -- I don't believe Virtualmin can do that &quot;automatically&quot;, but you can accomplish that by setting up a CNAME in the DNS template, and a ServerAlias entry in the Apache template.

As for the trouble you're having with phpMyAdmin -- no, whether you're using http or https shouldn't matter.

I'd ignore the redirect for a moment, and just try going directly to root.com/phpmyadmin/ -- and assuming that errors, look in Apache's error log to try and troubleshoot the issue (it's in the logs dir associated with root.com).
-Eric

Sun, 06/07/2009 - 07:32 (Reply to #9)
tbirnseth

No I can't get to it via www.root.com/phpmyadmin or via phpmyadmin.test.com.

The error in the error log is pretty generic:
[code:1]
[Mon Nov 17 01:24:51 2008] [error] [client 192.168.101.114] client denied by server configuration: /usr/share/phpMyAdmin/
[/code:1]
So I'm assuming it is something in my httpd.conf. The relevant piece (the virtual server for root.com) looks like below. I have no idea where the issue might lie. Hopefully my cut/paste is accurate.

tony
[code:1]
&lt;VirtualHost 192.168.101.2:80&gt;
SuexecUserGroup &quot;#503&quot; &quot;#504&quot;
ServerName root.com
ServerAlias www.root.com
ServerAlias webmail.root.com
ServerAlias admin.root.com
ServerAlias lists.root.com
ServerAlias email.root.com
ServerAlias phpmyadmin.root.com
DocumentRoot /home/root.com/public_html
ErrorLog &quot;|/etc/webmin/virtual-server/writelogs.pl 12269081376352 /home/root.com/logs/error_log&quot;
CustomLog &quot;|/etc/webmin/virtual-server/writelogs.pl 12269081376352 /home/root.com/logs/access_log&quot; combined
ScriptAlias /cgi-bin/ /home/root.com/cgi-bin/
ScriptAlias /awstats /home/root.com/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
&lt;Directory /home/root.com/public_html&gt;
Options -Indexes IncludesNOEXEC FollowSymLinks ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/root.com/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/root.com/fcgi-bin/php5.fcgi .php5
&lt;/Directory&gt;
&lt;Directory /home/root.com/cgi-bin&gt;
allow from all
&lt;/Directory&gt;
&lt;Directory /home/root.com/public_html/phpmyadmin&gt;
allow from all
&lt;/Directory&gt;
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.root.com
RewriteRule ^(.*) https://root.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.root.com
RewriteRule ^(.*) https://root.com:10000/ [R]
RewriteCond %{HTTP_HOST} ^phpmyadmin..*$ [NC]
RewriteRule ^(.*) http://root.com/phpmyadmin/
RewriteCond %{HTTP_HOST} ^email..*$ [NC]
RewriteRule ^(.*) http://root.com/roundcube/
RemoveHandler .php
RemoveHandler .php5
IPCCommTimeout 31
IPCCommTimeout 31
&lt;Files awstats.pl&gt;
AuthName &quot;root.com statistics&quot;
AuthType Basic
AuthUserFile /home/root.com/.awstats-htpasswd
require valid-user
&lt;/Files&gt;
PerlRequire /etc/webmin/virtualmin-google-analytics/apachemod.pl
PerlOutputFilterHandler Virtualmin::GoogleAnalytics
Alias /dav /home/root.com/public_html
Alias /pipermail /var/lib/mailman/archives/public
&lt;Location /dav&gt;
DAV On
AuthType Basic
AuthName root.com
AuthUserFile /home/root.com/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RemoveHandler .php
RemoveHandler .php5
&lt;/Location&gt;
RedirectMatch /cgi-bin/mailman/([^/]*)(.*) https://root.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/]*)(.*) https://root.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
&lt;Location /svn&gt;
DAV svn
SVNParentPath /home/root.com/svn
AuthType Basic
AuthName root.com
AuthUserFile /home/root.com/etc/svn.basic.passwd
Require valid-user
AuthzSVNAccessFile /home/root.com/etc/svn-access.conf
Satisfy Any
&lt;/Location&gt;
php_value memory_limit 32M
&lt;/VirtualHost&gt;

[/code:1]

Sun, 06/07/2009 - 07:32 (Reply to #10)
tbirnseth

No I can't get to it via www.root.com/phpmyadmin or via phpmyadmin.test.com.

The error in the error log is pretty generic:
[code:1]
[Mon Nov 17 01:24:51 2008] [error] [client 192.168.101.114] client denied by server configuration: /usr/share/phpMyAdmin/
[/code:1]
So I'm assuming it is something in my httpd.conf. The relevant piece (the virtual server for root.com) looks like below. I have no idea where the issue might lie. Hopefully my cut/paste is accurate.

tony
[code:1]
&lt;VirtualHost 192.168.101.2:80&gt;
SuexecUserGroup &quot;#503&quot; &quot;#504&quot;
ServerName root.com
ServerAlias www.root.com
ServerAlias webmail.root.com
ServerAlias admin.root.com
ServerAlias lists.root.com
ServerAlias email.root.com
ServerAlias phpmyadmin.root.com
DocumentRoot /home/root.com/public_html
ErrorLog &quot;|/etc/webmin/virtual-server/writelogs.pl 12269081376352 /home/root.com/logs/error_log&quot;
CustomLog &quot;|/etc/webmin/virtual-server/writelogs.pl 12269081376352 /home/root.com/logs/access_log&quot; combined
ScriptAlias /cgi-bin/ /home/root.com/cgi-bin/
ScriptAlias /awstats /home/root.com/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
&lt;Directory /home/root.com/public_html&gt;
Options -Indexes IncludesNOEXEC FollowSymLinks ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/root.com/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/root.com/fcgi-bin/php5.fcgi .php5
&lt;/Directory&gt;
&lt;Directory /home/root.com/cgi-bin&gt;
allow from all
&lt;/Directory&gt;
&lt;Directory /home/root.com/public_html/phpmyadmin&gt;
allow from all
&lt;/Directory&gt;
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.root.com
RewriteRule ^(.*) https://root.com:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.root.com
RewriteRule ^(.*) https://root.com:10000/ [R]
RewriteCond %{HTTP_HOST} ^phpmyadmin..*$ [NC]
RewriteRule ^(.*) http://root.com/phpmyadmin/
RewriteCond %{HTTP_HOST} ^email..*$ [NC]
RewriteRule ^(.*) http://root.com/roundcube/
RemoveHandler .php
RemoveHandler .php5
IPCCommTimeout 31
IPCCommTimeout 31
&lt;Files awstats.pl&gt;
AuthName &quot;root.com statistics&quot;
AuthType Basic
AuthUserFile /home/root.com/.awstats-htpasswd
require valid-user
&lt;/Files&gt;
PerlRequire /etc/webmin/virtualmin-google-analytics/apachemod.pl
PerlOutputFilterHandler Virtualmin::GoogleAnalytics
Alias /dav /home/root.com/public_html
Alias /pipermail /var/lib/mailman/archives/public
&lt;Location /dav&gt;
DAV On
AuthType Basic
AuthName root.com
AuthUserFile /home/root.com/etc/dav.digest.passwd
Require valid-user
ForceType text/plain
Satisfy All
RemoveHandler .php
RemoveHandler .php5
&lt;/Location&gt;
RedirectMatch /cgi-bin/mailman/([^/]*)(.*) https://root.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
RedirectMatch /mailman/([^/]*)(.*) https://root.com:10000/virtualmin-mailman/unauthenticated/$1.cgi$2
&lt;Location /svn&gt;
DAV svn
SVNParentPath /home/root.com/svn
AuthType Basic
AuthName root.com
AuthUserFile /home/root.com/etc/svn.basic.passwd
Require valid-user
AuthzSVNAccessFile /home/root.com/etc/svn-access.conf
Satisfy Any
&lt;/Location&gt;
php_value memory_limit 32M
&lt;/VirtualHost&gt;

[/code:1]

Mon, 11/17/2008 - 06:17
andreychek

I suspect something on your system is hijacking the phpMyAdmin request -- as it's trying to use a phpMyAdmin installed in /usr/share/phpMyAdmin, but that's not what you setup so far as I can see.

For example, if you have phpMyAdmin installed with your distro, that could happen.

I'd look in your Apache configs and see if you can find the culprit. I'm guessing you're running CentOS or RHEL, so look in /etc/httpd/conf.d, and see if any of those files make a reference to phpMyAdmin. If so, either comment them out, or move the file somewhere else, then restart Apache.
-Eric

Mon, 11/17/2008 - 09:09 (Reply to #12)
tbirnseth

The only reference in httpd.conf is for the root.com domain and it references only the instance that's within it's public_html/phpmyadmin directory.

Yes, Fedora 8 comes with phpMyAdmin installed in /usr/share.

I will uninstall it and see what happens.

thanks,
tony

Mon, 11/17/2008 - 09:14 (Reply to #13)
tbirnseth

Perfect, that worked. I will get an SSL cert when I move this to production, but other than that, all is well.

Any thoughts on why roundcube sees the 'send from' address as the user within an aliased domain? I.e. 'test@test.ez-ms.com' versus 'test@test.com'?

Mon, 11/17/2008 - 09:43 (Reply to #14)
andreychek

I don't recall how exactly RoundCube chooses what address to use when sending a message -- but you can change it by logging into RoundCube, going into preferences, and changing the From address.

I do recall there being a mention of a RoubdCube plugin for Virtual Hosting that may help cases like this.

It looks like there's some discussion of it here:

http://www.virtualmin.com/forums/virtualmin/imap-addresses-picking-up-se...

I haven't tried that, but if you're interested in tinkering with it a bit, let us know how it goes!
-Eric

Mon, 11/17/2008 - 11:17 (Reply to #15)
tbirnseth

It appears from the roundcube config file that it is using /etc/postfix.virtual for translation.

This file looks a little like a mess so I'm not sure how VM updates it and cleans it up. I've deleted/created test.com so many times, even the smallest bug would end up severely compounded.

I tried it on another domain that hasn't been created/deleted so often. The return address looks reasonable 'ezms@ez-ms.com'. However, when I try to send an email to ezms@ez-ms.co it gets returned as undeliverable stating &quot;&lt;ezms@ez-ms.com&gt;: User unknown in virtual alias table&quot;.

When I look at /etc/postfix/virtual, it has entries (in this order) like this for 'ezms'.
[code:1]
ezms ezms@ez-ms.com
ezms@ez-ms.com ezms
ez-ms.com ez-ms.com
[/code:1]

Assuming this is a linear parser (resolves first, the lookup/resolve 2nd, etc.) that would imply that user 'ezms' has an email address of 'ezms@ez-ms.com' (which is correct). Next it encounters 'ezms@ez-ms.com' and relates it to 'ezms' (still good since that should resolve to 'ezms@ez-ms.com'). And finallly it reaches 'ez-ms.co' which resolves to the same thing. So all &quot;should&quot; be well and that's why the From address in composed mail is okay.

I have no idea why mail can't be sent to 'ezms@ez-ms.com' considering the above defintions. Working backward (for receipt) it should end up resolving to user 'ezms' which should enable delivery.

I have no clue and don't believe the sent mail has anything to do with roundcube at that level. Any postfix experts care to comment?

thanks,
tony

Mon, 12/05/2016 - 07:41
tvshub
tvshub's picture

CentOS 7.2 - Virtualmin Pro - installed on or about 11/2016. Trying to get phpMyAdmin installed. I tried to install the latest version as listed in the Virtualmin's 'Install scripts' dropdown -- phpmyadmin 4.6.5.1 but it said no - my php wasn't up to snuff although update routine claimed no updates available. So I tried to install the next older 'stable' version of phpmyadmin 4.4.15.9. That installed without errors, but gave me nothing for a login page - only html error can't display web page (security failure as it were I suppose) and after some tweaking the .conf files I got the "page of php code" misfire. Tried every recommended .conf solution on the web to no avail. But my solution was actually very simple. Went and fetched this version of php - PHP 5.6.28 (one higher than I had at the time php -- 5.4) Even though the system updater refused to work with me, I just manually PuTTy installed the newer (not the newest, btw) php and then the latest phpmyadmin 4.6.5.1 thru VirtualAdmin script installer - and the problem is resolved. I fetched the package at php.net - there's more newer versions, but I didn't want to jump too far ahead. In the end, there was no need to adjust any of the phpmyadmin conf settings, Just download, untar, install a newer php - I did it remote using PuTTy.

Tim Vger

Topic locked