Asdiff Posted December 16, 2015 Share Posted December 16, 2015 Hello, I'm building a module which needs to copy a template file from its module directory to /templates/default/. I'm using copy(source, dest) and I don't even get an error message with active debugging. Just nothing happens. I assume there is some kind of permission problem, but I don't know where to start with that, since I'm not very familiar with Linux (the server runs apache2 on it). Thank you for any help! This is what I'm using for tests the ___install() function of the module: $path = wire(config)->paths->siteModules.'fma-helper/'; copy($path.'_head_metadata.php', $path.'testtesttest.php') Link to comment Share on other sites More sharing options...
LostKobrakai Posted December 16, 2015 Share Posted December 16, 2015 I'd suggest using wireCopy(), but you should also make sure, that php does have sufficient access rights to the sourcefile as well as the destination folder. Edit: Sry, thought this would also be for single files, but it seems it's only for copying whole directories. 1 Link to comment Share on other sites More sharing options...
Asdiff Posted December 16, 2015 Author Share Posted December 16, 2015 Can I raise the permissions for PHP inside a module? It wouldn't make much sense if the user has to do it vimself. Link to comment Share on other sites More sharing options...
LostKobrakai Posted December 16, 2015 Share Posted December 16, 2015 If you can install processwire correctly it's probably not an permission issue, but no you cannot add missing permissions to the user running apache and php. Link to comment Share on other sites More sharing options...
kongondo Posted December 16, 2015 Share Posted December 16, 2015 @Asdiff, Welcome to ProcessWire and the forums. Have a read here about determining file permissions (who Apache is running as, etc): https://processwire.com/docs/security/file-permissions/ Link to comment Share on other sites More sharing options...
Craig Posted December 16, 2015 Share Posted December 16, 2015 $path = wire(config)->paths->siteModules.'fma-helper/'; copy($path.'_head_metadata.php', $path.'testtesttest.php') Shouldn't this be wire('config') - with quotes around the config? Also, echo out $path to make sure it is what you expect. Link to comment Share on other sites More sharing options...
Asdiff Posted December 16, 2015 Author Share Posted December 16, 2015 It worked without quotes as well, bit gives a notice when you turn on Debugging. The path is also correct. Looks like I just have to ask the user to copy the file. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now