• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

How can I make this counter work in Plesk?

C

Clark

Guest
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
 
Back
Top