Have trouble installing phpmyadmin on PHP7 Apache/2.4.7 (Ubuntu) - php

I installed PHP7 today with
sudo add-apt-repository ppa:ondrej/php-7.0
sudo apt-get install php7.0-cli php7.0-common libapache2-mod-php7.0 php7.0 php7.0-mysql php7.0-fpm
after this, I got 403 forbidden error when I tried to access phpmyadmin.
then I tried to reinstall phpmyadmin with
apt-get install phpmyadmin
but it still looks for php5 dependencies which arent there anymore:
what can I do to solve this?

Install it via wget and create an alias in Apache. Keep track:
Change to directory /usr/share:
cd /usr/share
Change to root user:
sudo su
Download phpMyAdmin:
wget https://files.phpmyadmin.net/phpMyAdmin/4.5.4.1/phpMyAdmin-4.5.4.1-all-languages.zip
Unzip it: (you may install unzip first)
unzip phpMyAdmin-4.5.4.1-all-languages.zip
Rename the folder:
mv phpMyAdmin-4.5.4.1-all-languages phpmyadmin
Change permissions:
chmod -R 0755 phpmyadmin
Configure apache so that it can find it correctly:
vim /etc/apache2/sites-available/000-default.conf
Anywhere after "DocumentRoot /var/www/html" insert these line:
Alias /phpmyadmin "/usr/share/phpmyadmin/"
<Directory "/usr/share/phpmyadmin/">
Order allow,deny
Allow from all
Require all granted
</Directory>
Restart Apache:
service apache2 restart
And you are ready to go!
Just took a screenshot from my current installation for you to validate it works.

phpMyAdmin depends on the extension mbstring.
For Debian users (tested in Ubuntu 15.10),
sudo apt-get install php7.0-mbstring
For Fedora and CentOS,
sudo yum install php70w-mbstring

Using git clone of the original repo with a daily update cron job as documented here https://laracasts.com/discuss/channels/general-discussion/phpmyadmin-with-php7 worked really well for me. I put the following in my Vagrantfile (for a development server)
if [ ! -d /usr/share/phpmyadmin ]; then
sudo mkdir /usr/share/phpmyadmin
sudo git clone --depth=1 --branch=STABLE https://github.com/phpmyadmin/phpmyadmin.git /usr/share/phpmyadmin
fi
then added the alias as above
Alias /phpmyadmin "/usr/share/phpmyadmin/"
<Directory "/usr/share/phpmyadmin/">
Order allow,deny
Allow from all
Require all granted
</Directory>
and
service apache2 restart
very easy, only a few steps, always up to date. (Ubuntu wily, php7)

Before installing PHP 7 you should backup your database. During the installation process, you will delete your old version of php and be asked if you want to delete your database. Don't do it unless you really want to get rid of it.
Download phpmyadmin from https://www.phpmyadmin.net/ and uncompress it and move the folder to one level below the document root folder. It then worked for me when I navigated to it with localhost without further setup. I had to erase my bookmarks to phpmyadmin and make new bookmarks for the new location. My old database was fine.
I would like to install phpmyadmin globally so it could be installed or reinstalled or updated by apt-get, but don't know how.

I followed Magnus Eriksson's suggestion from comments
Try to install the latest version manually by downloading phpmyadmin
from their website. In all fairness, phpmyadmins apt-repo has
dependencies to other packages in the official apt-repo. PHP7 doesn't
exist in the apt-repo. (you added it manually, which phpmyadmins repo
has no clue about).

CentOS 7.2, PHP 7, PhpMyadmin 4.6.4
Step 1:
$ cd /usr/share
$ wget https://files.phpmyadmin.net/phpMyAdmin/4.6.4/phpMyAdmin-4.6.4-all-languages.zip
$ unzip phpMyAdmin-4.6.4-all-languages.zip
$ mv phpMyAdmin-4.6.4-all-languages phpmyadmin
Step 2:
$ cd /etc/httpd/conf.d
$ touch phpmyadmin.conf
$ put on phpmyadmin.conf following content
Alias /phpMyAdmin /usr/share/phpmyadmin
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 217.x.x.x
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 217.x.x.x
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpmyadmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 127.0.0.1
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpmyadmin/libraries/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
<Directory /usr/share/phpmyadmin/setup/frames/>
Order Deny,Allow
Deny from All
Allow from None
</Directory>
Step 3:
systemctl restart httpd
Step 4: i Cake http://www.example.com/phpmyadmin

Related

404 NOT FOUND error Magento installation process

