Daemon Not Starting

Post Reply
0xyg3n
Junior Member
Posts: 10
Joined: Wed Jul 22, 2009 10:22 pm

Daemon Not Starting

Post by 0xyg3n »

Hello been using vistumbler for a while now. Recently decided to give wifidb a try on my own site instead of uploading the kml files.

I managed to get it to install after manually creating the database and user. I would get access denied errors if the script tried to create them on its own. I also had to remove the create user php code as it would do the same thing. After that it seemed to install fine and run ok.

That is until I uploaded a file. The daemon script wont start at all. I only have basic understanding of php so I'm not sure what I'm missing.

I have modded the config.inc.php in the tools/daemon folder so it matched the folder structure on my host.

I have left it running as is here http://www.0xyg3n.com/wifidb/

Thanks
User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1302
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Re: Daemon Not Starting

Post by ACalcutt »

What version are you using? I had problems starting the daemon with wifidb-alpha-016-b3. But phil had uploaded the fixes in wifidb-alpha-016-b3-R1.tar.gz

have you started the daemon? In my install I put my tools folder in /opt/wifidb/tools
when I start the deamon I go to the console and run "php /opt/wifidb/tools/rund.php start"

When you run rund.php do you get an error?

This is all I have....I'll let the WiFiDB expert help you more ;-)

