PHP Failed opening required (include_path= '.; C:\php\pear ') ____php

Source: Internet
Author: User
Tags pear

Today in doing an MVC program, required path times wrong, repeatedly feel their program is right after the endless Baidu Road, have to say Baidu solution is uniform. Here to write my own question;


have to say to solve the problem before the problem of their own repeatedly to see if the program has been written right;
See if you wrote it right;
make sure that your program is logical.

The important thing to say three times.


Like I made a mistake.
Here is my file directory:





That's what my index file says:


<?php 
    /**
    * Program entry file 
    *
    //Set Default entry file
    $default _controller = ' Main ';
    $default _action = ' Index ';

    $current _controller = isset ($_get[' C '])? $_get[' C ']: $default _controller;
    $current _action = isset ($_get[' a '])? $_get[' A ']: $default _action;
    Define (' CONTROLLER ', $current _controller);
    Define (' ACTION ', $current _action);

    Require ' controller/'. CONTROLLER. '. Class.php ';
    $controller _use = controller. ' Controller ';   
    $controller = new  $controller _use ();
    $action _use = action. ' Action ';
    $controller-> $action _use ();
 ? >



Obviously, I've declared a default action method under controller.


And then I wrote it in the default Maincontroller:


<?php 
    /**
     * Master Controller (default controller) 
     * Display Home */

    class Maincontroller 
    {public

        function indexaction ()
        {
            //require ' d:/php/wamp/www/myshop/view/index.html ';
            Require '.. /view/index.html ';
        }

 ? >



See here everyone knows why it went wrong.



It's obvious (it's not obvious, it hasn't been written before) require the path is supposed to be the same as index.php. Should be flat with index.php. The path should be judged from the entry file. you should say three times about the important things of/view/index.html, admonish myself, and tell you that you may make mistakes.


Never make sure your path is right, then go and confirm it again.
No, please try the absolute path can not be implemented, most of the words are your own path problem.


if not, please try the following methods.


The following is a summary of what I have read on the Internet. It is recommended to perform in order.

1. folder does not use Chinese, because the configuration file encoding mode does not necessarily support Chinese
2. PHP Failed opening required PHP has no open requirements try to give your project Full Control permissions
3. Mentioned on the net: Remove all the './For '/(that is, remove the middle point), and common.inc.php the "./" in the PHP file in the root directory of "index.php". can be accessed normally. (Use caution without testing)
4. nclude_path= '.; C:\php5\pear ' Wamp the path in the PHP installation (folder without Chinese name) include_path= ' C:\php5\pear ' or in the php.ini there is this line, remove the ";", and then restart the Web server.; include_ Path = ".; D:\AppServ\www\ZendFramework-1.5.0RC1\library "(the same without the test of personal feeling without any principle)

The last two recommendations are carefully used, if you can not modify or recommend the restore operation, after all, is the environment configuration.

I hope to be of some help to you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.