1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

How can I make this counter work in Plesk?

Discussion in 'Plesk for Linux - 8.x and Older' started by Clark, Sep 13, 2005.

  1. Clark

    Clark Guest

    0
     
    This is a simple script I used previously on a server running with Cpanel. I have not been able to make it work yet under Plesk.

    I have the count.php file located in a directory of my site like
    mysite.com/forum/count/count.php

    It takes the message numbers, checks if a file name of that number exists in the count directory and writes and increments the counter for each file.

    It is called as an include from a message located on my site at an address like mysite.com/forum/messages/12345.php

    Here is the counter code. The test $number I am passing to the counter is 777.

    Code:
    <?
    if (file_exists("$number")) {
            $fd = fopen("$number", "r"); 
            $num =  fread($fd, filesize("$number")); 
            fclose($fd);
    }
    else {
            $fd = fopen("$number", "w+"); 
            $num = "0"; 
            fclose($fd);
    }
    
            $fd = fopen("$number", "w"); 
            $read = $num + 1; 
            echo "$read"; 
            fwrite($fd, $read); 
            fclose($fd); 
    ?>
    
    Here are the error messages I receive:

    Code:
    PHP Warning:  fopen(777): failed to open stream: Permission denied in /home/httpd/vhosts/mysite/httpdocs/forum/count/count.php on line 12
    
    PHP Warning:  fclose(): supplied argument is not a valid stream resource in /home/httpd/vhosts/mysite/httpdocs/forum/count/count.php on line 14
    
    PHP Warning:  fopen(777): failed to open stream: Permission denied in /home/httpd/vhosts/mysite/httpdocs/forum/count/count.php on line 17
    
    PHP Warning:  fwrite(): supplied argument is not a valid stream resource in /home/httpd/vhosts/mysite/httpdocs/forum/count/count.php on line 20
    
    PHP Warning:  fclose(): supplied argument is not a valid stream resource in /home/httpd/vhosts/mysite/httpdocs/forum/count/count.php on line 21
    
     
Loading...