kendo101 Posted July 16, 2015 Share Posted July 16, 2015 Hello, I am creating a simple module that needs to create a file, I am testing with the following code: $myfile = fopen("newfile.txt", "w") or die("Unable to open file!"); $txt = "John Doe\n"; fwrite($myfile, $txt); fclose($myfile); echo("DONE! SHOULD HAVE MADE THE FILE NOW"); It just writes a line to a simple .txt file. Now if I put this in a php file in say: public_html/testing/testing.php, it works fine. But when I run the snippet within the module I am creating I also get the response "DONE! SHOULD HAVE MADE THE FILE NOW" but no file is created and no error is thrown. I'm not sure how I should debug the problem. Does anyone know of why its having trouble creating files and why it doesn't throw any errors? Debugging in TRUE. Link to comment Share on other sites More sharing options...
Kerm Posted July 17, 2015 Share Posted July 17, 2015 (edited) Perhaps problem is that you need first identify right path to the file, check also file permissions. Edited July 17, 2015 by Kerm (see edit history) Link to comment Share on other sites More sharing options...
kendo101 Posted July 17, 2015 Author Share Posted July 17, 2015 Hi Kerm, Can you elaborate on that? When running this snippet outside of the module, it simply creates the txt file in the same location as the php file. I would expect this to happen within the module also since I do not specify the path, it should create it in the same location as the script creating the file. Host has taken a look at file permissions and said it should work, I was not specific on what they should be checking however. Wouldn't it throw an error if it had issue creating the file? Right now it says it did not run into any problems yet it did not do its job. Link to comment Share on other sites More sharing options...
vekia Posted July 18, 2015 Share Posted July 18, 2015 from what part of shop the function to create file is called? front office or back office? Link to comment Share on other sites More sharing options...
rohit_prakash95 Posted March 2, 2017 Share Posted March 2, 2017 down votefavorite I am new in Prestashop module development. I am trying to create a txt file at the time of module installation, but neither it create file nor it showing error. [ ref: http://stackoverflow.com/questions/42548165/how-to-create-file-in-prestashop-module-folder-at-time-of-installation ] 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