the5thace Posted July 29, 2013 Share Posted July 29, 2013 I'm just trying to load some of the echoed results in to a txt file that I can use myself. I assumed that there should be a txt file in my server directory but no file has been created. What am I doing wrong? while ($blekr<=$blekko_count) { echo '<a href='.$Blekko[$blekr]['url'].'><h4>'.$Blekko[$blekr]['url_title'].'</h4></a>'; echo '<p>'.$Blekko[$blekr]['snippet'].'<p>'; echo '<b>'.$Blekko[$blekr]['engine'].'</b>'; $file = 'Blekko.txt'; file_put_contents($file, $Blekko[$blekr]['url'], FILE_APPEND); echo '<hr>'; $blekr++; } The echo statements run fine but no file anywhere to be found. There isn't anything said in the manual either ... Link to comment https://forums.phpfreaks.com/topic/280621-why-hasnt-file_put_contents-created-a-txt-file-in-my-working-directory/ Share on other sites More sharing options...
AbraCadaver Posted July 29, 2013 Share Posted July 29, 2013 error_reporting(E_ALL); ini_set('display_errors', '1'); Link to comment https://forums.phpfreaks.com/topic/280621-why-hasnt-file_put_contents-created-a-txt-file-in-my-working-directory/#findComment-1442576 Share on other sites More sharing options...
the5thace Posted July 29, 2013 Author Share Posted July 29, 2013 Ah, thanks what do I need to do in case of Warning: file_put_contents(Blekko.txt) [function.file-put-contents]: failed to open stream: Permission denied in /home/msc2012/12254822/public_html/safe_dir/Almost_Gs.php on line 369 Link to comment https://forums.phpfreaks.com/topic/280621-why-hasnt-file_put_contents-created-a-txt-file-in-my-working-directory/#findComment-1442577 Share on other sites More sharing options...
AbraCadaver Posted July 29, 2013 Share Posted July 29, 2013 You either need to create the file and give the apache/web server user write permissions to it, or give write permissions to that directory. Link to comment https://forums.phpfreaks.com/topic/280621-why-hasnt-file_put_contents-created-a-txt-file-in-my-working-directory/#findComment-1442581 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.