Page 1 of 2

(solved) Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 7:07 am
by bowlesj
This is solved. Two solutions: fix up the phpMyAdmin.conf and fix up the php.ini. It would not surprise me that this may have been caused by a hack. I say this because of my viewing of the Apache log and some of the errors I was seeing. However I do not know enough about this to know if this is true.

Hi, I have a problem accessing phpMyAdmin on the web host even though I can successfully; 1/ log into the webhost via Putty and winSCP, 2/ I can access my website, 3/ I can see the data in my website showing that mysql is working. All along I have been accessing phpMyAdmin by keying in (on the browser) "MyIpAddress/phpMyAdmin/" and I have never had a problem. When I do this now I get nothing (the browser page stays white and it has a very quick reaction then acts as if I did nothing). If I click the browser refresh button I get the same reaction. Yesterday I was tightening up my home firewall but when I had this problem I decided to set the home firewall back to the defaults. After doing this everything described above is the same. If I enter "MyIpAddress/phpMyAdmi" (removing the last letter "n") I get "The requested URL /phpMyAdmi was not found on this server.". So that proves it is finding phpMyAdmin on my website but nothing is happening (blank page). So I guess that rules out all posibility that it has anything to do with my firewall. I did install "Fail2ban" but I can't see how this would have any effect unless it is changing my calling IP address somehow. I tried stopping fail2ban temporarily and this had no impact so I immediately turned fail2ban back on. At this point the only thing I can think to try is Google Search "cannot access phpmyadmin on webhost". So far they all mention a specific error coming up as opposed to my blank screen with no message. I changed the google search to "phpmyadmin gives blank page". He suggests debugging. I guess I will continue in that direction and keep posting links below that I find which may help. In the mean time, does anyone have any suggestions?

Thanks,
John

Ongoing Debugging and results so far from Links I have found so far with Google: "Debugging phpMyAdmin".
https://avastechnology.wordpress.com/ta ... hpmyadmin/
1/ Tried putting an echo and exit statement at the top of /usr/share/phpMyAdmin/index.php and it did not show. Conclusion is that this script is not being called.
2/ tried restarting apache. Same result in the previous test.
3/ I ran "yum remove phpmyadmin" then "yum install phpmyadmin" and both of these worked with no errors. However I still get the blank page.
4/ I put the echo and exit statements back in the top two lines of the /usr/share/phpMyAdmin/index.php file and I still get the blank page.
5/ Tried turning off the filewall on one machine at home (did a reboot after) but same blank page result (turned the firewall back on).
6/ I changed the name of the /usr/share/phpMyAdmin/index.php file to /usr/share/phpMyAdmin/index2.php and I get this message "forbidden You don't have permission to access /phpMyAdmin/ on this server."
7/ Okay so it is finding the /usr/share/phpMyAdmin/index.php but it can not execute it since it will not even display an echo statement at the very top.
8/ changed it back to index2.php and included that in the URL in the browser and it gets a blank page.
Conclusion: for sure it is finding the file but it executes it as a blank page or does not actually execute it. Permissions are RW and R and R.
9/ left index.php alone and created a brand new index2.php in the same directory /usr/share/phpMyAdmin/. It contains (echo "Hello";) without the round brackets (result blank page)not display.

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 8:50 am
by Celauran
You're able to access the server over SSH, so you should be able to tunnel in that way and connect to your DB with something like HeidiSQL. Not a solution, for sure, but a workaround if you need database access in the interim. Also, I'd flush all iptables rules and try with another browser with all cookies cleared.

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 9:16 am
by bowlesj
Hi Celauran, thanks for your suggestions. I think it must be the firewall. I should have left it alone. I ran phpMyAdmin on local host and the xampp program told me I need to turn on part of the firewall (it had it right on the screen to do this) and when I did that the phpMyAdmin on local host worked. I got the firewall working on Thursday night about 8pm and the next morning I was able to use phpMyAdmin on the web host. I just tried turning of iptables off with "service iptables stop" and running the phpMyAdmin but I get the same blank screen. So I have turned the Iptables back on and turned fail2ban back on. Everything is starting to point at the fire wall changes. It is strange that if I shut the fire wall off completely I get the same result and also strange that I can get at my website and that it finds the phpMyAdmin index.php file. The other thing I tried is calling phpMyAdmin from firefox and I get the same result. I am running 3 computers (two xp and one win7) and I get the same result on all machines regardless of browser. I even installed firefox on the xp machine I don't normally use and I get the same blank screen for phpMyAdmin. Maybe the firewall changes effected the 2 wire modem settings?

