简体   繁体   中英

exec() doesn't work as expected

I'm running a script using exec from a php file. In the scipt there is a creation of a folder and a file inside it. The folder is created well but it remains empty after the script is finished. I have looked at the return value from the exec call and everything seems about right, so I'm not sure if it's permissions problem or not(wouldn't I get permission denied if that was the case?). Anyway if it is permission problem' please tell me how to give the right permissions to the www-data user.

[Edit]: I have played with the script a little and I saw that it can create files in that folder. The problem is, that the script create the file I need like this: sqlite3 myFile.db < mySql.sql , so the problem is probably there. Any ideas?

After creating the folder please give permission to it by using below code

chmod("complete-folder-path", 0777);

After that create file in it. It will work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM