PHP trouble..Please help
Results 1 to 5 of 5

Thread: PHP trouble..Please help

  1. #1
    Senior Member
    Join Date
    Dec 2001
    Posts
    304

    PHP trouble..Please help

    Ok. I am trying to get my site transfered over to a new server and I am having a bit of trouble.

    What I want to do is make my b2 news posts show up on the index page of the site.. easy enough, thats the way I have it set up on the old server.

    So I create my database and install b2 and then put the

    <?php include ("path/to/b2/index.php"); ?>

    and then upload it and go check it out and the page does not load at all. As soon as I remove that line it loads up quicker than ever.... I know that is the statement that I need to use so I dont understand why it dont work..

    I have access to the old server still so I took the index.php file off the server I am having trouble with and then upload it to the other server check it out and it works.... It shows the B2 posts.

    The question:

    Why would the same exact source work one place but not the other? Is there some sort of config to php.ini that needs to be done to use include statments?
    Violence breeds violence
    we need a world court
    not a republican with his hands covered in oil and military hardware lecturing us on world security!

  2. #2
    Senior Member
    Join Date
    Jan 2003
    Posts
    3,914
    You mentioned php.ini, was the last server a win system as well? I have noticed slight difference why migrating php from a win system to a linux system and vise versa. Usually this has been in older versions of php, but sometimes it does happen. One thing to keep an eye on, especially when making the change is your slashes in directory paths. And in answer to your question php.ini includes at least one, possibly more include_* variables. I'm not on my home system atm, so I can't help you with what they are.

  3. #3
    Senior Member
    Join Date
    Dec 2001
    Posts
    304
    Sorry I should have mentioned that the old server was freebsd and the new server is linux.

    Also just to clarify, when I uploaded the index script to the old server and it worked it was pulling the info from the new server so I know its not the database.
    Violence breeds violence
    we need a world court
    not a republican with his hands covered in oil and military hardware lecturing us on world security!

  4. #4
    Senior Member roswell1329's Avatar
    Join Date
    Jan 2002
    Posts
    670
    Did you make sure that your httpd.conf file on the new machine supports ".php" as a valid extension? I belive the entries are:

    DirectoryIndex index.html index.htm index.shtml index.cgi index.php3 index.php
    AddType application/x-httpd-php .php .php3
    LoadModule php4_module libexec/libphp4.so

    Probably fairly obvious, but I always forget it.
    /* You are not expected to understand this. */

  5. #5
    Junior Member
    Join Date
    Oct 2002
    Posts
    6
    Parsing drops out of PHP mode when a file is included, and gets into HTML mode at the beginning of the target file, and resumes again at the end. Any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags.

    There's no need of round brackets .. e.g. '(', ')', thus <?php include 'path/to/b2/index.php'; ?> might work well. It is not necessary to chmod the file to 755, but it is also not possible to include files if they are not world readable, as in 740 or 700.

    If this is still not working, try to use

    $success = @include(dirname(__FILE__).'/../index.php');
    if (!$success) { print 'Can not find page '.dirname(__FILE__).'/../index.php'; }

    if it's placed somewhere under the main file directory, or play with it until you'll find out what's the problem. Try use 'require()' (which gives you a FATAL error) instead of 'include()' funtion (which gives only a warning in case of certain errors). Few remote servers allow seeing the error/warnings log and you may find the problem on your screen in this way.

    GoodLuck
    Wh .. oops! Let\'s start over!

Posting Permissions

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