Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 禁止:你不';“您没有访问/访问此服务器的权限,WAMP错误。”_Apache_Windows 8_Phpmyadmin_Wamp_Wampserver - Fatal编程技术网

Apache 禁止:你不';“您没有访问/访问此服务器的权限,WAMP错误。”

Apache 禁止:你不';“您没有访问/访问此服务器的权限,WAMP错误。”,apache,windows-8,phpmyadmin,wamp,wampserver,Apache,Windows 8,Phpmyadmin,Wamp,Wampserver,我已在windows 8上安装了wamp,每次转到本地主机或phpmyadmin时都会收到上述错误。经过多次搜索,我找到了许多答案,其中包括将httpd.conf修改为Allow from All等。链接显示了这样一个常见的答案,并提供了更多信息 我的问题是,许多人认为它允许所有用户访问phpMyAdmin,并且它不安全、易受攻击等。我想创建完全安全的WAMP服务器,如果我这样做可以吗 有人能给我提供一些参考或信息吗?我发现最好(也是最不令人沮丧的)方法是从Allow-from-All开始,然后

我已在windows 8上安装了wamp,每次转到本地主机或phpmyadmin时都会收到上述错误。经过多次搜索,我找到了许多答案,其中包括将httpd.conf修改为
Allow from All
等。链接显示了这样一个常见的答案,并提供了更多信息

我的问题是,许多人认为它允许所有用户访问phpMyAdmin,并且它不安全、易受攻击等。我想创建完全安全的WAMP服务器,如果我这样做可以吗

有人能给我提供一些参考或信息吗?

我发现最好(也是最不令人沮丧的)方法是从
Allow-from-All
开始,然后,当您知道它会这样工作时,将其从127.0.0.1缩放到更安全的
Allow-from::1
(localhost)

只要防火墙配置正确,
Allow from all
就不会引起任何问题,但如果您不需要其他计算机来访问您的站点,最好只允许localhost

无论何时更改httpd.conf,不要忘记重新启动Apache。它们将在下一次启动之前生效


希望这足以让您开始,网上有很多文档可用。

添加
Allow from All
对我不起作用。然后我尝试了这个,它成功了

操作系统:Windows 8.1
Wamp:2.5

我在文件C:\wamp\bin\apache\apache2.4.9\conf\extra\httpd-vhosts.conf中添加了这个


服务器管理员localhost@localhost.com
DocumentRoot“c:/wamp/www/”
服务器名本地主机
服务器别名本地主机
ErrorLog“logs/localhost error.log”
CustomLog“logs/localhost access.log”通用

默认情况下,wamp将以下内容设置为任何未明确声明的目录的默认值:

<Directory />
    AllowOverride none
    Require all denied
</Directory>
注意:当我只有来自所有的
允许时,我仍然被拒绝了权限。添加
Require local
对我有帮助。

1。

首先 端口80(或您正在使用的任何端口)和443必须同时允许TCP和UDP数据包。为此,在Windows防火墙上为端口80和443的TPC和UDP创建2个入站规则。 (或者您可以禁用整个防火墙进行测试,但如果允许入站规则,则禁用永久解决方案)

2.

如果您使用的是WAMPServer 3,请参阅答案的底部 对于WAMPServer的WAMPServer版本,有一个为
localhost
预定义的虚拟主机,因此根本不要修改
httpd.conf
文件,请保持原样

使用菜单编辑
httpd vhosts.conf
文件

应该是这样的:

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

服务器名本地主机
DocumentRoot D:/wamp/www
选项+索引+跟随符号链接+多视图
允许超越所有
要求本地
修改为

<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

服务器名本地主机
DocumentRoot D:/wamp/www
选项+索引+跟随符号链接+多视图
允许超越所有
要求所有授权
注意:如果您运行的wamp不是端口80,那么VirtualHost将类似于VirtualHost*:86。(86或您正在使用的端口),而不是VirtualHost*:80

3.
进行此更改后,不要忘记重新启动Wamp或Apache的所有服务

这可能是一种解决方案

public class RegisterActivity extends AppCompatActivity {

    private static final String TAG = "RegisterActivity";
    private static final String URL_FOR_REGISTRATION = "http://192.168.10.4/android_login_example/register.php";
    ProgressDialog progressDialog;

    private EditText signupInputName, signupInputEmail, signupInputPassword, signupInputAge;
    private Button btnSignUp;
    private Button btnLinkLogin;
    private RadioGroup genderRadioGroup;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        // Progress dialog
        progressDialog = new ProgressDialog(this);
        progressDialog.setCancelable(false);

