0

I'm having problems while including php files in my php project. I'm using LAMP to run my php website locally on my ubuntu operating system. Everything works fine if I only try to include local php files, but it gives me problems if I try to include a remote file which is on my online website.

For example, it works if I include this file:

<?php include "base.php"; ?>

but if I upload this same file on my remote website and then I try to include it locally, it don't work:

<?php include "http://www.mywebsite.com/base.php"; ?>

The remote file has 755 permissions. Is there any restriction on LAMP configuration which deny remote file inclusion? This is very strange for me! :( I hope you can help me!

Marcus Barnet
  • 2,083
  • 6
  • 28
  • 36
  • I think `` this should be work for.Have you tried? – Chonchol Mahmud Apr 13 '16 at 09:34
  • I need to include the remote file and not the local file. I already switch ON the 'allow_url_include' in php.ini file but it still doesn't work and I still can't include remote php file in my project. – Marcus Barnet Apr 13 '16 at 09:41

1 Answers1

0

To include remote files , the directive allow_url_include must be set on in php.ini

Kindly go through this link

Hope this answers your query

Update :

Suppose , if you want to fetch the code source, you can add a symlink on the remote server,

e.g. ln -s somename.php somename.php.source

and then make your include reference somename.php.source instead.

the above suggestion credit goes to @PaulDixon

Update 1:

Just a second thought with confusion

Instead of ,

<?php include "http://www.mywebsite.com/base.php"; ?> 

Try this ,

<?php include 'http://www.mywebsite.com/base.php'; ?> 

Or this ,

<?php include ("http://www.mywebsite.com/base.php"); ?> 
Community
  • 1
  • 1
Raja Gopal
  • 1,845
  • 1
  • 17
  • 34
  • I already did this, but it doesn't work! I also restarted apache, but nothing changed! – Marcus Barnet Apr 13 '16 at 09:43
  • Unfortunately, I can't access to the remote server, I can only upload files on it. I can only control my local ubuntu installation. – Marcus Barnet Apr 13 '16 at 09:52
  • @MarcusBarnet try the Update1 in my answer and update me please – Raja Gopal Apr 13 '16 at 09:59
  • I tried but it doesn't work! :( This is a big problem for me because I really need to include this remote file in my local website. – Marcus Barnet Apr 13 '16 at 10:02
  • 1
    @MarcusBarnet I can understand your ache in solving this , Wright now i'm at my work . if you can hold for few hours say 4-5 hours , i can access your pc say via team viewer and can see in detail . if you are ok with that ping me at jjmmrg at gmail dot com . Good luck mate – Raja Gopal Apr 13 '16 at 10:16
  • Thank you!! I sent you an email! – Marcus Barnet Apr 13 '16 at 10:26