It’s creating the file in the same directory as your script. Try this instead.
$content = "some text here";
$fp = fopen($_SERVER['DOCUMENT_ROOT'] . "/myText.txt","wb");
fwrite($fp,$content);
fclose($fp);
More Related Contents:
- Php condition doesn't work for html [closed]
- Using while in for loop (PHP) [closed]
- Im trying to create some temporary tables in mysql using php
- Divide php echo rows into 3 columns
- How do you parse and process HTML/XML in PHP?
- How can I create friendly URLs with .htaccess?
- Is there an easy way to convert a number to a word in PHP?
- “The page has expired due to inactivity” – Laravel 5.5
- How do I show multiple recaptchas on a single page?
- PHP Foreach Pass by Reference: Last Element Duplicating? (Bug?) [duplicate]
- Why does the PHP json_encode function convert UTF-8 strings to hexadecimal entities?
- Convert latin1 characters on a UTF8 table into UTF8
- PHP DOMDocument failing to handle utf-8 characters (☆)
- in_array multiple values
- if statement in the middle of concatenation? [closed]
- How to use the php that brew installed?
- upload large files using php, apache
- How to set default value for form field in Symfony2?
- How to get the OS on which PHP is running?
- pg_query result contains strings instead of integer, numeric
- Php – Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- PHP: Check if variable exist but also if has a value equal to something
- How to remove the leading character from a string?
- get_headers Inconsistency [closed]
- Stop data inserting into a database twice
- Dynamic Comparison Operators in PHP
- MySQL GROUP BY and Fill Empty Rows
- How do I get the function name inside a function in PHP?
- Conditionally add associative element to array
- PHP Get Content of HTTP 400 Response