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 Link to comment https://forums.phpfreaks.com/topic/295688-testing-on-wamp/ Share on other sites More sharing options...
blacknight Posted April 19, 2015 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 ... Link to comment https://forums.phpfreaks.com/topic/295688-testing-on-wamp/#findComment-1509393 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 Link to comment https://forums.phpfreaks.com/topic/295688-testing-on-wamp/#findComment-1509394 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 Link to comment https://forums.phpfreaks.com/topic/295688-testing-on-wamp/#findComment-1509397 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.