I just double checked the firewall on the xp machine I seldom use. I made very few changes to that firewall (turned off a few exceptions). I turned them back on and rebooted and I still get the blank page for phpmyadmin.

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 9:30 am
by Celauran
Have you checked the network tab in Firefox to see what HTTP code comes back? Have you checked Apache and PHP logs for possible errors there?

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 9:34 am
by bowlesj
I will try those things. Thanks.

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 9:41 am
by bowlesj
Okay, I used google to find the network monitor in Firefox. When I do a reload on my website home page I get a size back of 37.19kb. However when I do this with the phpMyAdmin page I get zero size. I will try the other things now.

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 9:49 am
by bowlesj
I found the apache logs. This is the error.
[Sun Mar 29 10:48:36 2015] [error] [client MyIpAddress] PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
[Sun Mar 29 10:48:36 2015] [error] [client MyIpAddress] PHP Fatal error: Unknown: Failed opening required '/usr/share/phpMyAdmin/index.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0
The access_log
MyIpAddress - - [29/Mar/2015:10:32:00 -0400] "GET / HTTP/1.1" 200 38087 "-" "Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0"
MyIpAddress - - [29/Mar/2015:10:32:02 -0400] "GET /favicon.ico HTTP/1.1" 404 288 "-" "Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0"
MyIpAddress - - [29/Mar/2015:10:32:14 -0400] "GET /phpMyAdmin/ HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 5.1; rv:36.0) Gecko/20100101 Firefox/36.0"
MyIpAddress - - [29/Mar/2015:10:35:08 -0400] "GET /phpMyAdmin/ HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0"
MyIpAddress - - [29/Mar/2015:10:38:01 -0400] "GET /phpMyAdmin/ HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0"
MyIpAddress - - [29/Mar/2015:10:38:07 -0400] "GET /phpMyAdmin/ HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0"
MyIpAddress - - [29/Mar/2015:10:39:36 -0400] "GET /phpMyAdmin/ HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0"
MyIpAddress - - [29/Mar/2015:10:48:34 -0400] "GET /phpMyAdmin/ HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36"
MyIpAddress - - [29/Mar/2015:10:48:36 -0400] "GET /phpMyAdmin/ HTTP/1.1" 500 - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36"

I tried opening the permissions on this file wide open a while back "chmod 777 index.php" but it did nothing. So I set it back.

I could try going offsite with my notebook. I am not really in a super rush. I did a backup with mysqldump and brought it down to my home. I use phpMyAdmin a lot however.

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 10:06 am
by bowlesj
I tried copying that index.php file to /var/www/html/index2.php where my webpages are then I tried to get at it directly and it goes the same thing (blank page).

However it gave a different error. Maybe the details of this error help.
[Sun Mar 29 11:05:29 2015] [error] [client MyIpAddress] PHP Warning: require_once(libraries/common.inc.php): failed to open stream: No such file or directory in /var/www/html/index2.php on line 12
[Sun Mar 29 11:05:29 2015] [error] [client MyIpAddress] PHP Fatal error: require_once(): Failed opening required 'libraries/common.inc.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/index2.php on line 12

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 10:08 am
by Celauran
HTTP code 500 suggests there's something wrong with the PMA install itself. Could be .htaccess, could be something with the index.php itself. Anything in the PHP log?

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 10:09 am
by bowlesj
See the above test Celauran. Not sure if it gives clues. I will go after the php log now.

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 10:14 am
by Celauran
You moved just the index file? It's complaining of being unable to locate required resources, which isn't entirely surprising if that's the case. You should see some entries for requests to /phpMyAdmin as well.

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 10:20 am
by bowlesj
This is interesting. I checked the php.ini file and it has log_errors on. I am pretty sure I turned that on. So I found the file as shown below but there is no such file. However my error handling routine has sent me a fair number of emails and I used that to get the website up and running and to fix several bugs. The thing that is strange is on the local host I am pretty sure the error also went to the error log.

log_errors = On
error_log=/var/log/httpd/php_scripts_error.log

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 10:24 am
by bowlesj
Regarding
could be something with the index.php itself
I don't think so because I created my own special index2.php in the same directory to test this (see below). It too was blank. I could try reading it again and check the log.
<php
echo "hello";
?>
[Sun Mar 29 11:27:45 2015] [error] [client MyIpAddress] PHP Warning: Unknown: open_basedir restriction in effect. File(/usr/share/phpMyAdmin/index2.php) is not within the allowed path(s): (/var/www/html/) in Unknown on line 0
[Sun Mar 29 11:27:45 2015] [error] [client MyIpAddress] PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0
[Sun Mar 29 11:27:45 2015] [error] [client MyIpAddress] PHP Fatal error: Unknown: Failed opening required '/usr/share/phpMyAdmin/index2.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0
I will google this error!
PHP Warning: Unknown: open_basedir restriction in effect


first google hit talks about it.
http://www.templatemonster.com/help/ope ... ths-y.html

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 10:44 am
by bowlesj
I changed the php.ini to have this: "open_basedir="/var/www/html/:/usr/share/phpMyAdmin/" and I get the error below. So now it can find it (at least it is not blank). I will reread solution #1.
Forbidden You don't have permission to access /phpMyAdmin/index2.php on this server. Apache/2.2.3 (CentOS) Server at 104.234.218.70 Port 80
The "/etc/httpd/conf/httpd.conf" files does not have a "php_admin_value open_basedir" directive? So I am not sure where I would put the command the webpage is suggesting. "php_admin_value open_basedir none"

Currently looking at this link for a person that has this same error (modified the google search to include "phpMyAdmin". Get back to it after lunch.
https://www.howtoforge.com/community/th ... ect.61333/

Re: Cannot access phpMyAdmin on web host vsp

Posted: Sun Mar 29, 2015 1:04 pm
by bowlesj
I updated my /etc/httpd/conf.d/phpMyAdmin.conf file with this "Allow from MyIpAdress" (as shown below) to get past an error with not being authorized (not sure how that started today).

<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
# Apache 2.4
Require local
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from MyIpAddress
Allow from ::1
</IfModule>
</Directory>
So that got me back to the original error and this seems to be the best bet (the last post).
https://www.howtoforge.com/community/th ... ect.61333/
However I am not sure where to put the path in. I have to stop for a while. Will look at it this evening.
I also reinstalled phpMyAdmin again (no problems as before).