AwStats plugin for DA [Still in BETA]

Its not detecting domains for me. During install when it says Install awstats on this domain, no domain is displayed and when I attempt to run it, this is reported when it tries to create the awsats directory.
Warning: mkdir(/home/username/domains//public_html/awstats): No such file or directory

Its not detecting the domains for me. This causes a cascading affect of course on the rest of the install procedure.
This is the link it displays when I try installing:
https://mydomain:2222/CMD_PLUGINS/awstats?config=1&domain=
I tried putting my domain in manually but still same results, it didn't insert it into the install script.
This is for all accounts, not just the admin.

Any ideas?
 
Users with more than one domain (as owner) do they first see a list of domains ??? it uses (CMD_API_SHOW_DOMAINS) to get the list of owned domains.

I can't really understand why it shouldn't know wich domain the logged in user has, as this is being fetched from DirectAdmin.

Did you reinstall the plugin or did you "update" it ?
Did you try logging in as a domain user (wich has only one domain) ?
Are you running DA in HTTPS ? (maybe this is why it couldn't fetch the domains)
 
Last edited:
This plugin doesn't function with safe-mode enabled, does it ?

I get the following after trying to access it with a user after installing:
Warning: main(): SAFE MODE Restriction in effect. The script whose uid is 101 is not allowed to access /usr/local/directadmin/plugins/awstats/hooks/da.php owned by uid 0 in /usr/local/directadmin/plugins/awstats/user/index.html on line 8 Warning: main(/usr/local/directadmin/plugins/awstats/hooks/da.php): failed to open stream: Success in /usr/local/directadmin/plugins/awstats/user/index.html on line 8 Warning: main(): Failed opening '/usr/local/directadmin/plugins/awstats/hooks/da.php' for inclusion (include_path='.:/usr/local/lib/php') in /usr/local/directadmin/plugins/awstats/user/index.html on line 8 Fatal error: Cannot instantiate non-existent class: httpsocket in /usr/local/directadmin/plugins/awstats/user/index.html on line 10
Since the script uid keeps popping up as 101, i'll try a permissionchange from uid 0 to 101 for the script....

OK, that worked, now getting another problem:

Checking if there is already something installed..
Creating AwStats dir on domain
Warning: mkdir(): SAFE MODE Restriction in effect. The script whose uid is 101 is not allowed to access /home/testdomain/domains/testdomain.nl/public_html owned by uid 512 in /usr/local/directadmin/plugins/awstats/user/index.html on line 39 Checking if awstats files are available Warning: symlink(): SAFE MODE Restriction in effect. The script whose uid is 101 is not allowed to access /home/testdomain/domains/testdomain.nl/public_html owned by uid 512 in /usr/local/directadmin/plugins/awstats/user/index.html on line 45 + Warning: symlink(): SAFE MODE Restriction in effect. The script whose uid is 101 is not allowed to access /home/testdomain/domains/testdomain.nl/public_html owned by uid 512 in /usr/local/directadmin/plugins/awstats/user/index.html on line 47 + Warning: symlink(): SAFE MODE Restriction in effect. The script whose uid is 101 is not allowed to access /home/testdomain/domains/testdomain.nl/public_html owned by uid 512 in /usr/local/directadmin/plugins/awstats/user/index.html on line 49 +
Checking for AwStats itself
Warning: copy(): SAFE MODE Restriction in effect. The script whose uid is 101 is not allowed to access /home/testdomain/domains/testdomain.nl/public_html owned by uid 512 in /usr/local/directadmin/plugins/awstats/user/index.html on line 54 Warning: copy(/home/testdomain/domains/testdomain.nl/public_html/awstats/awstats.pl): failed to open stream: No such file or directory in /usr/local/directadmin/plugins/awstats/user/index.html on line 54 Installed awstats.
(Re-)Activating CGI for dir
Warning: copy(): SAFE MODE Restriction in effect. The script whose uid is 101 is not allowed to access /home/testdomain/domains/testdomain.nl/public_html owned by uid 512 in /usr/local/directadmin/plugins/awstats/user/index.html on line 57 Warning: copy(/home/testdomain/domains/testdomain.nl/public_html/awstats/.htaccess): failed to open stream: No such file or directory in /usr/local/directadmin/plugins/awstats/user/index.html on line 57 (Re-)Setting permissions
Warning: chmod(): Unable to access /home/testdomain/domains/testdomain.nl/public_html/awstats/awstats.pl in /usr/local/directadmin/plugins/awstats/user/index.html on line 59 Warning: chmod(): No such file or directory in /usr/local/directadmin/plugins/awstats/user/index.html on line 59 Warning: chown(): Unable to access /home/testdomain/domains/testdomain.nl/public_html/awstats/awstats.pl in /usr/local/directadmin/plugins/awstats/user/index.html on line 60 Warning: chown(): No such file or directory in /usr/local/directadmin/plugins/awstats/user/index.html on line 60 Now (re-)creating your configuration file.
Config file has been created and your statistics are now setup!

You can now view the statistics for your domain at: www.testdomain.nl/awstats/

But heh, I'm making progress....
 
Last edited:
jmstacey I've just setup a new version wich support HTTPS (i hope, can't test). If you want to enable HTTPS, install v. 0.8.1 and from console use the following: "touch /usr/local/directadmin/plugins/awstats/hooks/ssl.use"

Let me know if it works, so i can implement it ;)