on another note I was checking out your website and it looks like you have quite a bit of your area mapped. We would love to have those scans added to our official wifidb :-) (http://www.vistumbler.net/wifidb/)
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

HI Oxyg3n,

Nice to see someone is trying the database out. This is exactly what I want, to have people report issues that they are having, on their own servers.

My first question is are you running on a shared server? Reason being, to create a user in MySQL you need to have "Create User" permission. but then again you did say you created the user and database manually, did you use a different account then what you where trying to use to install WiFiDB?

Second is what Andrew asked, where do you have the tools folder installed, and did you put that folder dir in the install page of WiFiDB.

Third is, could you upload a copy of your config.inc.php files for the daemon and WiFiDB (usernames and pwds removed).

Also as Andrew stated I had fixed a bug in the rund.php script that was in Build 3, and is fixed in Build 3 R1, I never really used the rund.php because im always starting and stopping the daemon. but thats my fault I should have kept a better eye on the rest of the scripts when I make changes.

As a side note, the daemon, in it state right now, is very difficult to use, I know. I am working on trying to change that. Any input would be greatly appreciated.

-Phil

@andrew
expert ehh, i think you might be a little too giving lol
The best acceleration you can get on a Mac is 9.8ms^2
User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1302
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Re: Daemon Not Starting

Post by ACalcutt »

@andrew
expert ehh, i think you might be a little too giving lol
I don't. Who else would know more about the WiFiDB than its creator ;-)
0xyg3n
Junior Member
Posts: 10
Joined: Wed Jul 22, 2009 10:22 pm

Re: Daemon Not Starting

Post by 0xyg3n »

I downloaded the latest version wifidb-alpha-016-b3. The host is bluehost.com yeah its a shared host. I only have cpanel access at the moment. I used the tools in cpanel to create the database and user. Would I be right in saying I need shell access to the site as ACalcutt mentioned the console to start the daemon script. Which I can get from them if I ask for it.

I placed the tools folder inside the wifidb folder and then uploaded the whole lot via ftp.

The only part of the config.inc.php in the daemon folder that i changed is this.

$wifidb_install = '/home/XXXXXX/public_html/wifidb';

The XXXXXX's are the username. I also added that location to the php.ini file as I noticed it was generating a couple of error_log files with permission errors.

this is what the config.inc.php in the lib folder looks like again xxxx's are the usernames etc I have removed.
global $conn, $wifidb_tools, $daemon;
date_default_timezone_set('GMT+0');
$lastedit = '2009-08-21';

#---------------- Daemon Info ----------------#
$daemon = 1;
$debug = 0;
$log_level = 0;
$log_interval = 0;
$wifidb_tools = '../tools';
$DST = 'America/Denver';
#---------------- Debug Info ----------------#
$rebuild = 0;
$bench = 0;
#---------------- URL Info ----------------#
$root = 'wifidb';
$hosturl = 'http://www.0xyg3n.com/';

#---------------- SQL Host ----------------#
$host = 'localhost';

#---------------- Tables ----------------#
$settings_tb = 'settings';
$users_tb = 'users';
$links = 'links';
$wtable = 'wifi0';
$gps_ext = '_GPS';
$sep = '-';

#---------------- DataBases ----------------#
$db = 'xxxx';
$db_st = 'xxxx';

#---------------- SQL User Info ----------------#
$db_user = 'xxxx';
$db_pwd = 'xxxx';


ACalcutt I may upload the data one day. I'm trying to map out my town. I just did some more tonight infact. With what I got done tonight I have over 2000 mapped. I don't think I've even done 1/4 of the town yet. Its going to be a long process.
User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1302
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Re: Daemon Not Starting

Post by ACalcutt »

To use the deamon version you will need shell access. You should be able to use the non-daemon version without shell access, but then you are more likely to hit the script execution timeout set in php.ini when uploading big files.
0xyg3n
Junior Member
Posts: 10
Joined: Wed Jul 22, 2009 10:22 pm

Re: Daemon Not Starting

Post by 0xyg3n »

I wasn't able to get it to work with the non daemon version either. That was one of the first things I tryed.

Warning: require(/lib/config.inc.php) [function.require]: failed to open stream: No such file or directory in /home/xxxx/public_html/wifidb/lib/database.inc.php on line 726

Fatal error: require() [function.require]: Failed opening required '/lib/config.inc.php' (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/xxxx/public_html/wifidb') in /home/xxxx/public_html/wifidb/lib/database.inc.php on line 726

thats what happens
User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1302
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Re: Daemon Not Starting

Post by ACalcutt »

strange...726 just points to the config file (require $GLOBALS['wifidb_install']."/lib/config.inc.php";)
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

Ok so i found the problem, i did a few modifications to the import_vs1() function and apparently didn't test it on the HTML side, to fix this, replace the require $GLOBALS with this:

Code: Select all

if($out == "CLI")
{
	require $GLOBALS['wifidb_install']."/lib/config.inc.php";
}
but i have found a few more bugs with the HTML mode, and have attached a patch, all you need to do is extract it into the wifidb folder.

If you are running the HTML version, it will skip over the un-needed config file that is needed when you are running it in CLI mode (daemon).

I would have pointed you to the SVN but there are some major changes in there for the next release, and i dont want to screw up your install any more then it already is ;-) lol

And yes you will need shell access in order to start the daemon.
Attachments
HTML_mode_patch.zip
patch for Build 3 to fix HTML mode bugs
(32.97 KiB) Downloaded 614 times
The best acceleration you can get on a Mac is 9.8ms^2
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

The only other thing that I noticed that might cause a problem is your $DST var is 'America/Denver'
The $DST var needs to be a numeric value in seconds. So if you are using DST then 3600 will be the value, if not then 0.

This is also another thing that I need to change, might do a Boolean instead.
The best acceleration you can get on a Mac is 9.8ms^2
0xyg3n
Junior Member
Posts: 10
Joined: Wed Jul 22, 2009 10:22 pm

Re: Daemon Not Starting

Post by 0xyg3n »

excellent thanks guys that patch worked a charm. I'll use it this way till i get shell access enabled.
0xyg3n
Junior Member
Posts: 10
Joined: Wed Jul 22, 2009 10:22 pm

Re: Daemon Not Starting

Post by 0xyg3n »

Ok I have shell access to my host now. Wasn't expecting them to reply so fast to my request.

I don't have permission to the /var/run directory.

this is the errors i get now

<b>Warning</b>: fopen(/var/run/wifidbd.pid) [<a href='function.fopen'>functi
on.fopen</a>]: failed to open stream: Permission denied in <b>/home/xxxx/
public_html/wifidb/tools/daemon/wifidbd.php</b> on line <b>67</b><br />
<br />
<b>Warning</b>: fopen(/var/run/wifidbd.pid) [<a href='function.fopen'>functi
on.fopen</a>]: failed to open stream: Permission denied in <b>/home/xxxx/
public_html/wifidb/tools/daemon/wifidbd.php</b> on line <b>68</b><br />
<br />
<b>Warning</b>: fwrite(): supplied argument is not a valid stream resource i
n <b>/home/xxxx/public_html/wifidb/tools/daemon/wifidbd.php</b> on line <
b>69</b><br />
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

ok, let me change it so that it writes the pid file to the daemon folder
The best acceleration you can get on a Mac is 9.8ms^2
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

Here is the updated daemon script, the PID file is now written to the "[tools_install]/daemon/" folder.

{edit 8/22/09 4:36}
I forgot to edit the rund.php script to look there also, I have added that to the attachments also.
Attachments
rund.php
WiFiDB Daemon Run script
(2.14 KiB) Downloaded 614 times
wifidbd.php
WiFiDB Daemon PID fix
(13.44 KiB) Downloaded 585 times
The best acceleration you can get on a Mac is 9.8ms^2
0xyg3n
Junior Member
Posts: 10
Joined: Wed Jul 22, 2009 10:22 pm

Re: Daemon Not Starting

Post by 0xyg3n »

Excellent now its getting somewhere thanks pferland. I did have a little bit of trouble to start off with.

It was missing a couple of { in the code I also noticed the wifidbd.php is a newer version then the copy in the 1.6 download. So I made the changes to the file I already have. I would import the file fine but stop on the automatic kml export on the file you supplyed above. I guess you have other code elsewhere for that.

It runs fine on small files 100k or so. but ive been trying to import a larger file 400k and the system cant handle it. I either get Maximum execution time of 30 seconds exceeded or when I place set_time_limit(0); into the database.inc.php file it just freezes.

It looks like I'll just have to use the non daemon scripting for awhile.
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

Im really sorry about leaving the Automated KML code in there, I completely forgot about it.
It must be your host that is limiting the CLI run time of PHP scripts to 30 seconds.
I went and checked out your site, and when I clicked on an AP to view its details it seemed that the manufactures.inc.php file is corrupt some how. There is a script in the tools folder that rebuilds a new file for you in the root of the tools folder. You can move that one and replace the bad one in the `lib` folder.
The best acceleration you can get on a Mac is 9.8ms^2
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

I made some small changes to the scheduling.php page, and have also included an updated manufactures.inc.php file, I also commented out the daemon-kml function and a call to an un-needed functions.php file. :oops:
I tried them out on my rihq server, and it seemed to work fine, let me know if you have any more problems.
Also are you logging out of your shell session or just closing it, I have noticed that if you start the daemon from say putty and logout or you session gets closed the daemon proc will get killed. :?

-Phil
Attachments
some_more_small_fixes.zip
another patch, why cant I stop...
(145.75 KiB) Downloaded 579 times
The best acceleration you can get on a Mac is 9.8ms^2
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

For everyone else I have added all these fixes into a zip file, called Build 3 R2 Patch, there is no database changes, only php script bug fixes.
You need to have at least Build 3 R1 code base installed first.
It is also available on sourceforge.net

I really need to test my code better before I do a release :oops:

-phil
Attachments
WiFiDB_Build_3_R2_patch.zip
WiFiDB Build 3 R2 patch
(176.31 KiB) Downloaded 642 times
The best acceleration you can get on a Mac is 9.8ms^2
0xyg3n
Junior Member
Posts: 10
Joined: Wed Jul 22, 2009 10:22 pm

Re: Daemon Not Starting

Post by 0xyg3n »

grrrrr dam host lol. still getting these errors at random times. It might import 100 or so then if i rerun the daemon it will only get up to 70.

<b>Fatal error</b>: Maximum execution time of 30 seconds exceeded in <b>/hom
e/xxxx/public_html/wifidb/lib/database.inc.php</b> on line <b>406</b><br
/>

I've modded the php.ini file in the public_html folder to include
max_execution_time = 300
max_input_time = 300
no effect what so ever. the host must have it locked down somewhere else that I cant get access to.

I don't close putty either leave it running all the time.

Sorry for being such a pain pferland.
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

Ah man that really sucks.
No pain at all, its all good, I'm actually very happy. Someone is using my program! lol
Yes to does look like your host is limiting CLI version php to 30 seconds, must be so that they can ensure CPU cycles to other people on the server :-( those bastards. /me waves fist.
you could try putting "set_time_limit(0)" at the top of the wifidbd.php file, to see if that makes a difference, maybe it wont freeze it like when you put it in the database.inc.php file.
The best acceleration you can get on a Mac is 9.8ms^2
0xyg3n
Junior Member
Posts: 10
Joined: Wed Jul 22, 2009 10:22 pm

Re: Daemon Not Starting

Post by 0xyg3n »

Ok I've done a little more research found some post on bluehost help forum and it looks like they recently had a policy change. They changed the maximum execution from 5mins to 1min. If you want to get longer execution time you need to get a dedicated ip address. Looks like i'll have to dish out some more cash lol.
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

That is one of the down sides of a hosted service.
Keep us posed, would really like to know how things turn out for you.
Also if you have anything that you would like added or could be changed, go ahead and post them in the requests section. :D

-Phil
The best acceleration you can get on a Mac is 9.8ms^2
0xyg3n
Junior Member
Posts: 10
Joined: Wed Jul 22, 2009 10:22 pm

Re: Daemon Not Starting

Post by 0xyg3n »

Don't worry I'll keep you posted :)
Forscher
Junior Member
Posts: 3
Joined: Wed Jan 27, 2010 4:18 pm

Re: Daemon Not Starting

Post by Forscher »

Heyho,

my Second post "it feels like a noob post" but i got a error, on a Windows based System have Already fixed a small one with the tools folder. But now i got one "shame :oops: " with the WiFiDB Daemon Console Viewer.

Code: Select all

Warning: file(/var/log/wifidb) [function.file]: failed to open stream: No such file or directory in C:\xampp\htdocs\wifidb\console\console.php on line 42
Warning: fopen(/var/log/wifidb) [function.fopen]: failed to open stream: No such file or directory in C:\xampp\htdocs\wifidb\console\console.php on line 71
Warning: fgets() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\wifidb\console\console.php on line 73
in the config i have found the Problem. "Folder pfad missing" :wink:

Code: Select all

$console_log	= '/var/log/wifidb'; 
"var is the linux based folder i know. have already try other ones like "../log/wifidb" the complet pfad and..... i don´t know why i got always the same message. can some body help me please and give me a hint how to add the good way for the folder for a windows based system"

btw I use the SVN version :) *Alpha* 0.20 Build 1
User avatar
ACalcutt
Vistumbler / TechIdiots Admin
Vistumbler / TechIdiots Admin
Posts: 1302
Joined: Sun Oct 21, 2007 6:50 pm
Location: Rutland, MA
Contact:

Re: Daemon Not Starting

Post by ACalcutt »

Phil will probably correct me when he is around, but the daemon is really designed for linux right now. Development kind of moved away from windows because of mysql performance.

There is the old non-deamon way that should work fine with windows, but you will need to increase you php script timeout (and even then, this way has trouble with really big files)

Anyway, I'll let phil answer in more detail, since he is the creator of the WiFiDB.
Forscher
Junior Member
Posts: 3
Joined: Wed Jan 27, 2010 4:18 pm

Re: Daemon Not Starting

Post by Forscher »

that is fast, mh okay then can it not work :) fine, i hope that i get it running on my linux based system.

btw keep up the good work :)
User avatar
pferland
Contributor
Contributor
Posts: 406
Joined: Mon Oct 22, 2007 8:38 am
Location: The Universe
Contact:

Re: Daemon Not Starting

Post by pferland »

well MySQL performance and that windows is a really crappy development environment for PHP.

But anyways, the problem you are having is you're not putting an absolute path as the log folder location.

Code: Select all

$console_log   = 'C:\xampp\logs\wifidb';
"C:\xampp\logs\wifidb" would be a folder, not a file. even though in the older version of the daemon it was a file with no extension :roll:

Also this is the console viewer page, and i had not updated that page to reflect the new logfile structure.
before there was one log file for the one daemon, now there is a log folder with three log files inside it.

to fix this replace line 19 with

Code: Select all

$console_log = $GLOBALS['console_log'].$dim.'imp_expd.log';
But also as Andrew had stated, the daemon kind of went towards a Linux only environment.

Personally I wouldn't use the latest SVN version, that is just were I keep a safe copy of the code, The installer is not finished and there are lots and lots of bugs still in 0.20 {pre-release}
The best acceleration you can get on a Mac is 9.8ms^2
Post Reply