steve51184 Posted August 17, 2010 Share Posted August 17, 2010 hi all i'm trying to make a quick and simple '.htaccess' installer and i'm using fopen/fwrite to do this but i'm getting an error: Parse error: parse error in /var/www/test.php on line 12 here's the code: <?PHP $File = ".htaccess"; $fh = fopen($File, 'a'); $Data = "\n#test write <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript text/x-js text/ecmascript application/ecmascript text/vbscript text/fluffscript AddOutputFilterByType DEFLATE image/svg+xml application/x-font-ttf application/x-font font/opentype font/otf font/ttf application/x-font-truetype application/x-font-opentype application/vnd.ms-fontobject application/vnd.oasis.opendocument.formula-template AddOutputFilterByType DEFLATE text/xml application/xml </IfModule> <IfModule mod_expires.c> <FilesMatch "\.(ico|gif|jpg|JPG|jpeg|png|PNG|swf|css|js|html?|xml|txt)$"> ExpiresActive On ExpiresDefault "access plus 1 month" </FilesMatch> </IfModule> #test write\n"; fwrite($fh, $Data); fclose($fh); ?> how do i include the code in the $Data string bit? Link to comment https://forums.phpfreaks.com/topic/210911-trying-to-append-data-to-a-file-with-phpfwrite/ Share on other sites More sharing options...
JasonLewis Posted August 17, 2010 Share Posted August 17, 2010 Did you look on line 12? You haven't escaped your quotes correctly. <FilesMatch "\.(ico|gif|jpg|JPG|jpeg|png|PNG|swf|css|js|html?|xml|txt)$"> So PHP is thinking you're ending the string $Data. Link to comment https://forums.phpfreaks.com/topic/210911-trying-to-append-data-to-a-file-with-phpfwrite/#findComment-1100141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.