Click here to Skip to main content
14,427,846 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have a windows 8 installation with a wamp-joomla website running on port 80.

Now I have another html site using iis on port 8080. So far so good. Both sites work fine. Apart from the wamp stack installed at c:\wamp, Another PHP install exists at c:\php for use with iis.

The php version can be accessed from another pc on my LAN by typing http://myip:8080/phpinfo.php. The phpinfo.php file resides in the root of website folder.

My homepage uses a reference to a page counter script 'counter.php' also in the same folder. if I type http://myip:8080/counter.php directly, the php file executes, however, there is no output when the same counter.php is embedded in my home page 'index.html'.

contents of 'counter.php' are as under:
$count_my_page = ("hitcounter.txt");
$fp = fopen($count_my_page , "r");
$hits = file($count_my_page);
$hits[0] ++;
fclose($fp);
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
echo "Hits ", "$hits[0]", "";
?>


What am I doing wrong ? How can I access the counter script ?

Also when I directly access counter.php, everytime the counter reads 1 only.


My home page calls the counter.php by simply :


include 'counter.php';
?>
Posted
Updated 4-Nov-15 6:47am
v3

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Check you have read/write permissions to the "hitcounter.txt" file and that the file is in the working directory.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100