-1

I am using Apache server on Linux Fedora 17. I have one PHP code which creates a .ini file. If I create the .ini file by running PHP code through Apache web server then rest PHP code files are able to read the .ini file data as its owner is Apache. But if I run the PHP code from Linux terminal and generate that .ini file then rest PHP code files are not able to read the file data as the owner is root. I tried changing group and file owner of .ini file from root to Apache from terminal but still it is not working.

  • You need to define "it is not working". We can't help if we don't know what is broken. Error messages, example output. What is it doing? What should it be doing? etc – Patrick Sep 10 '14 at 12:38
1
  1. You are running the php script as 'root' user, which is why the .ini file is getting created with root ownership.

  2. Even if the file is getting created with 'root' as its owner, the other 'php code files' should be able to read it since it will, in all probability, have read permission for 'others'. So here, you need to check the permissions of the directory in which the .ini file is getting created.

  • Yes i am running as root user. But created file have all 644 access. After changing the owner also (chown apache:apache) the php code is not able to read the file.Given permissions as 755 to file after changing the owner. Still php code not able to read – Sne Sep 11 '14 at 8:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.