Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Content-Type: text/plain; charset="UTF-8" Message-Id: <8844491.SEqChMirdb@PointedEars.de> From: Thomas 'PointedEars' Lahn Reply-To: Thomas 'PointedEars' Lahn Organization: PointedEars Software (PES) Date: Sat, 18 Jun 2011 08:20 +0200 User-Agent: KNode/4.4.7 Content-Transfer-Encoding: 8Bit Subject: Re: Command line cannot fwrite, browser can Newsgroups: comp.lang.php References: Followup-To: comp.lang.php MIME-Version: 1.0 Lines: 111 NNTP-Posting-Date: 18 Jun 2011 08:20:00 CEST NNTP-Posting-Host: 7c160e64.newsspool3.arcor-online.net X-Trace: DXC=hLS4`STGOg2d8Nb@@ZG@b=McF=Q^Z^V384Fo<]lROoR18kF Okay, I give up! I pulled the very last hair out of my head, and now I > am asking for help. Your posting style just begs for as the only answer (in particular ). But I think I have actually found some relevant facts between the lines of the 179-lines diary entry that you have posted in place of your good question. Anyhow, please read that tutorial to make it better next time. > […] > This is the error I am getting: > C:\Inetpub\vhosts\aloyaltycard.com\httpdocs\groupmail>cd c:\parallels > \plesk\additional\pleskphp5 > C:\Parallels\Plesk\Additional\PleskPHP5>php.exe c:\inetpub\vhosts > \aloyaltycard.com\httpdocs\groupmail\groupmail.php > > Warning: file_get_contents(groupmail1_noname.txt): failed to open stream: > No such file or directory in C:\Inetpub\vhosts\aloyaltycard.com\httpdocs > \groupmail\groupmail.php on line 88 > cannot write to groupmail.html > > […] > Directory of C:\Inetpub\vhosts\aloyaltycard.com\httpdocs\groupmail > […] > 06/17/2011 12:37 PM 3,102 groupmail.html > 06/17/2011 01:13 PM 5,515 groupmail.php > [...] > 06/10/2011 05:51 PM 443 groupmail1_noname.txt > […] > > Just for shits and giggles, here's the contents of my batch file as well: > @echo on > cd c:\parallels\plesk\additional\pleskphp5 > php.exe c:\inetpub\vhosts\aloyaltycard.com\httpdocs\groupmail > \groupmail.php > > Here is the relavent PHP: No, about 99% of it is quite irrelevant to your question. Does "reduce test case" ring a bell? > $filename = "groupmail.html"; > […] > $groupmhtml1noname = "groupmail1_noname.txt"; > > //this above file is the one it cannot find (You don't say …) > […] > $groupmail = fopen( $filename,'w' ) or die( 'cannot open > groupmail.html' ); > […] > $firstpart = file_get_contents($groupmhtml1); > $firstnoname = file_get_contents( $groupmhtml1noname ); > > //warning comes right here (You don't say …) > fwrite( $groupmail,$firstpart ) or die( 'cannot write to > groupmail.html' ); > > //failure occurs right here (You don't say …) So let me get this straight: 1. You are explicitly cd-ing to c:\parallels\plesk\additional\pleskphp5 (for whatever reason) 2. You run php.exe c:\inetpub\vhosts\aloyaltycard.com\httpdocs\groupmail\groupmail.php 3. You *wonder* why php.exe cannot find the files in the *current* *working* *directory* (c:\parallels\plesk\additional\pleskphp5) or can write to it? $ cat ~/tmp/files.php