1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

PHP PHP mySql error??

Discussion in 'Web Development' started by ashebrian, Feb 11, 2009.

  1. ashebrian

    ashebrian New Member

    Can this database error be sorted via the php.ini settings?

    when i used the require-once function:
    Code:
    Warning: require_once(library/ccccc.php)  [[URL="https://epage.payandshop.com/merchants/skinlogic/internetretail/function.require-once"]function.require-once[/URL]]: failed to open stream: No such file or directory in  /home/****/public_html/include/rrrrr.php on line 2
    Fatal error:  require_once() [[URL="https://epage.payandshop.com/merchants/skinlogic/internetretail/function.require"]function.require[/URL]]: Failed opening required 'library/ccccc.php'  (include_path='.:/usr/lib/php:/usr/local/lib/php') in  /home/****/public_html/include/rrrrr.php on line  2
    or when i used the include function:
    Code:
    Warning:  include(library/ccccc.php) [[URL="https://epage.payandshop.com/merchants/skinlogic/internetretail/function.include"]function.include[/URL]]: failed to open stream: No such file or directory in  /home/****/public_html/include/rrrrr.php on line 2
    Warning:  include(library/ccccc.php) [[URL="https://epage.payandshop.com/merchants/skinlogic/internetretail/function.include"]function.include[/URL]]: failed to open stream: No such file or directory in  /home/****/public_html/include/rrrrr.php on line  2

    As from the blue text the path '.:/usr/lib/php:/usr/local/lib/php' is already set in php.ini. So thats fine.
    'allow_url_fopen = On' should also be set

    The files are already in the required folders.

    What i've actually did was copy the same shopping cart for the trade side to an extra one for the retail side with little changes. I've a feeling that if it works fine for the trade side then the php.ini is already set fine so that means i'll have to do it all from scratch. i think.


    Big job. Now i hate this error.

    I am using this to debug:
    PHP:
    ini_set('display_errors''On');
    //ob_start("ob_gzhandler");
    error_reporting(E_ALL);


    Is there another way for me to sort this. Is there a shorter debug that will pinpoint the problem?
     
  2. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    Stream failed most likely because you are calling it twice (you can only open a stream once, use it, then close it and then open it again), also your check path.
    The require_once() statement is identical to require() except PHP will check if the file has already been included, and if so, not include (require) it again.
    Files for including are first looked for in each include_path entry relative to the current working directory, and then in the directory of current script.

    When a file is included, the code it contains inherits the variable scope of the line on which the include occurs. Any variables available at that line in the calling file will be available within the called file, from that point forward. However, all functions and classes defined in the included file have the global scope.

    Your code with single quotes
    Code:
    [FONT=Arial]path '.:/usr/lib/php:/usr/local/lib/php' [/FONT]
    short_open_tag = Off
    ;it does not recognise '<?', only '<? php' or '<script>'
    Try using double quotes in the php.ini file
    Try <?php phpinfo(); ?> (to see info)

    Finally depending on the cart you are using, several will not run together on the same server without modifications. One way, You could try to create a sub- domain load one of them in there and use a redirector if you don't want your customers to know.
    Keep us posted.
     
  3. ashebrian

    ashebrian New Member

    Thanks for trying to help. After working on this for a few hours i have tried all:
    require_once()
    require()
    include()

    All these codes have displayed the errors but for the include() which displayed the errors and info i was looking to display without the errors.

    However, for this reason i used the include(), turned display errors off, and rewrote a little if statement code to allow an email sent. This seemed to be the easy way out as everything has run smoothly without a little problem.

    We all know that the include() bypasses the error and executes the rest of the code. We also know that its not the best solution as the error is still there, hiding away from our view.

    I will go back to this error and try and sort it once i'm not too busy....as i've a pile of work to do.

    From your post note you mentioned:
    Are you saying that we should never use require() but always use require_once() which could possibly solve my problem.
     
  4. ishkey

    ishkey Moderator, Logos, Sports Crests Staff Member Verified Member

    The required_once() statement replaces itself with the specified file, much like the C preprocessor's #include works, and in that respect is similar to the required() statement. The main difference is that in an inclusion chain, the use of required_once() will assure that the code is added to your script only once, and avoid clashes with variable values or function names that can happen.

    It is advised that you always put the complete URL in the require_once() perimeter ("http://www.yoursite.com/examplepage.php" and not just "examplepage.php") because URLs build on eachother based on their current location. If you put the entire URL in the perimeters, then the code will know exactly where to look for what code to carry over.