How to installation PHPRedmin? - php

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!

Related

Lampp Centos 7 change php version to 7.3 [duplicate]

Can anyone here instruct me way to install and configure Multi PhP with one apache instance on CentOS 7, and the proper way to test it..
install all the necessary repos and packages
big thanks to https://rpms.remirepo.net/wizard/
the following commands assume you already sudo su - or you will have to add sudo to each of the commands:
yum install httpd -y
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils -y
yum install php56 -y
yum install php72 -y
yum install php56-php-fpm -y
yum install php72-php-fpm -y
stop both fpm servers
systemctl stop php56-php-fpm
systemctl stop php72-php-fpm
by default it listens on 127.0.0.1 port 9000, make them listen on different ports
sed -i 's/:9000/:9056/' /etc/opt/remi/php56/php-fpm.d/www.conf
sed -i 's/:9000/:9072/' /etc/opt/remi/php72/php-fpm.d/www.conf
now two different version of fpm can be started on different ports
systemctl start php72-php-fpm
systemctl start php56-php-fpm
make script wrapper to call php56-cgi and php72-cgi
cat > /var/www/cgi-bin/php56.fcgi << EOF
#!/bin/bash
exec /bin/php56-cgi
EOF
cat > /var/www/cgi-bin/php72.fcgi << EOF
#!/bin/bash
exec /bin/php72-cgi
EOF
make them executable by apache
sudo chmod 755 /var/www/cgi-bin/php56.fcgi
sudo chmod 755 /var/www/cgi-bin/php72.fcgi
create php configuration for apache. by default it runs php56-fcgi handler
cat > /etc/httpd/conf.d/php.conf << EOF
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
AddHandler php56-fcgi .php
Action php56-fcgi /cgi-bin/php56.fcgi
Action php72-fcgi /cgi-bin/php72.fcgi
<Directory /var/www/html/php56>
DirectoryIndex index.php
AllowOverride all
Require all granted
</Directory>
<Directory /var/www/html/php72>
DirectoryIndex index.php
AllowOverride all
Require all granted
</Directory>
EOF
make test pages, create .htaccess to use php72-fcgi
mkdir -p /var/www/html/php56
mkdir -p /var/www/html/php72
echo "<?php phpinfo(); ?>" > /var/www/html/php56/index.php
echo "<?php phpinfo(); ?>" > /var/www/html/php72/index.php
echo "AddHandler php72-fcgi .php" > /var/www/html/php72/.htaccess
Now you should be able to test it
(http://127.0.0.1/php56)
(http://127.0.0.1/php72)
If you want to startup these instance automatically after server reboot
sudo systemctl enable httpd
sudo systemctl enable php56-php-fpm
sudo systemctl enable php72-php-fpm
As explained by #runwuf, this is possible using the sofware collections available in centos-scl repository or in remi repository.
But using SetHandler to fastcgi proxy seems a better and more modern way, thanks to httpd 2.4:
SetHandler "proxy:fcgi://127.0.0.1:9000"
This is explained in some blog posts:
My PHP Workstation on Remi's blog
PHP Configuration Tips on RH developpers' blog
I had to add the following to my php.conf inside the directory statement to make the Apache Server API change to FPM/FastCGI instead of CGI/FastCGI - your solution was almost perfect though! Now if I could just figure out how to make it use a socket instead of TCP, I'd be one happy coder.
# mod_proxy_fcgi options
<IfModule mod_proxy_fcgi.c>
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9072"
</FilesMatch>
</IfModule>
It looks like what you are trying to do is similar to this:
running-two-php-versions-on-the-same-server
I personally would not want to attempt two php version on the same apache instance... I would install different version of php by tarball and run them on separate instance of apache that is also installed by tarball and point each httpd.conf to the different version of php.
replying to runwuf
Hello,
there is one problem with your approach regarding SELinux
either you disable SELinux (if you are not concerned with security) or you manage the SELinux Port Policy
In case you don't handle the SELinux, the php56-php-fpm won't start if SELinux is set to 'Enforcing' mode
Run the following commands for making SELinux allow the ports
semanage port -a -t http_port_t -p tcp 9072
semanage port -a -t http_port_t -p tcp 9056
and then finally try to start the fpm modules
I wandered here looking for a solution. CentOS now has a PHP Select which let's you run different version of PHP on the server.
More information can be found here: http://forum.centos-webpanel.com/php/php-selector/

Difference between php-fpm with libapache2-mod-fcgid and/or libapache2-mod-fastcgi

right now I'm installing or new apache2 webserver with PHP-FPM, because the old one is running with mod_php.
I found different Tutorials at the internet, unlikely most of them 1-2 years old. Most of them use:
libapache2-mod-fastcgi in combination with Apache and PHP-FPM.
At the Ubuntu 18.04 Repository this package is not available, just the package:
libapache2-mod-fcgid
Which of them can I use now ? Or what is the difference between both of them ? Unfortunately I cant really find a good explanation at the internet.
Furthermore I often read about
mod_proxy_fcgi
does that mean I dont need the libaapche2-mod-f... packages anymore ? ?
Right now I installed everything like this and it works, but I'm not sure If this is the right way:
a2enmod actions fastcgi alias proxy_fcgi
apt install php-7.2 php7.2-fpm php7.2-gd php7.2-mysql php7.2-curl php7.2-xml php7.2-zip php7.2-intl php7.2-mbstring php7.2-bz2 php7.2-json php7.2-apcu php7.2-imagick
a2enmod actions fastcgi alias proxy_fcgi
vHost:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php/php7.2-fpm.sock|fcgi://localhost/"
</FilesMatch>
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
PHP-FPM is running (see picture of info.php):
PHP-FPM Working
And what is the difference between:
SetHandler and FastCgiExternalServer and ProxyPassMatch ^/(..php(/.)?)$ fcgi://127.0.0.1:9000/path/to/your/documentroot/$1
?
I've got the feeling, that every tutorial is telling me something different and I cant really figure out what the best practice is in 2018 with Ubuntu2018.
I know this is an old question but I wanted to give an updated response.
As of the release of php5.3.3 (in 2010) a lot has changed.
Some great info can be found on the Apache HTTP Server Wiki
The short answer (Note: replace php7.2 with the version you have installed) as to how to install only PHP-FPM on an Ubuntu apache2 server is:
# Install php-fpm:
apt install php-fpm
# Disable mod_php (Apache Handler API):
a2dismod php*
# Enable Apache Modules/Configs required by fpm:
a2enmod proxy_fcgi setenvif
a2enconf php7.2-fpm.conf
# Restart the services:
systemctl restart php7.2-fpm.service systemctl restart apache2.service
You are also going to need to change from using Pre-fork as your Multi-Processing Module (MPM) if you are going to run PHP-FPM. Here are some instructions.
Detailed Explanation:
There are basically 3 different Server API's that can be installed with PHP: Apache Handler, FPM, or CGI.
Looking at the different config files can help to understand what you may have installed on your system.
Currently on Ubuntu 18.x with php7.x the following php.ini files get created depending on what you have installed:
/etc/php/7.2/cli/php.ini
This is the PHP-CLI program for running php on the command line.
This is included whenever you install FPM, CGI, or the Apache Handler.
You could install it directly with:
apt install php-cli
To find all the config files being used for PHP-CLI you can run:
php --ini
/etc/php/7.2/apache2/php.ini
This is the PHP plugin used by Apache. It will be found in /etc/apache2/mods-available/php7.2
If you have not installed PHP-FPM or PHP-CGI then this is the file that contains your webserver settings.
To find all the config files you need to create a phpinfo() file in the website root directory.
To install you must also enable mod_php from within Apache.
apt install libapache2-mod-php
a2enmod php7.2
/etc/php/7.2/fpm/php.ini
This is the FastCGI Process Manager. It is a wrapper for PHP processing and runs as a standalone process on the system (unlike the Apache PHP plugin).
You will only have this directory if you have installed PHP-FPM.
In this case it will be the place to make config changes for your webserver and takes the place of the apache2/php.ini file.
To find all the config files you need to create a phpinfo() file in the website root directory.
Running PHP as a fastCGI process server with PHP-FPM requires using the apache module mods-enabled/mod_proxy_fcgi it is enabled along with php-fpm.
Installing php-fpm will also configure apache with with conf-enabled/php7.2-fpm.conf that sets up FPM to run as a unix domain socket.
apt install php-fpm
a2enmod mod_proxy_fcgi
/etc/php/7.2/cgi/php.ini
This is a third way PHP could be installed. It is the legacy way of running PHP based applications as opposed to the newer PHP-FPM.
mod_fcgid is a high performance alternative to mod_cgi or mod_cgid
It would also be taking the place of the php.ini in either the Apache Plugin or PHP-FPM.
To find all the config files you need to create a phpinfo() file in the website root directory.
Again, it comes with it's own apache module and configuration: mods-enabled/fcgid.conf mods-enabled/fcgid
apt install libapache2-mod-fcgid
a2enmod fcgid
Here's my vhost for Apache connecting to FPM using mod_proxy_fcgi (apparently the recommended setup, although don't ask me for specifics!):
<VirtualHost *:80>
ServerName awesome.scot
ServerAlias localhost
DocumentRoot /var/www/html/public
<Directory "/var/www/html">
DirectoryIndex index.php
FallbackResource /index.php
Options -Indexes +FollowSymLinks
AllowOverride FileInfo All
Require all granted
</Directory>
ProxyPassMatch ^/(.*\.php)$ fcgi://php:9000/var/www/html/public/$1
</VirtualHost>
in the conf, I also have these on:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
If you use XDebug, you'll need to change it's port to 9001 since 9000 is now taken.
If you need to see more config, check out my Docker LAMP stack config here https://github.com/delboy1978uk/lamp

Multiple PHP version with Apache on CentOS 7

Can anyone here instruct me way to install and configure Multi PhP with one apache instance on CentOS 7, and the proper way to test it..
install all the necessary repos and packages
big thanks to https://rpms.remirepo.net/wizard/
the following commands assume you already sudo su - or you will have to add sudo to each of the commands:
yum install httpd -y
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum install yum-utils -y
yum install php56 -y
yum install php72 -y
yum install php56-php-fpm -y
yum install php72-php-fpm -y
stop both fpm servers
systemctl stop php56-php-fpm
systemctl stop php72-php-fpm
by default it listens on 127.0.0.1 port 9000, make them listen on different ports
sed -i 's/:9000/:9056/' /etc/opt/remi/php56/php-fpm.d/www.conf
sed -i 's/:9000/:9072/' /etc/opt/remi/php72/php-fpm.d/www.conf
now two different version of fpm can be started on different ports
systemctl start php72-php-fpm
systemctl start php56-php-fpm
make script wrapper to call php56-cgi and php72-cgi
cat > /var/www/cgi-bin/php56.fcgi << EOF
#!/bin/bash
exec /bin/php56-cgi
EOF
cat > /var/www/cgi-bin/php72.fcgi << EOF
#!/bin/bash
exec /bin/php72-cgi
EOF
make them executable by apache
sudo chmod 755 /var/www/cgi-bin/php56.fcgi
sudo chmod 755 /var/www/cgi-bin/php72.fcgi
create php configuration for apache. by default it runs php56-fcgi handler
cat > /etc/httpd/conf.d/php.conf << EOF
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
AddHandler php56-fcgi .php
Action php56-fcgi /cgi-bin/php56.fcgi
Action php72-fcgi /cgi-bin/php72.fcgi
<Directory /var/www/html/php56>
DirectoryIndex index.php
AllowOverride all
Require all granted
</Directory>
<Directory /var/www/html/php72>
DirectoryIndex index.php
AllowOverride all
Require all granted
</Directory>
EOF
make test pages, create .htaccess to use php72-fcgi
mkdir -p /var/www/html/php56
mkdir -p /var/www/html/php72
echo "<?php phpinfo(); ?>" > /var/www/html/php56/index.php
echo "<?php phpinfo(); ?>" > /var/www/html/php72/index.php
echo "AddHandler php72-fcgi .php" > /var/www/html/php72/.htaccess
Now you should be able to test it
(http://127.0.0.1/php56)
(http://127.0.0.1/php72)
If you want to startup these instance automatically after server reboot
sudo systemctl enable httpd
sudo systemctl enable php56-php-fpm
sudo systemctl enable php72-php-fpm
As explained by #runwuf, this is possible using the sofware collections available in centos-scl repository or in remi repository.
But using SetHandler to fastcgi proxy seems a better and more modern way, thanks to httpd 2.4:
SetHandler "proxy:fcgi://127.0.0.1:9000"
This is explained in some blog posts:
My PHP Workstation on Remi's blog
PHP Configuration Tips on RH developpers' blog
I had to add the following to my php.conf inside the directory statement to make the Apache Server API change to FPM/FastCGI instead of CGI/FastCGI - your solution was almost perfect though! Now if I could just figure out how to make it use a socket instead of TCP, I'd be one happy coder.
# mod_proxy_fcgi options
<IfModule mod_proxy_fcgi.c>
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9072"
</FilesMatch>
</IfModule>
It looks like what you are trying to do is similar to this:
running-two-php-versions-on-the-same-server
I personally would not want to attempt two php version on the same apache instance... I would install different version of php by tarball and run them on separate instance of apache that is also installed by tarball and point each httpd.conf to the different version of php.
replying to runwuf
Hello,
there is one problem with your approach regarding SELinux
either you disable SELinux (if you are not concerned with security) or you manage the SELinux Port Policy
In case you don't handle the SELinux, the php56-php-fpm won't start if SELinux is set to 'Enforcing' mode
Run the following commands for making SELinux allow the ports
semanage port -a -t http_port_t -p tcp 9072
semanage port -a -t http_port_t -p tcp 9056
and then finally try to start the fpm modules
I wandered here looking for a solution. CentOS now has a PHP Select which let's you run different version of PHP on the server.
More information can be found here: http://forum.centos-webpanel.com/php/php-selector/

How to enable mode rewrite in apache2

I have installed Apache2, PHP5, MySQL. And now I am trying to run my project, but getting error:
The requested URL /toothi/home was not found on this server.
Apache/2.2.22 (Ubuntu) Server at 192.168.2.169 Port 80
I am trying to run my project on Ubuntu 12.04
To enable mod_rewrite in apache2-
sudo a2enmod rewrite
sudo apache2 restart
To use mod_rewrite from within .htaccess files (which is a very common use case), edit the default VirtualHost.
sudo vim /etc/apache2/sites-available/000-default.conf
Below “DocumentRoot /var/www/” add the following lines:
<Directory “/var/www/”>
AllowOverride All
</Directory>
Restart the server again:
sudo service apache2 restart

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

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

Categories