Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: php PDO codes runs on windows but does not run on linux

  1. #11
    Join Date
    Aug 2013
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    resolved. you need to enable output_buffering = on

    or programtically set it in the first line of all the php codes

    <?php ob_start(); ?>

    In conclusion, am still working on the rest of the code to ensure workability and will get back here after i might have finish.

    DynamicDrive: You guys are extremely wonderful
    Thank you

  2. #12
    Join Date
    Aug 2013
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    This fix the problem

    I loaded all pdo_mysql module in the php.ini at root directory

    At php.ini enable output_buffering by setting it to on or value 4096


    or programmatically embed it on every first line of the php

    <?php ob_start(); ?>

    and the last or very bottom of the page
    <?php ob_end_flush(); ?>

    The settles the whole thing. I can now enjoy PDO

    Thanks all. You guys are great. Am still working on other PDO codes and will get back should any thing goes wtong

    You guys are great

  3. #13
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 517 Times in 503 Posts
    Blog Entries
    5

    Default

    Quote Originally Posted by mutago View Post
    This fix the problem

    I loaded all pdo_mysql module in the php.ini at root directory

    At php.ini enable output_buffering by setting it to on or value 4096


    or programmatically embed it on every first line of the php

    <?php ob_start(); ?>

    and the last or very bottom of the page
    <?php ob_end_flush(); ?>

    The settles the whole thing. I can now enjoy PDO

    Thanks all. You guys are great. Am still working on other PDO codes and will get back should any thing goes wtong

    You guys are great
    I'm glad you figured it out.

    If your question has been answered, please mark your thread "resolved":
    • On your original post (post #1), click [edit], then click [go advanced].
    • In the "thread prefix" box, select "Resolved".
    • Click [save changes].


    Two things that might be helpful for you in the future:

    1) The fact that you have to use output buffering means that you have output being sent to the browser before you try to use header(). Using ob is just a monkeypatch (and will still fail if you ever happen to output more than 4096 bytes (your chunk size) before you try to set any headers). The real solution is to re-organize the order in which your script is written, so that all of your output happens after all of your program logic. Writing "PHP First" will also mitigate other problems in the future.

    2) If you did not fix your Location header string, you should still do so. Not all browsers will interpret what you have the same way, and some will ignore it because it is not well-formed.
    Quote Originally Posted by http://php.net/header
    Note:
    HTTP/1.1 requires an absolute URI as argument to Location: including the scheme, hostname and absolute path ...
    Your current example would be correctly written like so:
    Code:
    Location: http://example.com/absolute/path/to/sucess.php

  4. #14
    Join Date
    Feb 2006
    Posts
    227
    Thanks
    7
    Thanked 3 Times in 3 Posts

    Default

    Looks to me it looks like the variable $statement is not being evaluated to a boolean (true/false), and so whatever depends on this being 'true' is failing. To me, it is better to do this:
    Code:
     
    $statement->execute(array(':offender' => $usern,':offence' => $pass,':reporter_ip' => $ip_adres));
    
    # test your boolean here
    
    if ($statement) {
         header("location: sucess.php");
    }else{
         header("location: fail.php");
    }
    Last edited by Strangeplant; 10-15-2013 at 07:32 PM. Reason: missing words

  5. #15
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 517 Times in 503 Posts
    Blog Entries
    5

    Default

    the OP has stated that he found a solution, and this thread is starting to attract a lot of spam, so I'm going to close this thread. @mutago, if you have another question, you are welcome to start another thread.

Similar Threads

  1. Replies: 1
    Last Post: 12-09-2008, 01:35 PM
  2. PHP Windows or Linux
    By Hanky58 in forum PHP
    Replies: 6
    Last Post: 07-21-2008, 01:37 PM
  3. Mac - Linux - Windows
    By tacmig99 in forum Computer hardware and software
    Replies: 19
    Last Post: 08-24-2006, 01:13 PM
  4. Windows or Linux hosting?
    By Suzy in forum The lounge
    Replies: 1
    Last Post: 05-10-2005, 06:37 AM
  5. windows vs linux
    By sofy60 in forum JavaScript
    Replies: 2
    Last Post: 03-25-2005, 10:53 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •