GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   Another PHP little question (https://gfy.com/showthread.php?t=1081867)

EN1GMA 09-17-2012 05:00 AM

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 09-17-2012 05:28 AM

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 :thumbsup

adult-help 09-17-2012 05:54 AM

i think you should also check if you have safe_mode and open_basedir off or on..

EN1GMA 09-17-2012 06:59 AM

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?

xxxtubers 09-17-2012 02:08 PM

With this code you get the same error?

PHP Code:

 <?php include '../../username_website_a/public_html/block/content.php'?>


pornsprite 09-25-2012 07:49 PM

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

porkbrothersdotnet 09-25-2012 10:11 PM

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.

supersexysnow 10-20-2012 12:59 PM

php includes!

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

that should do it!

robber 10-20-2012 03:13 PM

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

livexxx 10-20-2012 03:30 PM

Does
<?php include '/home/username_website_a/public_html/block/content.php'; ?>
work in website A as well ?


All times are GMT -7. The time now is 10:35 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc