我按照本指南安装 LAMP: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html
To install phpMyAdmin
Install the required dependencies.
[ec2-user ~]$ sudo yum install php-mbstring php-xml -y
Restart Apache.
[ec2-user ~]$ sudo systemctl restart httpd
Restart php-fpm.
[ec2-user ~]$ sudo systemctl restart php-fpm
Navigate to the Apache document root at /var/www/html.
[ec2-user ~]$ cd /var/www/html
Select a source package for the latest phpMyAdmin release from https://www.phpmyadmin.net/downloads. To download the file directly to your instance, copy the link and paste it into a wget command, as in this example:
[ec2-user html]$ wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
Create a phpMyAdmin folder and extract the package into it with the following command.
[ec2-user html]$ mkdir phpMyAdmin && tar -xvzf phpMyAdmin-latest-all-languages.tar.gz -C phpMyAdmin --strip-components 1
Delete the phpMyAdmin-latest-all-languages.tar.gz tarball.
[ec2-user html]$ rm phpMyAdmin-latest-all-languages.tar.gz
(Optional) If the MySQL server is not running, start it now.
[ec2-user ~]$ sudo systemctl start mariadb
In a web browser, type the URL of your phpMyAdmin installation. This URL is the public DNS address (or the public IP address) of your instance followed by a forward slash and the name of your installation directory. For example:
http://my.public.dns.amazonaws.com/phpMyAdmin
运行后我得到 11.11.111.11/phpmyadmin not found url on server
我尝试:
sudo nano /etc/httpd/conf/httpd.conf
添加
Include /var/www/html/phpmyadmin/httpd.conf
或者
Include /phpmyadmin/httpd.conf
但这对我来说是导致 apache 问题的原因:
[ec2-user@server1 ~]$ sudo systemctl restart httpd
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
[ec2-user@server1 ~]$
编辑:
Jan 30 17:21:57 server1. systemd[1]: Stopped The Apache HTTP Server.
Jan 30 17:21:57 server1. systemd[1]: Starting The Apache HTTP Server...
Jan 30 17:21:57 server1..com httpd[14286]: httpd: Syntax error on line 362 of /etc/httpd/conf/httpd.conf: Could not open configuration file /etc/phpmyadmin/apache.conf: No such file
Jan 30 17:21:57 server1.com systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jan 30 17:21:57 server1.com systemd[1]: Failed to start The Apache HTTP Server.
Jan 30 17:21:57 server1.com systemd[1]: Unit httpd.service entered failed state.
Jan 30 17:21:57 server1.com systemd[1]: httpd.service failed.
Jan 30 18:02:08 server1.com systemd[1]: Starting The Apache HTTP Server...
Jan 30 18:02:08 server1.com systemd[1]: Started The Apache HTTP Server.
删除上面的代码后,apache 可以工作。当我尝试“包含...”时,就会出现这个问题。
我已将 phpmyadmin 解压到: /var/www/html/PhpMyAdmin
并提取正确。我不知道为什么这个conf丢失以及如何添加正确的文件路径。
答案1
首先,检查您的情况。你写phpmyadmin
,phpMyAdmin
和PhpMyAdmin
。确保你做对了。文档说要解压,/var/www/html/phpMyAdmin
所以 URL 应该是这样的http://xxxx/phpMyAdmin。区分大小写很重要!
那么,/var/www/html/ 下的 Apache 配置文件来自哪里?这个:
Include /var/www/html/phpmyadmin/httpd.conf
或这个
Include /phpmyadmin/httpd.conf
毫无意义。从 Apache 配置文件中删除它,它会触发您在日志中看到的错误。
确保检查 Apache 配置有效性,然后通过发出以下命令重新加载 Apache(以及 php-fpm 以确保安全):
» httpd -t
Syntax OK
# if not OK - fix it!
» systemctl restart httpd
» systemctl restart php-fpm
phpMyAdmin tarball 不包含 Apache 配置指令。
验证是否http://xxxx/有效(您应该看到标准的 Apache 测试页面)并且您应该在下面看到一些输出http://xxxx/phpMyAdmin,如果您正确地解压了 下的 tarball /var/www/html/phpMyAdmin
。