I'am trying to install magento 2.4 on ubuntu 20.04
I've installed magento with composer.
mysql and apach are running fine and php installed correctly as shown below
All magento commands are working fine so I think magento is working.
But when I navigate to http://127.0.0.1/magento2/ I get 404 not found as shown below
I think maybe the problem is with the configs of php and apache
This is my magento config file
/etc/apache2/sites-available/magento2.conf
mysql and apach are running fine and php installed correctly:
magento2 directory
The problem is wen I try to get the magento url, I get this error
UPDATED1 :
http://127.0.0.1/
Looks like magento 2.4 not support web based installation.check this link
here are what I recommend for you :
you must install magento 2.4 from command line
make sure you install elasticsearch, and another system requirement, you can check this link
if you have install all the requirement system, follow this step :
add magento.local to your /etc/hosts
change your apache virtual host like below (make sure change the magento path) :
<VirtualHost *:80>
ServerName magento.local
ServerAdmin webmaster#localhost
DocumentRoot /var/www/magento/
<Directory /var/www/magento/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
enable vhost and apache rewrite : sudo a2ensite magento && sudo a2enmod rewrite
restart apache : sudo systemctl restart apache2
Install magento using command line :
bin/magento setup:install \
--base-url=http://magento.local/ \
--db-host=localhost \
--db-name=db_name \
--db-user=db_user \
--db-password=db_pass \
--admin-firstname=admin \
--admin-lastname=admin \
--admin-email=admin#admin.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--search-engine=elasticsearch7 \
--elasticsearch-host=localhost \
--elasticsearch-port=9200 \
--elasticsearch-index-prefix=magento2 \
--elasticsearch-timeout=15
verify the installation, visit : http://magento.local in browser
Hope this help you.

Multiple php-fpm versions on LAMP Server

