Want to build a LAMP environment on VirtualBox

Asked 2 years ago, Updated 2 years ago, 97 views

I want to build a LAMP environment on VirtualBox.
We installed the operating system and middleware in the following environments:

  • OS:Centos 6.5
  • PHP 5.3
  • Apache 2.2
  • mysql 5.1
  • Perl
  • phpMyAdmin-4.5.0.2: Under /var/www/html
  • Static IP for VM: 192.168.3.5

Create index.php with the following contents.

<?php
    phpinfo();
?>

Now that I have accessed http://192.168.3.5 and checked phpinfo, I can use PHP.

You can also connect to mysql from a virtual terminal.

Problem (1)
After accessing http://localhost,

The page cannot be displayed due to the following error

•Verify that the web address http://localhost is correct.

Problem (2)

After accessing http://192.168.3.5/phpMyAdmin,

The following error prevents phpMyAdmin login screen from appearing.

Forbidden You don't have permission to access/phpMyAdmin/on this server.
Apache/2.2.15 (CentOS) Server at 192.168.3.5 Port 80

Restarting the iptables service by adding the following line to the /etc/sysconfig/iptables configuration file will not resolve the above error:

-AINPUT-m state --state NEW-m tcp-ptcp --dport80-j ACCEPT 

Could you tell me how to solve this problem?
Thank you for your cooperation.

The main settings are as follows:

(1) Change /etc/httpd/conf/httpd.conf
Enter a description of the image here
Enter a description of the image here
 
(2) /etc/httpd/conf.d/phpMyAdmin.conf New
with the following contents Enter a description of the image here
(3) Change /var/www/html/phpMyAdmin/config.inc.php
$cfg['browfish_secret'] = 'hogehoge';
$cfg['Servers'][$i]['auth_type']='cookie';
$cfg['Lang'] = 'ja-utf-8';

(4) Change the owner of phpMyAdmin
chown-Root.apache/var/www/html/phpmyadmin/

(5) Configure the database in /var/www/html/define.php
define("DB_SERVER_NAME", "localhost";
define("DB_USER_NAME", "root";
define("DB_USER_PASS", "testpass";
define("DB_NAME", "testdb";

centos apache

2022-09-30 21:10

2 Answers

Have you configured the environment after installation?phpMyAdmin.conf or conf.inc.php.

As for the 403 error, the apache configuration file (phpMyAdmin.conf) generated during phpMyAdmin installation only allows access from the installed server, so I think this is the cause.

Edit /etc/httpd/conf.d/phpMyAdmin.conf to allow access from ip addr other than 127.0.0.1.

Other settings should be set according to your installed environment (path and so on).


2022-09-30 21:10

/etc/httpd/conf.d/phpMyAdmin.conf is set to deny connections from all clients.

Change to Order Deny, Allow.

<Directory"/var/www/html/phpMyAdmin">
    Order deny, allow
    Allow from all
    Deny from all
</Directory>


2022-09-30 21:10

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.