Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Thread: PHP copy() function

  1. #1
    Join Date
    Jan 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default PHP copy() function

    Hi there,

    I'm having trouble with PHP's copy() function, and I have no idea what the solution is, any help muchly appreciated!

    I'm trying to copy a .php file from one directory to another directory. However when I copy the .php file, it copies fine, BUT when I run the file, it just plain skips the PHP coding within the file, as if it's // taged out... When I copy the file through my FTP client manually, it works fine. I have NO idea why it's doing this!

    Anyone have any ideas?

    Thanks,

    Stu

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Make sure the execute bits are set. Is the PHP code visible if you view the page source?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jan 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hi Twey,

    Thanks for your reply, I've just got a quick question:

    Execute bits?

    ... and as for the PHP running, even a simple
    PHP Code:
    include 'footer.php'
    line isn't running, so no footer is being shown, among other missed bits which all work fine if I upload the file through my FTP client manually.

    Thanks

    Stu

    p.s.

    Oh and also, if I re-upload the file (as I have a copy on my harddrive), and overwrite the file on the server that the PHP copy() function created, the file still doesn't work... which is odd, I'm guessing it might be some kind of permission problem? In the PHP admin file that's doing the copying, I used chmod() to change the file permission to 777 right after I copied it, if that makes any difference?
    Last edited by stu2000; 01-19-2009 at 07:23 PM. Reason: added ps

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Of course the footer isn't being shown, but is there a <?php include 'footer.php; ?> in the page source somewhere? The surrounding <> will render it an unknown tag to the browser, so it probably won't be displayed.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jan 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hi Twey,

    yeah, two of the lines within the page are
    PHP Code:
    <?php include 'header.php'?>
    and

    PHP Code:
    <?php include 'footer.php'?>
    But there are other calls to the database etc that are also totally ignored.

    How do you mean that the surrounding <>'s will render it an unknown tag to the browser?

    Thanks,

    Stu

  6. #6
    Join Date
    Jan 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    When you say 'in the page source', do you mean the output that can be see by clicking 'view source'? As that's a no, the code isn't:

    HTML Code:
    &lt;?php include 'footer.php' ?&gt;
    it's still how it should be, i.e:

    PHP Code:
    <?php include 'footer.php'?>
    and instead of outputting the footer, the page source is just:

    HTML Code:
    <html>
    <body>
    </body>
    </html>
    Stu

  7. #7
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    HTML Code:
    &lt;?php include 'footer.php' ?&gt;
    That doesn't look good, if PHP is enabled - it shouldn't be showing up in the page source, it should be completely hidden, are you sure the file is saved as .php and that your host has PHP enabled?

  8. #8
    Join Date
    Jan 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    no no, I mean the code isn't

    HTML Code:
    &lt;?php include 'footer.php' ?&gt;
    it displays nothing in the source, and if I download the file and open it in an HTML editor, it looks fine, as in:

    PHP Code:
    <?php include 'footer.php' ?>
    Stu

  9. #9
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    I see, any chance you could link to the page, and are you sure PHP is enabled in the server you are using?

  10. #10
    Join Date
    Jan 2009
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    yeah, no problem,

    a couple of examples here, the first one, is the file copied by the PHP copy() function (which is now displaying absolutely nothing! I just got the background image before and nothing else):

    http://www.lynchfordaquatics.co.uk/n.../testprod1.php

    and this next one is the same file, I downloaded, renamed and uploaded through my FTP client:

    http://www.lynchfordaquatics.co.uk/n.../testprod2.php

    As you can see, this one displays everything as it should do, even though it is exactly the same file.

    Thanks Schmoopy

    p.s.

    If the actual code of the php file would help you, let me know and I can post it for you, thanks for your help!
    Last edited by stu2000; 01-20-2009 at 11:21 AM. Reason: added ps

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
  •