473,777 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help needed to track down a PHP error

A friend just changed servers with her web site. The new server uses PHP
4.3.2 as opposed to the old server that had one of the 4.0.x's (don't
remember exactly which one). Now I know all about the register globals
change but one of the pages is suddenly throwing me an error I can't
figure out. It is not on a form. It is a script to include a random
quote on a page once every 50 page loads. It worked fine on the old
server but is throwing an error on the new one. Can anyone tell me what
I need to do to correct this?

The error:

Warning: fopen(displayqu ote.inc): failed to open stream: Permission
denied in /usr/local/apache/htdocs/WD/witw/week5.htm on line 129

Warning: fputs(): supplied argument is not a valid stream resource in
/usr/local/apache/htdocs/WD/witw/myform.htm on line 130

Here is the script for it:

<?
/* Config Part
--------------------------------------------------------------------------------------------------------------*/

$random = false; //true for random, false for sequential $directory = "";
$quotefile = "randomquote5.i nc"; // The Random Quote file
$quotecountfile = "displayquote.i nc"; // The Display Quote count file
that keeps track of what number page load it is

/* End of Config Part
-------------------------------------------------------------------------------------------------------*/

$quotes = file($directory .$quotefile);
$number = count($quotes);

if($random){
$num = rand(0,$number-1);
}
else{
$num = file($directory .$quotecountfil e);
$num = $num[0]+1;
if($num>$number-1){ // If ran out of quotes, start again!
$num=0;
}
if (file_exists($d irectory.$quote countfile)) {
$nu = fopen ($directory.$qu otecountfile, "w"); //This is line 129
fputs($nu,$num) ; //This is line 130
}
else {
die("Cant Find $quotecountfile ");
}
}
// display the quote on the page
?>
<br>
<p align="center"> <font face="Verdana, Arial, Helvetica, sans-serif"
size="2"><b><?p hp print "$quotes[$num]"; ?></b></font></p>

Jul 16 '05 #1
2 2158
Hi JD!

On Mon, 15 Sep 2003 01:02:27 GMT, JDJones <se******@spryn et.com>
wrote:
A friend just changed servers with her web site. The new server uses PHP
4.3.2 as opposed to the old server that had one of the 4.0.x's (don't
remember exactly which one). Now I know all about the register globals
change but one of the pages is suddenly throwing me an error I can't
figure out. It is not on a form. It is a script to include a random
quote on a page once every 50 page loads. It worked fine on the old
server but is throwing an error on the new one. Can anyone tell me what
I need to do to correct this?

The error:

Warning: fopen(displayqu ote.inc): failed to open stream: Permission
denied in /usr/local/apache/htdocs/WD/witw/week5.htm on line 129

Warning: fputs(): supplied argument is not a valid stream resource in
/usr/local/apache/htdocs/WD/witw/myform.htm on line 130

Its mosty probably a permissioning problem. Whats the user and group
of the opened file and does the apache user have writing rights to the
directory?

HTH, Jochen
--
Jochen Daum - CANS Ltd.
PHP DB Edit Toolkit -- PHP scripts for building
database editing interfaces.
http://sourceforge.net/projects/phpdbedittk/
Jul 16 '05 #2
Jochen Daum wrote:
On Mon, 15 Sep 2003 01:02:27 GMT, JDJones <se******@spryn et.com>
wrote:
A friend just changed servers with her web site. The new server uses PHP
4.3.2 as opposed to the old server that had one of the 4.0.x's (don't
remember exactly which one). Now I know all about the register globals
change but one of the pages is suddenly throwing me an error I can't
figure out. It is not on a form. It is a script to include a random
quote on a page once every 50 page loads. It worked fine on the old
server but is throwing an error on the new one. Can anyone tell me what
I need to do to correct this?

The error:

Warning: fopen(displayqu ote.inc): failed to open stream: Permission
denied in /usr/local/apache/htdocs/WD/witw/week5.htm on line 129

Warning: fputs(): supplied argument is not a valid stream resource in
/usr/local/apache/htdocs/WD/witw/myform.htm on line 130


Its mosty probably a permissioning problem. Whats the user and group
of the opened file and does the apache user have writing rights to the
directory?


Thank you Jochen. The file's permission was set to 644. By changing it
to 666, it is working as it should. Funny how it worked on one server
and not another. Oh well.

I appreciate your input. I would have been looking for a problem in the
script or in the PHP setup.
Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3884
by: spoc | last post by:
I am using VC++6 and Numega bounds checker and have been getting many STATIC MEMORY OVERRUN errors (boundschecker) while trying to track down bugs. An example is below: void func() { static int midSection; memset(&midSection, 0, sizeof(midSection)); }
1
4362
by: jase_dukerider | last post by:
Hi I have an assignment to hand in shortly for which I am after some guidance. The task is to read a WAV file, request a fade in /out time for the track from the user and the do the fade by modifying the binary file then writing it as a new file I have attached my code so far but do not know how to do the fade and how to write it as a new file. Please help! #include <stdio.h> #include <stdlib.h> #include <string.h>
7
1813
by: Christian Christmann | last post by:
Hi, in the past I always appreciated your help and hope that you also can help me this time. I've spent many many hours but still can't solve the problem by myself and you are my last hope. I've a program which is using self-written double-linked lists as a data structure. The template list consists of list elements and the list itself linking the list elements.
4
9020
by: Tarique Jawed | last post by:
Alright I needed some help regarding a removal of a binary search tree. Yes its for a class, and yes I have tried working on it on my own, so no patronizing please. I have most of the code working, even the removal, I just don't know how to keep track of the parent, so that I can set its child to the child of the node to be removed. IE - if I had C / \ B D
11
1658
by: SZ | last post by:
Hi, I've hit this core multiple times when running an application (coded in C) running on BSD OS. Using gdb getting to the core, it shows: ..... (gdb) bt #0 0x8541fa3 in mTimerQUnlink (t=0xd7f5a51, head=0x8fec13c) at ../../rsvp/eventwheel.c:160
3
3716
by: Dan Trowbridge | last post by:
Hi everyone, In my attempt to port code from VS 6.0 to VS.NET I had some code break along the way, mostly due to not adhereing closely to the C++ standard. This may be another instance but I can't think of a good fix, or even why it broke. The problem In one of my CFormView derived classes I have a member variable of the type...
0
3697
by: samjam | last post by:
Below is some coding in a program i am using, i would like to know how i can get the text bigger or bolder on my webpage, This is the section of text i would like bigger or bolder (This is a very rare lacquered tea caddy c1840. The outside of the caddy has wonderful scenes on each side which are really finely painted. The caddy stands on claw feet. Inside there are four tin canister which is very rare to see on such a small caddy. All canisters...
4
1589
by: mtgrizzly52 | last post by:
I have to be honest as I haven't done an all out search on this problem, due to having to get this database completed by tonight, and this problem just popped up. Ok the problem is that I have had a nicely working form except when I tried to run through my records (via the form) everytime I pushed the advance button to move to the next record I would get an error message that "something" did not have the correct data blah blah blah. I...
1
2762
by: Nadeem Ashraf | last post by:
Hi, We are developing a web based application "UltraLearn.com" with a mix of junior/senior Microsoft technologies. That includes Microsoft Silverlight, ASP.Net Ajax and WCF/WF. Recently, we have hit the wall with some of tested/proven technologies. The problem statement follows: We are calling a WCF Service from our site pages to track user navigation. The service in turn makes call to a gateway/server (using HttpWebRequest,...
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9464
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10122
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5368
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.