        signupInputName = (EditText) findViewById(R.id.signup_input_name);
        signupInputEmail = (EditText) findViewById(R.id.signup_input_email);
        signupInputPassword = (EditText) findViewById(R.id.signup_input_password);
        signupInputAge = (EditText) findViewById(R.id.signup_input_age);

        btnSignUp = (Button) findViewById(R.id.btn_signup);
        btnLinkLogin = (Button) findViewById(R.id.btn_link_login);

        genderRadioGroup = (RadioGroup) findViewById(R.id.gender_radio_group);
        btnSignUp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                submitForm();
            }
        });
        btnLinkLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent i = new Intent(getApplicationContext(),MainActivity.class);
                startActivity(i);
            }
        });
    }

    private void submitForm() {

        int selectedId = genderRadioGroup.getCheckedRadioButtonId();
        String gender;
        if(selectedId == R.id.female_radio_btn)
            gender = "Female";
        else
            gender = "Male";

        registerUser(signupInputName.getText().toString(),
                signupInputEmail.getText().toString(),
                signupInputPassword.getText().toString(),
                gender,
                signupInputAge.getText().toString());
    }

    private void registerUser(final String name,  final String email, final String password,
                              final String gender, final String dob) {
        // Tag used to cancel the request
        String cancel_req_tag = "register";

        progressDialog.setMessage("Adding you ...");
        showDialog();

        StringRequest strReq = new StringRequest(Request.Method.POST,
                URL_FOR_REGISTRATION, new Response.Listener<String>() {

            @Override
            public void onResponse(String response) {
                Log.d(TAG, "Register Response: " + response.toString());
                hideDialog();

                try {
                    JSONObject jObj = new JSONObject(response);
                    boolean error = jObj.getBoolean("error");

                    if (!error) {
                        String user = jObj.getJSONObject("user").getString("name");
                        Toast.makeText(getApplicationContext(), "Hi " + user +", You are successfully Added!", Toast.LENGTH_SHORT).show();

                        // Launch login activity
                        Intent intent = new Intent(
                                RegisterActivity.this,
                                MainActivity.class);
                        startActivity(intent);
                        finish();
                    } else {



                        String errorMsg = jObj.getString("error_msg");
                        Toast.makeText(getApplicationContext(),
                                errorMsg, Toast.LENGTH_LONG).show();
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }

            }
        }, new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError error) {
                Log.e(TAG, "Registration Error: " + error.getMessage());
                Toast.makeText(getApplicationContext(),
                        error.getMessage(), Toast.LENGTH_LONG).show();
                hideDialog();
            }
        }) {
            @Override
            protected Map<String, String> getParams() {
                // Posting params to register url
                Map<String, String> params = new HashMap<String, String>();
                params.put("name", name);
                params.put("email", email);
                params.put("password", password);
                params.put("gender", gender);
                params.put("age", dob);
                return params;
            }
        };
        // Adding request to request queue
        AppSingleton.getInstance(getApplicationContext()).addToRequestQueue(strReq, cancel_req_tag);
    }

    private void showDialog() {
        if (!progressDialog.isShowing())
            progressDialog.show();
    }

    private void hideDialog() {
        if (progressDialog.isShowing())
            progressDialog.dismiss();
    }
    }
