For example, if php is used to read linux files, you can write an example of php reading the content of linux files and displaying the content. for example, the absolute linux path of my files is etcabc. conf, I changed the file permission to 777, which I wrote as follows: & lt ;? & Nbsp; $ testfile & quot; etcabc. conf & quot; & nbsp; $ fpfopen ($ testfile, php reads linux files
Please help me write an example for php to read the content of the linux file and display it. for example, in my file linux absolute path/etc/a/B/c. conf, I changed the file permission to 777.
I wrote this:
$ Testfile = "/etc/a/B/c. conf ";
$ Fp = fopen ($ testfile, 'R + ');
$ Outputtext = fgets ($ testfile, filesize ($ testfile ));
Echo "$ testfile text content:". $ outputtext;
Fclose ($ fp)
?>
But there is no output. what is the problem? Is there a problem with writing the file path or is there any other reason?
------ Solution --------------------
File_get_contents () try this