Personal Web Sharing IP logger

Joined
Apr 4, 2011
Messages
8
Reaction score
0
Points
1
Hello:
Could anyone tell me how to add to Home/Sites an IP logger.
I have a macbook OS X 4.10.11 and there are references in the
file system to php4 but I do not know how to activate it and how to
embed a php script into an html file.
If there are other OSX options please ... information.
Thank you
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
You're asking two very different questions here. Do you need to log IPs that visit a site you're hosting or do you need to enable PHP?
 
OP
M
Joined
Apr 4, 2011
Messages
8
Reaction score
0
Points
1
Thank you for your quick reply. If it can be done without installing or activating php it is the best option.
Could you help me?
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Apache, the web server used in OS X, has logging capabilities. To view the access log, check out the file /private/var/log/apache2/access_log. I think this may be what you're looking for but the best way to know if this is what you want, view the file, close it, view the webpage and recheck the log to see if your visit was logged.
 
OP
M
Joined
Apr 4, 2011
Messages
8
Reaction score
0
Points
1
hi

I do not have an apache2 directory at /private/var.log

Apache is not native to OS X
 
OP
M
Joined
Apr 4, 2011
Messages
8
Reaction score
0
Points
1
"Log4php is logging framework for PHP".
Alternatively, I found this software at the apache.
Is it possible to enable php and use this framework without installing apache?
I think the easiest way would be to embed a few lines code into index.html but I do not know how to ...
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Yes, Apache is native - it is included as part of the default install. It is what powers the web sharing that you enable through System Preferences. Check the directory again. It's /private/var/log, not /private/var.log. I did not setup that logging myself so it must be part of the default configuration.
 
OP
M
Joined
Apr 4, 2011
Messages
8
Reaction score
0
Points
1
thanks for the reply. It is not there. Maybe we have different versions of OS X.
Anyways, i really need a quick helping hand to track ip's.
if you know how to embed a script into html ...
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
I just realized that you're using Tiger so it is very possible that directory does not exist. As for a PHP script that will log visitors, I'll have to get back to you. It shouldn't be too hard to write one up but I'm away from my computer right now.
 
OP
M
Joined
Apr 4, 2011
Messages
8
Reaction score
0
Points
1
hi again. I did manage to log the visitors' IP but it is retrieving the local address (intranet) and not the global one.
Do you know which variable will work?
I tested logging into my mac (connected through a GSM modem) server from a mobile that was connected to a local wifi signal and the script logged only a local IP. When I search on the net from the phone's web browser "what is my IP" the value returned was the global one. Therefore, those sites do find the external IP somehow.
Can you help?
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
It only logged a LAN IP because that was the IP of the machine.

Assuming you're still using PHP, take a look at this. I'm not sure if that will be different from what you have but it may work. I tried it a while ago and didn't have luck but some have reported that using "$_SERVER['REMOTE_ADDR']" works.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top