2

I am running a non framework php7 site on an ubuntu server. (18.4)

There is no issue when on my local machine.

I have a controller that attempts to create a file.

fopen("new.txt", "w");

No error is thrown, but no file is created. Note: same issue with copy($src,$dest);

I set the directory and file to CHMOD 777.

'fopen' works in the directory when i use the cli,

PHP -a  fopen("new.txt", "w");

The program uses the php functions unlink() & chmod() else where in the program with no issues.

Is there a php.ini setting I have to enable to allow php web scripts to create files on apache?

seamus
  • 2,681
  • 7
  • 26
  • 49
  • does `fopen("new.txt", "r");` work? – Moses Schwartz Aug 22 '19 at 23:53
  • 2
    If it doesn't create the file, it should produce a warning with the reason. Have you enabled [error reporting](https://stackoverflow.com/questions/845021/how-can-i-get-useful-error-messages-in-php)? – Barmar Aug 23 '19 at 00:19

0 Answers0