IThinkMyBrainHurts Posted April 19, 2015 Share Posted April 19, 2015 Hi, I've written a CMS, works fine on my Linux dev OS. I've just setup WAMP on a Win machine and it's complaining at this: <?php define('NUBBASE', 'http://localhost/cms/site/'); define('NUBDIR', 'C:\wamp\www\cms\site\'); function rx_settings(){ return array ('sitename' => 'mysite.co.uk', 'sitetag' => 'Developing minds...', 'db_host' => 'localhost', 'db_uname' => 'testuser', 'db_pass' => 't3st3rspasSw0rd', 'db_dbname' => 'dbtest', 'db_prefix' => 'nub_', 'sitesalt' => 'rxWhsqSkWk' ); } ?> Thisis the error I'm getting: Parse error: syntax error, unexpected 'sitename' (T_STRING) in C:\wamp\www\cms\site\nub\config.php on line 6 Line 6 is the line with "sitename" on. I've tried swapping the quotes, gone through and replaced all line endings. What's going wrong here? Any other things I could expect? Cheers Quote Link to comment Share on other sites More sharing options...
Solution blacknight Posted April 19, 2015 Solution Share Posted April 19, 2015 urls and directory listings always use / not \ \cms\site\'); the \ before the ' escapes it so the script will not read it change the \ in the path to / and you should be fine ... 1 Quote Link to comment Share on other sites More sharing options...
IThinkMyBrainHurts Posted April 19, 2015 Author Share Posted April 19, 2015 lol, makes perfect sense, doh! However, that path is generated by __DIR__: $ndir=rtrim(__DIR__,"nub"); On searching i'm not seeing this issue mentioned... or output showing similar either??? Yes, Ican replace these manually, issue solved. However is this the expected behaviour of __DIR__ or ...? Cheers Quote Link to comment Share on other sites More sharing options...
IThinkMyBrainHurts Posted April 19, 2015 Author Share Posted April 19, 2015 So... $ndir=str_replace('\\','/',rtrim(__DIR__,"nub")); // Pre PHP 5.3 use dirname(__FILE__) instead of __DIR__ Since Windows handles both path types, whereas Linux doesn't. This way the config file can be transferred easily without re-install! Cheers Quote Link to comment 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.