Another PHP little question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • EN1GMA
    Confirmed User
    • Nov 2005
    • 1252

    #1

    Another PHP little question

    Hello guys,

    Maybe someone can help me again with a PHP question.

    I have WEBSITE A and WEBSITE B

    In WEBSITE A I created a php file and I display the content on my index.php using this code:
    PHP Code:
    <?php include 'block/content.php'; ?>
    Now I want to display the exactly same file/content in WEBSITE B, for that I'm using this code:
    PHP Code:
    <?php include '/home/username_website_a/public_html/block/content.php'; ?>
    But I got the error:
    Code:
    Warning: include(/home/username_website_a/public_html/block/content.php) [function.include]: failed to open stream: Permission denied in /home/username_website_b/public_html/index.php on line 45
    
    Warning: include() [function.include]: Failed opening '/home/username_website_a/public_html/block/content.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/username_website_b/public_html/index.php on line 45
    The idea is to edit just one file and display changes in both websites.
    But Im a newbie and I dont know If this is possible.

    Can someone help me please? :-)
    Thanks!!
  • Antokas
    Confirmed User
    • Sep 2012
    • 41

    #2
    Hi,

    try
    PHP Code:
    <?php include '../username_website_a/public_html/block/content.php'; ?>
    or
    PHP Code:
    <?php include '../../username_website_a/public_html/block/content.php'; ?>
    work for me
    GFYpornHub.com

    Comment

    • adult-help
      Confirmed User
      • Mar 2008
      • 2450

      #3
      i think you should also check if you have safe_mode and open_basedir off or on..
      Adult web templates, Adult WordPress Themes, TGP, MGP..
      also Complete Wordpress PaySite Development - Adult WordPress Blog Themes - Free FHG Templates - Free PaySite Script - Adult Tutorials Directory - Adult Domain Marketplace - Adult Jobs

      Comment

      • EN1GMA
        Confirmed User
        • Nov 2005
        • 1252

        #4
        Thank you for your replies mates!

        adult-help, I have:

        open_basedir: no value
        safe_mode: off

        Do I need to put both of them on? Or just one of them? If yes, which one?
        And is secure to put them on?

        Comment

        • xxxtubers
          Confirmed User
          • Jun 2012
          • 152

          #5
          With this code you get the same error?

          PHP Code:
           <?php include '../../username_website_a/public_html/block/content.php'; ?>
          Best Webcam Affiliate Cam Traffic Profits

          Comment

          • pornsprite
            Confirmed User
            • Dec 2009
            • 1643

            #6
            The first thing you should do is prove to yourself that you have the right path to the file you want to include by checking it on the command line. Try typing this to if you a good response.

            "ls -l /home/username_website_a/public_html/block/content.php". If you don't receive an error you've got the right path if an error is returned you need to get find the correct path.

            I would worry about .. or ../.. because it looks like you are using a full path. You would only need to those if you are using relative paths.

            php includes always makes more sense to me when I write it like this
            <?php include("/home/path/to/file/I/want.php"); ?>

            I use double quotes in case I want to use variables that way the variable get interpolated
            Go Fuck Yourself

            Comment

            • porkbrothersdotnet
              Confirmed User
              • Aug 2011
              • 131

              #7
              Check you file permissions inside the directory

              /home/username_website_a/public_html/block/
              block should be 755 or 777. 777 gives the outside would access to any file that is in there.

              What I did in the past with a similar issue was to use an external readfile statement.

              <? readfile("http://path A/index.php"); >

              Edit the code on site B Insert the above statement in place of your statement that would normal display your output in side B. Any changes made on site A will automatically show up on site B.

              Give it a shot.
              Just Porn!

              Comment

              • supersexysnow
                Registered User
                • Dec 2011
                • 22

                #8
                php includes!

                Website B needs this adding:
                <?php include("hxxp://WebsiteA/want.php"); ?>

                that should do it!

                Comment

                • robber
                  Web Developer
                  • Jan 2011
                  • 264

                  #9
                  If they are two different users and PHP has been setup to restrict you to your own directory, the easiest way to have it work is to park the domain for website b onto website a then you can use relative references and also pay for one set of hosting

                  Good Luck

                  Rob

                  Comment

                  • livexxx
                    Confirmed User
                    • May 2005
                    • 1201

                    #10
                    Does
                    <?php include '/home/username_website_a/public_html/block/content.php'; ?>
                    work in website A as well ?
                    http://www.webcamalerts.com for auto tweets for web cam operators

                    Comment

                    Working...