(With the tutorial and afterwards with the help of Thomas Christlieb)
The configuration used right now is the following :
System runs on an "old" HP EliteBook,
which should run as test server before going live + backup server
SystemOS : Linux Mint 18.3 (based on Ubuntu 16.04)
Access to Site via Windows PC in same Network
To install the LAMP Server + fpm modules, I followed this steps :
sudo apt-get install apache2 apache2-utils mysql-server phpmyadmin
sudo a2dismod php7.2 (which was installed with phpmyadmin)
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update && sudo apt-get upgrade
sudo apt-get install libapache2-mod-fastcgi libapache2-mod-fcgid
sudo apt-get install php5.6-fpm php5.6 php5.6-mcrypt php5.6-mbstring php5.6-mysql php5.6-zip php5.6-gd php5.6-xml
sudo apt-get install php7.0-fpm php7.0 php7.0-mcrypt php7.0-mbstring php7.0-mysql php7.0-zip php7.0-gd php7.0-xml
sudo a2enmod actions
sudo a2enmod fastcgi
sudo a2enmod fcgid
sudo a2enmod rewrite
sudo a2enmod suexec
sudo a2enmod include (a2enmod's just to check if they are already enabled)
sudo service apache2 restart (to restart the server so everything will be loaded correctly)
created 2 files in /etc/apache2/sites-available, one php56.conf, one php70.conf
created 2 directorys in /var/www/html, one PHP 5.6, one PHP 7.0
sudo a2dissite 000-default (disable default site)
sudo a2ensite php56 php70 (enable PHP 5.6 & PHP 7.0 site)
sudo service apache2 restart
/etc/apache2/sites-available/php56.conf :
<IfModule mod_fastcgi.c>
AddHandler php56-fcgi-www .php
Action php56-fcgi-www /php56-fcgi-www
Alias /php56-fcgi-www /usr/lib/cgi-bin/php56-fcgi-www
FastCgiExternalServer /usr/lib/cgi-bin/php56-fcgi-www -socket /run/php/php5.6-fpm.sock -pass-header Authorization
<Directory "usr/lib/cgi-bin">
Require all granted
</Directory>
</IfModule>
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName php56
DocumentRoot /var/www/html/php56
<Directory "/var/www/html/php56">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
SetHandler php56-fcgi-www
</Directory>
ErrorLog $(APACHE_LOG_DIR)/error.log
CustomLog $(APACHE_LOG_DIR)/access.log combined
</VirtualHost>
/etc/apache2/sites-available/php70.conf :
<IfModule mod_fastcgi.c>
AddHandler php70-fcgi-www .php
Action php70-fcgi-www /php70-fcgi-www
Alias /php70-fcgi-www /usr/lib/cgi-bin/php70-fcgi-www
FastCgiExternalServer /usr/lib/cgi-bin/php70-fcgi-www -socket /run/php/php7.0-fpm.sock -pass-header Authorization
<Directory "usr/lib/cgi-bin">
Require all granted
</Directory>
</IfModule>
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName php70
DocumentRoot /var/www/html/php70
<Directory "/var/www/html/php70">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
SetHandler php70-fcgi-www
</Directory>
ErrorLog $(APACHE_LOG_DIR)/error.log
CustomLog $(APACHE_LOG_DIR)/access.log combined
</VirtualHost>
In both PHP 5.6 & PHP 7.0 Directories I created a file info.php
<?php phpinfo() ?>
sudo service apache2 restart (to reload the changed configuration)
So now the LAMP Server is installed with php5.6-fpm & php7.0-fpm but now my first problem occurs.
When I open PHP 7.0 Site in Web browser it shows me the correct phpinfo() which tells me :
PHP Version 7.0.27-1 + ubuntu16.04.1 + deb.sury.org + 1
Server API FPM/FastCGI
Loaded Configuration File /etc/php/7.0/fpm/php.ini ...
But when I open the PHP 5.6 site in web browser it shows me the exact same phpinfo() output.
So I tried disabling the PHP 7.0 site to check whether or not my PHP 5.6 config might be corrupt.
sudo a2dissite php70
sudo service apache2 reload
Now when I open PHP 5.6 (same for PHP 7.0) it shows me the phpinfo for PHP Version 5.6 like this :
PHP Version 5.6.33-3 + ubuntu16.04.1 + deb.sury.org + 1
Server API FPM/FastCGI
Loaded Configuration File /etc/php/5.6/fpm/php.ini ...
From there on I asked Thomas Christlieb for help and with his instructions I made the following :
a2dissite php56 php70 (to disable both site configuration files)
a2ensite 000-default (to enable the default configuration file again)
Made the following modifications to '/etc/apache2/sites-available/000-default.conf'
<IfModule mod_fastcgi.c>
AddHandler php56-fcgi-www .php
Action php56-fcgi-www /php56-fcgi-www
Alias /php56-fcgi-www /usr/lib/cgi-bin/php56-fcgi-www
FastCgiExternalServer /usr/lib/cgi-bin/php56-fcgi-www -socket /run/php5.6-fpm.sock -pass-header Authorization
<Directory "/usr/lib/cgi-bin">
Require all granted
</Directory>
AddHandler php70-fcgi-www .php
Action php70-fcgi-www /php70-fcgi-www
Alias /php70-fcgi-www /usr/lib/cgi-bin/php70-fcgi-www
FastCgiExternalServer /usr/lib/cgi-bin/php70-fcgi-www -socket /run/php7.0-fpm.sock -pass-header Authorization
<Directory "/usr/lib/cgi-bin">
Require all granted
</Directory>
</IfModule>
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/html/php70">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
SetHandler php70-fcgi-www
</Directory>
<Directory "/var/www/html/php56">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
SetHandler php56-fcgi-www
</Directory>
</VirtualHost>
sudo service apache2 restart (to reload the new configuration)
So but now when I open both sites, I get the exact same error Message 'Internal Server Error', but those two messages are in a different font,
which I suppose could mean that it should work like this, because otherwise they should be exactly the same, or am I wrong?
I googled around a lot, also looked up on here, but the this problem wasn't really present as I don't use docker nor Nginx in my configuration.
Maybe someone already had a problem like this and could tell me how to resolve the last step that I am missing.
Access.log Information
...
100.100.100.11 - - [20/Feb/2018:08:26:14 +0100] "GET /php56/info.php HTTP/1.1" 500 805 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0"
100.100.100.11 - - [20/Feb/2018:08:37:35 +0100] "GET /php56/info.php HTTP/1.1" 500 805 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:58.0) Gecko/20100101 Firefox/58.0"
...
Error.log Information
...
[Tue Feb 20 09:30:08.166199 2018] [fastcgi:error] [pid 27475] (2)No such file or directory: [client 100.100.100.11:52772] FastCGI: failed to connect to server "/usr/lib/cgi-bin/php56-fcgi-www": connect() failed
[Tue Feb 20 09:30:08.166574 2018] [fastcgi:error] [pid 27475] [client 100.100.100.11:52772] FastCGI: incomplete headers (0 bytes) received from server "/usr/lib/cgi-bin/php56-fcgi-www"
...
This is what I noticed now while looking trough the Error.log but I don't know why it says so.
I checked the status of php5.6-fpm, php7.0-fpm, apache2, they are all 3 active (running) so I can't help myself anymore and need help.
So no more need for an answer, Thomas Christlieb found the problem now.
In my 000-default.conf the FastCgiExternalServer i had a wrong path inside.
He changed /run/php5.6-fpm.sock to /run/php/php5.6-fpm.sock
and /run/php7.0-fpm.sock to /run/php/php7.0-fpm.sock
and now everything works just fine as it should.
Thanks.