Icheb With safe_mode restriction on it will not work, even awstats does use files outside the users dir.

The script(s) change a lot outside the permitted directory in safe_mode.
 
This still didn't work. Same problem. I also disabled ssl for directadmin and tried it but still not luck. Is it my OS combination thats the problem. Your developing it on RedHat aren't you?
 
Yes, I don't know wich path's or that the API is different somehow. :s

Or that the way the enviroment variables should be passed to php differs ? Put in the top of the index.html the following (after the php tag):

echo "User: ".$_SERVER["USER"]."<BR>"; (Must be capital).

if this doesn't work you can check for me:

$_ENV["USER"]
$_ENV["USERNAME"]
$_SERVER["USERNAME"]

These all contain the same variable on redhat, so we just need to find out if any of these contains the user on your system ;)

Thx
 
Last edited:
fusionictnl said:
Icheb With safe_mode restriction on it will not work, even awstats does use files outside the users dir.

The script(s) change a lot outside the permitted directory in safe_mode.

Figured that out already :D
I disabled safe mode everywhere, my php.ini, the httpd.conf etc, but DA is still giving me the same problems.
Where does the php version of DA get it's safe mode config from, and why isn't it listening to safe_mode=OFF in php.ini...

Not that awstats are vital to the server, but I'd like to offer it to my clients.

Oh, btw: nice job with the uninstall.sh. Uninstallation doesn't seem possible, does it ? :D
 
DA removes the plugin dir ;) /etc/awstats and the user's public_html/awstats have to be deleted manualy.

If you have another awstats or something it would be deleted, nobody likes that ;) or if something goes wrong with deleting the awstats dir and the users public_html is gone, they wouldn't be happy ;)

If you just turn off safe_mode in the panel, as it is standard, it should work ;)

By the way, HTTPS isn't working correctly, so if you're running https it probaly won't work. (working on it ;))
 
Works great!

Had to translate and comment a cupple of things I didn't liked, but now it works very good!

Thanks a lot.
 
fusionictnl said:
DA removes the plugin dir ;) /etc/awstats and the user's public_html/awstats have to be deleted manualy.

If you have another awstats or something it would be deleted, nobody likes that ;) or if something goes wrong with deleting the awstats dir and the users public_html is gone, they wouldn't be happy ;)

If you just turn off safe_mode in the panel, as it is standard, it should work ;)

By the way, HTTPS isn't working correctly, so if you're running https it probaly won't work. (working on it ;))

Ok, it's true that users wouldn't like their public_html dir removed...

I got it running, my php was compiled with the enable safe mode command. So it kept the system in safe mode while safe mode is supposed to be off. (I work with open basedir restrictions and some disabled commands.)

It looks good :)

Although a 'go back to panel mainpage' button might be usefull, and perhaps a button while in the panel awstats menu to directly go to the <domain>/awstats/. But that's only if you would have the time for it, and want to make it :D
 
You probably should change this line
Code:
if ($awuser && $awpass && $domain) {

to something like
Code:
if ($awuser && $awpass && isset($domain)) {

the problem is, if they are trying to set the password on the first domain (item 0 in the array) the if statement will ALWAYS evaluate to false.
 
everything is 0 in a domain i tried awstats plugin on, is that ok?
 
Last edited:
Still on Vacation! :p

Secure connections are finally fixed.
- Update the socket communication class to v2.3 (da.php)
forget about any changes you've made to it
- in the index.html file where this line is
Code:
$Socket->connect('127.0.0.1',2222);
REPLACE it with this
Code:
if (file_exists("/usr/local/directadmin/plugins/awstats/hooks/ssl.use"))
$Socket->connect('ssl://127.0.0.1',2222);
else
$Socket->connect('127.0.0.1',2222);

Not the prettiest but it works. Do this to ALL files that require a connection to DA like options.php for example.
Once its actually connecting to DA there shouldn't be any more domains not showing issues so you can probably remove the echo debug command that displays the domains array before its parsed.


One BIG Problem
It just doesn't work for me, lol. when I try going to my awstats directory I get a 500 error. If I try running it through the command line its because it needs a -config=virtualhostname after the command which is probably the reason for the server error, not sure how to fix this since I don't have much experience with awstats. I'm not sure what your trying to do but my suggestion is don't even bother with putting stuff other that the stats in the users directory.

What I suggest is you make an admin page with a cron tool scripts that will add a cron to generate stats for all users 30 to 60min before webalizer does. Then when I user goes and "Installs" webalizer on their domain config file is created and is added to the awstats/hooks/domains.conf then when generate.sh or a script like it runs through and updates stats for all users it will put all stats in the users awstats directory.
Doing it this way will elliminate all of the permissions problems and overhead (I think), and will help against users updating stats more often than they need to be.

I'd say once you got that base working so something at least works then more options can be added. For example:
+ admin option to set cron at different intervals
+ admin option to allow users to set the interval time that stats are generated for them
+ user option to select generation interval.

Something like how Directadmin does its crons could be used to keep away from editing the main crontab. Like one entry in the main crontab to check the awstats crontab every minute, or however DA does its thing.
 
Back
Top