nathanmaxsonadil Posted August 15, 2007 Share Posted August 15, 2007 What's wrong with this if statment? if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE) { $system_folder = str_replace("", "/", realpath(dirname(__FILE__))).'/classes/'; } It gives me this error Parse error: syntax error, unexpected T_STRING in my_dir/install.php on line 8 Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/ Share on other sites More sharing options...
Orio Posted August 15, 2007 Share Posted August 15, 2007 You didn't close the brackets of the str_replace. Sorry my bad- its not the problem Orio. Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325123 Share on other sites More sharing options...
nathanmaxsonadil Posted August 15, 2007 Author Share Posted August 15, 2007 I dont understand what you mean Can you show me how to fix the code? Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325133 Share on other sites More sharing options...
lemmin Posted August 15, 2007 Share Posted August 15, 2007 Are you sure? It looks to me like he did. I would think that "__FILE__" is the problem. Is that defined somewhere? Can you define something to start wtih an underscore? try changing that. Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325136 Share on other sites More sharing options...
trq Posted August 15, 2007 Share Posted August 15, 2007 The line number php reports an error on is not always the precise line. I don't see any errors there, can we maybe see a few more previous lines. Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325138 Share on other sites More sharing options...
Orio Posted August 15, 2007 Share Posted August 15, 2007 <nvm my mistake!!> Orio. @lemmin that is a predefined constant. Check this. Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325139 Share on other sites More sharing options...
trq Posted August 15, 2007 Share Posted August 15, 2007 would think that "__FILE__" is the problem. Is that defined somewhere? Can you define something to start wtih an underscore? try changing that. __FILE__ is a built in constant. Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325142 Share on other sites More sharing options...
lemmin Posted August 15, 2007 Share Posted August 15, 2007 Whoa cool, thanks Orio, I learn something new here everyday! Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325146 Share on other sites More sharing options...
nathanmaxsonadil Posted August 15, 2007 Author Share Posted August 15, 2007 ok here's my code from line 1 to 11 1 <?php 2 ob_start(); 3 session_start(); 4 $dbuser = 'my_user'; 5 $dbpass = 'mypass'; 6 $dbhost = 'localhost'; 7 $db = 'my_db; 8 if (function_exists('realpath') AND @realpath(dirname(__FILE__)) !== FALSE) 9 { 10 $system_folder = str_replace("", "/", realpath(dirname(__FILE__))).'/classes/'; 11 } P.S: sorry for not replying back soon I was reading something else Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325152 Share on other sites More sharing options...
nathanmaxsonadil Posted August 15, 2007 Author Share Posted August 15, 2007 lol I forgot to put a end ' on line 7 Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325160 Share on other sites More sharing options...
akitchin Posted August 15, 2007 Share Posted August 15, 2007 you're missing a closing single quote on the line before it.. honestly, a little bit of syntax highlighting or even two minutes of hard searching could have shown that. EDIT: you beat me to it. seriously, spend a little bit of time trying to find the error on your own before defaulting to us to find the parse error. parse errors should be fairly easy to resolve, since they're usually a symptom of some careless or inattentive programming. Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325162 Share on other sites More sharing options...
Daniel0 Posted August 15, 2007 Share Posted August 15, 2007 EDIT: you beat me to it. seriously, spend a little bit of time trying to find the error on your own before defaulting to us to find the parse error. parse errors should be fairly easy to resolve, since they're usually a symptom of some careless or inattentive programming. Syntax highlighting would also point a such error out quite easily. Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325164 Share on other sites More sharing options...
nathanmaxsonadil Posted August 15, 2007 Author Share Posted August 15, 2007 I looked at it but I guess I missed it when I looked at my post i saw what was the problem Link to comment https://forums.phpfreaks.com/topic/65139-solved-parse-error-syntax-error-unexpected-t_string/#findComment-325167 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.