Laravel showing code of index.php on home page

I'm using Apache 2.4 on Ubuntu 16.04, it shows the content of the index.php in browser.
here's the code of my site's conf file:
<VirtualHost *:80>
DocumentRoot /var/www/laravel/public
ServerName laravel.dev
<Directory /var/www/laravel/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Why the home page renders index.php as text file?
Note: I have set 777 permissions to laravel folder. PHP is also installed.
I got the solution over here..
Actually, I had to install libapache2-mod-php and activate it i.e. a2enmod php7.0
add below command :
sudo apt-get install libapache2-mod-php7.2
(this will pull the default PHP version)
Reload Apache configuration changes by restarting service using below command
sudo service apache2 restart
I ran into same issue and was looking for answers. In my case I had multiple versions of PHP installed with all necessary libraries, including the one mentioned in answers above.
The cause of issue turned out to be not properly switching between PHP, which I do time to time while switching projects. Running again a2dismod php5.6 and then a2enmod php7.3 (switch from php5.6 to php7.3) and restarting apache did the job for me.
Hope this helps someone with similar issue like mine.

Page on VPS in Laravel doesn't work

I bought VPS and installed on it Laravel, main page working normal and I getting subtitle "Laravel 5" but when I created test page, in route file:
Route::get('/test', function() {
return 'test' ;
});
I getting this:
Not Found
The requested URL /test was not found on this server.
Apache/2.4.7 (Ubuntu) Server at plerp.net.pl Port 80`
I chmod storage folder on 777.
`
ServerName www.plerp.net.pl
DocumentRoot /var/www/laravel/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/laravel>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
`
I think your web server does not have the rewrite module activated. Try this (beware, Apache only instructions below):
sudo a2enmod rewrite (for Debian/Ubuntu family)
sudo ln -s /etc/httpd/mods-available/rewrite.load /etc/httpd/mods-enabled/ (for Red Hat / CentOS family)
It might not be installed, in which case you'll need to search for it in the distribution's repositories:
sudo apt search apache rewrite for deb-based distros
sudo yum search httpd rewrite for rpm-based or sudo dnf search httpd rewrite for Fedora 21+
then install it with
sudo apt install <name-of-package> for deb-based
sudo yum install <name-of-package> for rpm-based (replace yum with dnf for Fedora 21+)
You might want to double check on file and folder permissions, most probably all you need to do is to chown the respective folder under the web server's user.

How to installation PHPRedmin?

I m trying to install phpRedMin and having some issues with that. All the documentation I found were available for older version of Apache.
I am using Apache version 2.4.7 in Ubuntu and I am not able to locate
Apache configuration example (/etc/httpd/conf.d/phpredmin.conf)
Can any one help with how to installation it?
I just was able to get it up and running on my Ubuntu Server 14.04.4 with php7 installed from this repo ppa:ondrej/php, https://launchpad.net/~ondrej/+archive/ubuntu/php
First I compiled the phpredis PHP module so PHP apps can comunicate with the REDIS server. Please have in mind that this steps are for PHP7, if you use PHP5 Ubuntu packages, then adjust it to fit your packages. I think you could do that simply by checkout the phpredmin master branch and not the PHP 7 one.
sudo su
apt-get update
apt-get install git build-essential tcl8.5 php-pear php7.0-dev
git clone -b php7 https://github.com/phpredis/phpredis.git
cd phpredis/
phpize
./configure
make && make install
touch /etc/php/7.0/mods-available/redis.ini
echo 'extension=redis.so' > /etc/php/7.0/mods-available/redis.ini
phpenmod redis
service apache2 restart
Then you install PHPRedmin
cd /var/www
git clone https://github.com/sasanrose/phpredmin.git
mkdir -p ./phpredis/logs/apache2handler/
chown www-data ./phpredmin/ -R
Create the apache config file
nano /etc/apache2/conf-available/phpredmin.conf
And then paste this apache config in that file. Change the allowed ips as loy like.
# phpredmin - Simple web interface to manage and monitor your Redis
Alias /phpredmin /var/www/phpredmin/public
<Directory /var/www/phpredmin/>
AllowOverride All
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require ip 10.0.0
Require ip 127.0.0.1
Require local
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 10.0.0.*
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
Then enable that conf and restart apache
a2enconf phpredmin
service apache2 restart
You can access the interface through http://server.com/phpredmin
Hope it helps. Gerads!

Categories