Fopen ("testfile", "w) cannot create files on the server

Source: Internet
Author: User
The php Physical Function fopen () on w3c is prompted by w3c body, but I still don't know how to get the permission. "If you try to run this code, an error occurs, check whether you have the permission to access the PHP file that writes information to the hard disk." PHPWarning: fopen(testfile.txt):... the physical function fopen () of php on w3c ();

This is a message from w3c, but I still don't know how to get the permission. "if an error occurs when you try to run this code, check whether you have the PHP file access permission to write information to the hard disk ."

PHP Warning: fopen(testfile.txt): failed to open stream: Permission denied in C: \ inetpub \ wwwroot \ fopen_tester.php on line 11

Reply content:

Learning the w3c php Physical Function fopen ();

This is a message from w3c, but I still don't know how to get the permission. "if an error occurs when you try to run this code, check whether you have the PHP file access permission to write information to the hard disk ."

PHP Warning: fopen(testfile.txt): failed to open stream: Permission denied in C: \ inetpub \ wwwroot \ fopen_tester.php on line 11

You do not have the w permission on this directory.

It has nothing to do with the editor. You need to specify the IIS permission to access the directory. If you want PHP to create files at will, it is surprising that once your permissions are cracked, hacker will be able to create files at will.

$fp = @fopen($test_file, 'wb');if ($fp === false){    return $mark; }

  1. Ls-la
  2. Ps-ef | grep webServer
  3. Then give the web server write permission to a specific directory

Check whether the apache user has the permission to operate the directory.

Try this? Online debugging http://phpedia.net/8ouhug5k

You can directly copy the w3c code without configuring the local environment.

If you want to debug the folder locally, check whether the folder is in read-only mode? Right-click to select read/write. If not, check the settings in IIS to check whether data can be written.

Run your PHP program as an administrator

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.