简体   繁体   中英

Modify file permissions for files created with php

I use the tensorflow based program luminoth for object detection. To execute luminoth while it is installed on a server i use php. When luminoth starts the prediction, it creates a file named objects.json . In the end, it writes the result in this objects.json file. But when i execute it via php the prediction stops before writing the result. The permissions of the objects.json file are -rw-r--w--

I think it is because this permissions do not allow luminoth to write the result in this file. Do you think I am right? I tried to set permissions like

chmod 2777 /var/www/html

to test, but it does not work. I wrote in my sudoers file:

%www-data ALL=(ALL) NOPASSWD:ALL

I hope that I am right. Do you have any ideas?

Thanks!

First, touch the file:

touch objects.json

Then give only the permission it really needs:

chmod 644 objects.json

Maybe if you need, also set the correct owner:

chown user:group objects.json

Then execute your script:

php bin/run.php

Don't pass chmod 777 tryhard getting something to work. Use only the permission you need.

在此处输入图像描述

*) Image source: http://thisismao.com/wordpress/the-777-developer/

Try this (change path accordingly

sudo chmod 777 -R /var/www/html/{path}/objects.json

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