公共类注册表活动扩展了AppCompatActivity{
私有静态最终字符串标记=“RegisterActivity”;
用于注册的私有静态最终字符串URL“http://192.168.10.4/android_login_example/register.php";
进行对话进行对话;
private EditText signupInputName、signupInputEmail、signupInputPassword、signupInputAge;
私人按钮btnSignUp;
私人按钮btnLinkLogin;
私人放射组genderRadioGroup;
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity\u寄存器);
//进度对话框
progressDialog=新建progressDialog(此);
progressDialog.setCancelable(假);
signupInputName=(EditText)findViewById(R.id.signup\u input\u name);
signupInputEmail=(EditText)findViewById(R.id.signup\u input\u email);
signupInputPassword=(EditText)findViewById(R.id.signup\u input\u password);
signupInputAge=(EditText)findViewById(R.id.signup\u input\u age);
btnSignUp=(按钮)findViewById(R.id.btn_注册);
btnLinkLogin=(按钮)findViewById(R.id.btn\u link\u login);
genderRadioGroup=(放射组)findViewById(R.id.gender\u radio\u group);
btnSignUp.setOnClickListener(新视图.OnClickListener(){
@凌驾
公共void onClick(视图){
submitForm();
}
});
btnLinkLogin.setOnClickListener(新视图.OnClickListener(){
@凌驾
公共void onClick(视图){
Intent i=新的Intent(getApplicationContext(),MainActivity.class);
星触觉(i);
}
});
}
私有void submitForm(){
int selectedId=genderRadioGroup.getCheckedRadioButtonId();
字符串性别;
如果(选择eDid==R.id.female\u radio\u btn)
性别=“女性”;
其他的
性别=“男性”;
registerUser(signupInputName.getText().toString(),
signupInputEmail.getText().toString(),
signupInputPassword.getText().toString(),
性别,,
signupInputAge.getText().toString());
}
私有无效注册器(最终字符串名称、最终字符串电子邮件、最终字符串密码、,
最终字符串性别,最终字符串dob){
//用于取消请求的标记
字符串取消_
#   onlineoffline tag - don't remove
    Order Allow,Deny
      Allow from all
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot D:/wamp/www
    <Directory  "D:/wamp/www/">
        Options +Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
public class RegisterActivity extends AppCompatActivity {

    private static final String TAG = "RegisterActivity";
    private static final String URL_FOR_REGISTRATION = "http://192.168.10.4/android_login_example/register.php";
    ProgressDialog progressDialog;

    private EditText signupInputName, signupInputEmail, signupInputPassword, signupInputAge;
    private Button btnSignUp;
    private Button btnLinkLogin;
    private RadioGroup genderRadioGroup;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_register);
        // Progress dialog
        progressDialog = new ProgressDialog(this);
        progressDialog.setCancelable(false);

        signupInputName = (EditText) findViewById(R.id.signup_input_name);
        signupInputEmail = (EditText) findViewById(R.id.signup_input_email);
        signupInputPassword = (EditText) findViewById(R.id.signup_input_password);
        signupInputAge = (EditText) findViewById(R.id.signup_input_age);

        btnSignUp = (Button) findViewById(R.id.btn_signup);
        btnLinkLogin = (Button) findViewById(R.id.btn_link_login);

        genderRadioGroup = (RadioGroup) findViewById(R.id.gender_radio_group);
        btnSignUp.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                submitForm();
            }
        });
        btnLinkLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent i = new Intent(getApplicationContext(),MainActivity.class);
                startActivity(i);
            }
        });
    }

    private void submitForm() {

        int selectedId = genderRadioGroup.getCheckedRadioButtonId();
        String gender;
        if(selectedId == R.id.female_radio_btn)
            gender = "Female";
        else
            gender = "Male";

        registerUser(signupInputName.getText().toString(),
                signupInputEmail.getText().toString(),
                signupInputPassword.getText().toString(),
                gender,
                signupInputAge.getText().toString());
    }

    private void registerUser(final String name,  final String email, final String password,
                              final String gender, final String dob) {
        // Tag used to cancel the request
        String cancel_req_tag = "register";

        progressDialog.setMessage("Adding you ...");
        showDialog();

        StringRequest strReq = new StringRequest(Request.Method.POST,
                URL_FOR_REGISTRATION, new Response.Listener<String>() {

            @Override
            public void onResponse(String response) {
                Log.d(TAG, "Register Response: " + response.toString());
                hideDialog();

                try {
                    JSONObject jObj = new JSONObject(response);
                    boolean error = jObj.getBoolean("error");

                    if (!error) {
                        String user = jObj.getJSONObject("user").getString("name");
                        Toast.makeText(getApplicationContext(), "Hi " + user +", You are successfully Added!", Toast.LENGTH_SHORT).show();

                        // Launch login activity
                        Intent intent = new Intent(
                                RegisterActivity.this,
                                MainActivity.class);
                        startActivity(intent);
                        finish();
                    } else {



                        String errorMsg = jObj.getString("error_msg");
                        Toast.makeText(getApplicationContext(),
                                errorMsg, Toast.LENGTH_LONG).show();
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }

            }
        }, new Response.ErrorListener() {

            @Override
            public void onErrorResponse(VolleyError error) {
                Log.e(TAG, "Registration Error: " + error.getMessage());
                Toast.makeText(getApplicationContext(),
                        error.getMessage(), Toast.LENGTH_LONG).show();
                hideDialog();
            }
        }) {
            @Override
            protected Map<String, String> getParams() {
                // Posting params to register url
                Map<String, String> params = new HashMap<String, String>();
                params.put("name", name);
                params.put("email", email);
                params.put("password", password);
                params.put("gender", gender);
                params.put("age", dob);
                return params;
            }
        };
        // Adding request to request queue
        AppSingleton.getInstance(getApplicationContext()).addToRequestQueue(strReq, cancel_req_tag);
    }

    private void showDialog() {
        if (!progressDialog.isShowing())
            progressDialog.show();
    }

    private void hideDialog() {
        if (progressDialog.isShowing())
            progressDialog.dismiss();
    }
    }