Asked  7 Months ago    Answers:  5   Viewed   468 times

Version:

  • OS lsb_release -a : Ubuntu 18.04.5 LTS
  • PHP php -v : 8.0.1
  • Apache apache2 -v : 2.4.29 (Ubuntu)
  • MySQL mysql --version : mysql Ver 14.14 Distrib 5.7.32

Problem:

I'm trying to install LAMP Stack using following article. However, I was getting HTTP 500 Error while accessing phpmyadmin from browser.

And installed phpmyadmin using below command.

  • sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl

Tried :

So, I checked with Error Log tail -f /var/log/apache2/error.log and found that Phpmyadmin was running on depreciated version of PHP.

[Sat Jan 30 12:56:38.798871 2021] [php:error] [pid 17271] [client 
103.25.169.179:28514] PHP Fatal error:  Array and string offset access 
syntax with curly braces is no longer supported in 
/usr/share/phpmyadmin/libraries/Util.php on line 2087

[Sat Jan 30 12:56:38.798871 2021] [php:error] [pid 17271] [client 103.25.169.179:28514] PHP Fatal error:  Uncaught ValueError: 
mb_convert_encoding(): Argument #2 ($to_encoding) must be a valid 
encoding, "" given in /usr/share/php/php-php-
gettext/gettext.inc:181nStack trace:n#0 /usr/share/php/php-php-
gettext/gettext.inc(181): mb_convert_encoding()n#1 /usr/share/php/php-
php-gettext/gettext.inc(278): _encode()n#2 /usr/share/php/php-php-
gettext/gettext.inc(285): _gettext()n#3 
/usr/share/phpmyadmin/libraries/sanitizing.lib.php(179): __()n#4 
/usr/share/phpmyadmin/libraries/Message.php(607): PMA_sanitize()n#5 
/usr/share/phpmyadmin/libraries/Message.php(672): 
PMA\libraries\Message::decodeBB()n#6 
/usr/share/phpmyadmin/libraries/Error.php(220): PMA\libraries\Message-
>getMessage()n#7 /usr/share/phpmyadmin/libraries/ErrorHandler.php(193): 
PMA\libraries\Error->getHash()n#8 
/usr/share/phpmyadmin/libraries/ErrorHandler.php(156): 
PMA\libraries\ErrorHandler->addError()n#9 [internal function]: 
PMA\libraries\ErrorHandler->handleError()n#10 
/usr/share/phpmyadmin/libraries/session.inc.php(133): ini_set()n#11 
/usr/share/phpmyadmin/libraries/common.inc.php(280): require('...')n#12 
/usr/share/phpmyadmin/index.php(13): require_once('...')n#13 {main}n  
thrown in /usr/share/php/php-php-gettext/gettext.inc on line 181

  • I'd solved Array and string offset access syntax error by removing { } with [ ]
  • Run the following command sudo phpenmod mbstring

 Answers

73

Important:

Please change the version number to get more security if you have phpMyAdmin exposed to the public or need features from newer phpMyAdmin versions.

This was taken from a chat. Some things might be inaccurate, but this solved the OP's problem

Install PHPMyAdmin using the following tutorial:

1.

apt purge phpmyadmin -y
cd /path/to/somefolder
wget https://files.phpmyadmin.net/phpMyAdmin/5.1.0-rc1/phpMyAdmin-5.1.0-rc1-all-languages.zip && unzip phpMyAdmin-5.1.0-rc1-all-languages.zip && 
cd phpMyAdmin-5.1.0-rc1-all-languages
apt install pwgen -y
  1. Make note of the output of this command, I will refer to it as pw
pwgen -s 32 1
cp config.sample.inc.php config.inc.php
  1. Edit config.inc.php with favorite editor, and paste the pw in this line:
. . .
$cfg['blowfish_secret'] = 'STRINGOFTHIRTYTWORANDOMCHARACTERS'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
. . .
vim /etc/apache2/conf-available/phpmyadmin-custom.conf
  1. Paste the following to that previous command:
Alias /phpmyadmin /path/to/that/phpMyAdmin-5.1.0-rc1-all-languages
<Directory "/path/to/that/phpMyAdmin-5.1.0-rc1-all-languages">
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
Require all granted
</Directory>
  1. Save the previous one using :wq, Run the following command
a2enconf phpmyadmin-custom && systemctl restart apache2 && mysql
  1. Replace your_password_here to your own password.
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'your_password_here';
systemctl restart mysql

It should work now.

Additional notes:

To only allow you to view phpMyAdmin, try:

<Directory "/path/to/that/phpMyAdmin-5.1.0-rc1-all-languages">
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
Require local
# Or change it to
# Require ip 127.0.0.1
# change 127.0.0.1 to your personal computers ip address,
# not to the server ip
# if you want to access phpMyAdmin from a public server, but not allow others to access it
</Directory>
Friday, May 28, 2021
 
Gilko
answered 7 Months ago
10

Seems that the web server cannot read some (or all) files in the phpmyadmin directory ((Errcode: 13 - Permission denied)).

You need to fix the permissions by executing the following commands, assuming the phpmyadmin is located at /path/to/phpmyadmin:

find /path/to/phpmyadmin -type d -exec chmod 755 {} ;
find /path/to/phpmyadmin -type f -exec chmod 644 {} ; 

Obviously, you need to replace /path/to/phpmyadmin with the actual path.

Saturday, May 29, 2021
 
Lorav
answered 7 Months ago
10

This is almost certainly a CSRF token issue.

See this in the CI forums and this blog post

Wednesday, August 18, 2021
 
Jerry Zhou
answered 4 Months ago
51

My machine configuration - Ubuntu 16.04 - MySql 5.7.13 - PHP 7.0.8 - Apache 2.4.18

Edit the file /etc/dbconfig-common/phpmyadmin.conf, changing

dbc_dbport='' to dbc_dbport='0'

After editing the file and saving it, if you are still on the dbconfig-common wizard select retry; if not run sudo dpkg-reconfigure phpmyadmin (choose Yes when asked you if you want to Reinstall database for phpmyadmin) and continue normally without changing any value. If you want to change some value do it in the file that you have edited before.

When configuration window asks what you want to do with existing configuration file choose Keep the local version currently installed.

At this point you can check the differences and only those must exist that you made in the file.

Sunday, September 5, 2021
 
Jamie Taylor
answered 3 Months ago
39

So based upon the heroku info that you provided I see that you are on the bamboo stack and that stack does not support Rails 3.1+. Only the cedar stack supports Rails 3.1+. You'll need to use the following command to create a new app on the cedar stack:

heroku create --stack cedar
Monday, October 25, 2021
 
benjisail
answered 1 Month ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share