• The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • Debian 11 has reached its end-of-life (vendor EOL date - August 31, 2026). Plesk Obsidian 18.0.81 is the last release to support it.
    If you are running Plesk Obsidian on Debian 11, we recommend you upgrade those servers to Debian 12 using our dist-upgrade tool.
  • We plan to deprecate and remove the support for XML RPC protocol versions earlier than 1.6.9.1 in Plesk Obsidian 18.0.82. We strongly recommend that you update all existing integrations using earlier versions of the XML RPC protocol to comply with the version 1.6.9.1 specification.

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