golden3159 Posted October 1, 2007 Share Posted October 1, 2007 Hi, im new here, trying to learn php. I am trying to include a file from my index to one located in '/folder/folder2/file.php'. I am using the absolute url. However, I keep getting Parse error: parse error, unexpected T_STRING in http://mydomain.com/folder1/folder2/file.php on line 1 However, when I visit the page manually, it works fine. My line 1 is '<?php' This problem is causing me to tear out my hair, I can't continue until its fixed! It only happens with php files, I can include .html files with no issue. Please help! EDIT: The code im using to include is: <?php include 'http://mydomain.com/folder1/folder2/file.php'; ?> EDIT2: I think it has to do with me using absolute urls. I have enabled them in my php.ini but I think the host is blocking it. I have sen't then an email. MY host is godaddy and they let me use my own php.ini file. I have set the following: allow_url_include = on allow_url_fopen = on I know its a security risk but I just want to get this working, argh! In the meantime, can somebody please tell me how to include to the directory I need to without a full url? I have googled and tried different codes to no avail. Quote Link to comment https://forums.phpfreaks.com/topic/71430-solved-unexpected-t_string-in-line-1/ Share on other sites More sharing options...
sKunKbad Posted October 1, 2007 Share Posted October 1, 2007 try include ('http://mydomain.com/folder1/folder2/file.php'); Quote Link to comment https://forums.phpfreaks.com/topic/71430-solved-unexpected-t_string-in-line-1/#findComment-359581 Share on other sites More sharing options...
golden3159 Posted October 1, 2007 Author Share Posted October 1, 2007 try include ('http://mydomain.com/folder1/folder2/file.php'); I got the same message. Quote Link to comment https://forums.phpfreaks.com/topic/71430-solved-unexpected-t_string-in-line-1/#findComment-359620 Share on other sites More sharing options...
marcus Posted October 1, 2007 Share Posted October 1, 2007 Line one is [code=php:0] <?php Quote Link to comment https://forums.phpfreaks.com/topic/71430-solved-unexpected-t_string-in-line-1/#findComment-359622 Share on other sites More sharing options...
golden3159 Posted October 1, 2007 Author Share Posted October 1, 2007 Line one is [code=php:0] <?php Im sorry, what? Anyways, thanks for the help guys but I figured out the problem. Apparently my CMS (e107) does not allow for me to include a php page the way I want. So im going to have to think of another way. Thanks again, this forum has quick responses! Quote Link to comment https://forums.phpfreaks.com/topic/71430-solved-unexpected-t_string-in-line-1/#findComment-359654 Share on other sites More sharing options...
sKunKbad Posted October 2, 2007 Share Posted October 2, 2007 ok, at least on my server(s), you are not able to include files with the http:// prefix. You must use a relative path such as: <?php include '../robots.txt'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/71430-solved-unexpected-t_string-in-line-1/#findComment-359787 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.