|
OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD. |
|
Thread Tools | Display Modes |
|
|
|||
How to configure phpMyAdmin for httpd?
Good day,
TL,DR: Are my folders and httpd.conf file configured correctly? I'm trying to build a website with a database. So I use httpd, PHP, and mariadb. I also would like to use phpMyAdmin. I downloaded phpMyAdmin with the code below Code:
pkg_add phpMyAdmin Code:
ls /var/www/htdocs/my_website/ index.php phpmyadmin Code:
#[ MACROS ] ext_ip = "127.0.0.1" # [ SERVERS ] server "default" { listen on $ext_ip port 80 root "htdocs/my_website" directory index "index.php" location "/*.php*" { fastcgi socket "/run/php-fpm.sock" } } # [ TYPES ] types { include "/usr/share/misc/mime.types" "http://localhost/phpMyAdmin/index". But result was like this: Quote:
|
|
|||
Dear jggimi,
Thanks for the reply. Quote:
Quote:
Code:
php-mysqli-7.3.28 php-mysqli-7.3.29 php-mysqli-7.3.30 php-mysqli-7.4.18 php-mysqli-7.4.19 php-mysqli-7.4.20 php-mysqli-7.4.21 php-mysqli-7.4.22 php-mysqli-7.4.23 (installed) php-mysqli-8.0.10 (installed) php-mysqli-8.0.5 php-mysqli-8.0.6 php-mysqli-8.0.7 php-mysqli-8.0.8 php-mysqli-8.0.9 Code:
ln -sf /etc/php-8.0.sample/mysqli.ini /etc/php-8.0/ My assumption is that there is a missing part in my httpd.conf file. If you ask me "how do you know that?", in the link below there is a configuration for nginx. https://nixbsd.wordpress.com/2014/11...min-and-nginx/ Of course nginx and httpd could be different but it seems like I missed some part related to phpmyadmin in my httpd.conf file. |
|
||||
This isn't an OpenBSD-ism. It's a telecommunications-ism. Specifically, the Internet Protocol, the "IP" of TCP/IP.
Quote:
Code:
--- yours Sun May 29 06:17:25 2022 +++ mine Sun May 29 06:18:25 2022 @@ -1,9 +1,9 @@ #[ MACROS ] -ext_ip = "127.0.0.1" +loopback = "127.0.0.1" # [ SERVERS ] server "default" { - listen on $ext_ip port 80 + listen on $loopback port 80 root "htdocs/my_website" directory index "index.php" Quote:
|
|
|||
Dear jggimi,
Thanks for the advice. I applied "loopback" variable. Quote:
https://blog.eldernode.com/install-m...-on-openbsd-7/ Anyways; I applied all the things you've mentioned so far and they worked after a restart. I connected to localhost/phpMyAdmin. It directed me to login page. So it worked. But right now it seems that PHP is not working. I can reach to my html pages but can not reach to my php pages. I did: Code:
rcctl start httpd rcctl start mysqld rcctl start php80_fpm EDIT: I closed down the terminal and started all of the daemons again. Now server is working. But there is an additional warning at localhost/phpMyAdmin Code:
Warning in ./libraries/classes/Config.php#1761 mkdir(): Permission denied Backtrace ./libraries/classes/Config.php#1761: mkdir( string './tmp//twig', integer 504, boolean true, ) ./libraries/classes/Template.php#62: PhpMyAdmin\Config->getTempDir(string 'twig') ./libraries/classes/Template.php#102: PhpMyAdmin\Template->__construct(string 'login/header') ./libraries/classes/Plugins/Auth/AuthenticationCookie.php#111: PhpMyAdmin\Template::get(string 'login/header') ./libraries/classes/Plugins/AuthenticationPlugin.php#247: PhpMyAdmin\Plugins\Auth\AuthenticationCookie->showLoginForm() ./libraries/common.inc.php#353: PhpMyAdmin\Plugins\AuthenticationPlugin->authenticate() ./index.php#27: require_once(./libraries/common.inc.php) Last edited by gordon.f; 29th May 2022 at 12:50 PM. |
|
|||
Thanks a lot, appreciated.
|
|
||||
I've replicated the environment and have phpMyAdmin up and running with access to the MariaDB server, having created a database user and granted all privs.
I do not see "twig" in any log at this time. Where is the warning produced? |
|
||||
I haven't heard from you regarding the warning.
Briefly, on a local virtual "lab" machine running OpenBSD 7.1-release, I:
Last edited by jggimi; 31st May 2022 at 02:30 AM. |
|
|||
Dear jggimi,
Good day. Quote:
Quote:
|
|
|||||||||
Dear jggimi;
Please review my checklist below. I think, so far so good except for the fourth step. Here is my OpenBSD version: Code:
>>>uname -r 6.9 >>>uname -a OpenBSD "my_system" 6.9 GENERIC.MP#797 i386 Quote:
Code:
>>>pkg_info -Q phpmyadmin phpMyAdmin-4.9.5p0 (installed) Quote:
Code:
>>>pkg_info -Q mariadb mariadb-client-10.5.12p0v1 (installed) mariadb-server-10.5.12p0v1 (installed) Quote:
Code:
>>>ls /var/mysql/ aria_log.00000001 ib_logfile0 onedb aria_log_control ibdata1 performance_schema "my_system".err ibtmp1 test "my_system".net.pid multi-master.info ib_buffer_pool mysql Quote:
Quote:
Code:
>>>cat /etc/my.cnf [client-server] socket=/var/run/mysql/mysql.sock port=3306 # This will be passed to all MariaDB clients [client] #password="my_password" # The MariaDB server [mysqld] # To listen to all IPv4 network addresses, use "bind-address = 0.0.0.0" bind-address=127.0.0.1 # Directory where you want to put your data #data=/var/mysql # This is the prefix name to be used for all log, error and replication files #log-basename=mysqld # Logging #general-log #slow_query_log Quote:
Code:
>>>ln -sf ../php-8.0.sample/mysqli.ini /etc/php-8.0/ >>>ls /etc/php-8.0.sample/ mysqli.ini opcache.ini pdo_mysql.ini >>>ls /etc/php-8.0 mysqli.ini Quote:
Code:
>>>cat /etc/httpd.conf # $OpenBSD: httpd.conf,v 1.22 2020/11/04 10:34:18 denis Exp $ #[ MACROS ] loopback = "127.0.0.1" # [ SERVERS ] server "default" { listen on $loopback port 80 root "htdocs/my_website" directory index "index.php" location "/*.php*" { fastcgi socket "/run/php-fpm.sock" } } # [ TYPES ] types { include "/usr/share/misc/mime.types" Quote:
Code:
>>>cat test.php <?php phpinfo(); Quote:
Code:
#COPIED /var/www/phpMyAdmin TO /var/www/htdocs/my_website/ >>>ls /var/www/htdocs/my_website/ first.php index.html index.php phpinfo.php test.php first.php~ index.html~ phpMyAdmin phpinfo.php~ |
|
||||
Clearly there are some differences -- I used the most recent release, and am using amd64, and you're on an i386 architecture with OpenBSD-6.9.
6.9 is no longer supported, by the way. It was end-of-life with the release of 7.1 earlier this year. Per step 4, I followed the provisioning guidance in the pkg-readme: Code:
chrooted daemons and MariaDB socket =================================== For external program running under a chroot(8) to be able to access the MariaDB server without using a network connection, the socket must be placed inside the chroot. e.g. httpd(8) or nginx(8): connecting to MariaDB from PHP --------------------------------------------------------- Create a directory for the MariaDB socket: # install -d -m 0711 -o _mysql -g _mysql /var/www/var/run/mysql Adjust /etc/my.cnf to use the socket in the chroot - this applies to both client and server processes: [client-server] socket = /var/www/var/run/mysql/mysql.sock |
|
|||
Dear jggimi;
I didn't realize that system differences can affect like this way. Anyways thank you for help. If I upgrade my OS, I'll try again. Also: Quote:
|
|
|||
Dear jggimi,
Warning is produced when you hit "http://localhost/phpMyAdmin". It brings the page for you to enter username and password. Also there is a dropdown menu that you can change the language. At the bottom of that page there is a warning panel. That's where the warning produced. Also if you enter username and password it brings "Access denied". Quote:
|
|
||||
OK. I don't see that particular error in the browser window. I was looking for this in PHP logs and didn't see anything at all. I'm able to log on. I do have other warnings, about not having the curl extension provisioned, and about not having a tmp directory provisioned at /htdocs/phpMyAdmin/tmp. That's fine, I haven't provisioned these.
---- Correct your MariaDB socket. Above, you posted that your /etc/my.cnf file contains: Code:
socket=/var/run/mysql/mysql.sock # rcctl restart mysqld . See if you are then able to log in with the user and password you created.
|
|
|||
Dear jggimi,
Now I got it. I've corrected my socket. Now there is a directory called "/var/run/mysql" under /var/www Code:
>>>ls /var/www acme cache conf logs phpMyAdmin tmp var bin cgi-bin htdocs pear run usr Code:
>>>ls /var/www/var/run/mysql/ mysql.sock Code:
>>>cat /etc/my.cnf [client-server] socket=/var/www/var/run/mysql/mysql.sock port=3306 # This will be passed to all MariaDB clients [client] #password=my_password # The MariaDB server [mysqld] # To listen to all IPv4 network addresses, use "bind-address = 0.0.0.0" bind-address=127.0.0.1 # Directory where you want to put your data #data=/var/mysql # This is the prefix name to be used for all log, error and replication files #log-basename=mysqld # Logging #general-log #slow_query_log |
|
||||
Do you still get some sort of error message when you try to log on? Remember, I'm not there with you and can only see what you post.
Just in case you may need this, here's how I created a user with mysql(1): Code:
# mysql Welcome to the MariaDB monitor.... MariaDB [(none)]> CREATE USER 'jggimi'@'localhost' IDENTIFIED BY 'insertPasswordHere'; Query OK, 0 rows affected (0.015 sec) MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'jggimi'@'localhost'; Query OK, 0 rows affected (0.005 sec) MariaDB [(none)]> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.006 sec) MariaDB [(none)]> quit; Bye |
|
|||
Dear jggimi;
Quote:
Quote:
|
|
||||
There is still room for error, because you post the output of "ls" but that's an incomplete view. You'll get a much clearer picture of files, directories, and structure within these filesystems using "ls -l" or "ls -lR". In particular, the extension links are easy to get wrong with ln(1) and sometimes the link errors are only obvious once checked with "ls -l". I know, because I've had this happen more than once.
Quote:
|
Tags |
httpd, php, phpmyadmin |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Automating the "vi /etc/httpd.conf", httpd -n, rcctl restart httpd" treadmill | J65nko | Guides | 0 | 18th May 2021 12:58 AM |
How to configure nagios-web on OpenBSD 5.8 httpd? | kleefaj | OpenBSD Packages and Ports | 0 | 11th April 2016 04:58 PM |
phpMyAdmin problems | werwer | OpenBSD General | 5 | 16th July 2010 10:53 AM |
phpMyAdmin Unaccessable | Nk2Network | OpenBSD Packages and Ports | 2 | 20th April 2009 09:13 PM |
phpMyAdmin Unaccessable | plexter | OpenBSD Packages and Ports | 3 | 16th December 2008 10:32 PM |