|
-
January 15th, 2003, 09:55 PM
#1
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!
-
January 15th, 2003, 10:04 PM
#2
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.
-
January 15th, 2003, 10:15 PM
#3
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!
-
January 15th, 2003, 10:29 PM
#4
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. */
-
January 16th, 2003, 12:16 AM
#5
Junior Member
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
-
Forum Rules
|
|