使用MAMP& amp; amp;的本地主机设置phpMyAdmin.在此服务器上找不到文件 [英] Local host setup with MAMP & phpMyAdmin. File not found on this server

查看:79
本文介绍了使用MAMP& amp; amp;的本地主机设置phpMyAdmin.在此服务器上找不到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何显示我的本地.php文件,所以我看到了我的表格.当我编写本地主机,然后编写.php文件的路径时,出现未找到"页面.

如果我将:8889添加到本地主机,它似乎是通过MySQL-port(8889)而不是Apache-port(8888)运行的,然后safari会将文件下载到我的下载文件中.

我在这里附上了一张显示我所有设置的图像.

我使用MAMP,phpMyAdmin,并且遵循此人的指导(

解决方案

按照这些人的说明编写localhost:8888/demo-form.php

  • 并更改您的php文件以链接到datebase表单1而不是数据库表演示.

How do i get my local .php file to show up, so i see my form. When i write local host and then path of .php file i get "Not Found" page.

If i add :8889 to local host it seems to run via MySQL-port(8889) instead of Apache-port(8888) and then safari just downloads the file to my downloads.

Here i have attached an images that shows all my settings.

I use MAMP, phpMyAdmin and i follow the guide of this guy (https://youtu.be/wp6Ngpk5XiY?list=PL530D33D6E548481F (17.05=troubleshooting))

Here is the code he use (i have copied his source code)

The communication to MySQL:

    <?php

define('DB_NAME', 'demo');
define('DB_USER', 'root');
define('DB_PASSWORD', 'root');
define('DB_HOST', 'localhost');

$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);

if (!$link) {
    die('Could not connect: ' . mysql_error());
}

$db_selected = mysql_select_db(DB_NAME, $link);

if (!$db_selected) {
    die('Can\'t use ' . DB_NAME . ': ' . mysql_error());
}

$value = $_POST['input1'];
$value2 = $_POST['input2'];

$sql = "INSERT INTO demo (input1, input2) VALUES ('$value', '$value2')";

if (!mysql_query($sql)) {
    die('Error: ' . mysql_error());
}

mysql_close();
?>

The form:

<form action="demo.php" method="post" />
<p>Input 1: <input type="text" name="input1" /></p>
<p>Input 2: <input type="text" name="input2" /></p>
<input type="submit" value="Submit" />
</form>

解决方案

Follow this guys instructions and write localhost:8888/demo-form.php

Problems with MAMP on Yosemite 10.10 i use 10.10.5 i also worked for me

  • And change your php file to link to the datebase forms1 and not the database table demo.

这篇关于使用MAMP&amp; amp; amp;的本地主机设置phpMyAdmin.在此服务器上找不到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