PHP installation in windows

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

doqb
Posts: 8
Joined: Sun Oct 22, 2006 6:19 pm

PHP installation in windows

Post by doqb »

I am trying to finish Cacti installation for windows....I have followed the procedure in the manuals... Almost at the end of the procedure it ask to run the following to check the PHP installation:

php c:/cacti_web_root/cacti/poller.php

(I replaced the cacti_web_root with the correct path)

I dont get the expected message and instead I get the following:

Warning: array_merge(): Argument #2 is not an array in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\cacti\poller.php on line 61

Warning: Invalid argument supplied for foreach() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\cacti\poller.php on line 120
10/22/2006 07:45:00 PM - SYSTEM STATS: Time:0.0454 Method:cmd.php Processes:1 Threads:N/A Hosts:0 HostsPerProcess:0 DataSources: RRDsProcessed:0 '-' is not recognized as an internal or external command, operable program or batch file.


I am running windows with an adminsitrator user, has rights to all folders

HELP Please?!?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

1) read http://forums.cacti.net/viewtopic.php?t=11747

2) cacti does not like spaces in the paths. This is why it suggests you install into C:\apache2\. You can try to use the 8.3 folder paths instead, if you like.
doqb
Posts: 8
Joined: Sun Oct 22, 2006 6:19 pm

Post by doqb »

Hello...

Thanks for the info... I have moved my apache server 2.2.3 to c:\apache and restarted.

Now when executing the poller.php file I can see the following:

C:\>c:\php\php.exe c:\apache\htdocs\cacti\poller.php
10/23/2006 03:50:00 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: c:/php/php.exe, ARGS: -q c:/apache/htdocs/cacti/cmd.php 0 4]
Waiting on 1/1 pollers.
Waiting on 1/1 pollers.
Waiting on 1/1 pollers.


I the cacti.log file I can see the following logs when I run this command:

10/23/2006 04:00:29 PM - CMDPHP: Poller[0] ERROR: The PHP Script: CMD.PHP Must be started using the full path to the file and in lower case. This is a PHP Bug!!!
10/23/2006 04:00:29 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: c:/php/php.exe, ARGS: -q c:/apache/htdocs/cacti/cmd.php 0 4]



weird....
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Did you add the PHP system variable to your path?

Make sure you only have one php.ini file on your system. Also, did you start from php.ini.dist or php.ini.recommended?

Lastly, lets make sure cacti settings are correct. From the command prompt, type:

Code: Select all

mysql -u root cacti
select * from settings;
and paste the formatted output.
doqb
Posts: 8
Joined: Sun Oct 22, 2006 6:19 pm

Post by doqb »

Hello...

All PHP variables were added to he windows system.

I used the php.ini file (attached)...

Here is the output you requested:

mysql> select * from settings;
+--------------------------------+--------------------------------------+
| name | value |
+--------------------------------+--------------------------------------+
| path_webroot | c:/apache/htdocs/cacti |
| date | 2006-10-23 15:58:34 |
| path_rrdtool | c:/rrdtool/rrdtool.exe |
| path_php_binary | c:/php/php.exe |
| path_snmpwalk | c:/net-snmp/bin/snmpwalk.exe |
| path_snmpget | c:/net-snmp/bin/snmpget.exe |
| path_snmpbulkwalk | c:/net-snmp/bin/snmpbulkwalk.exe |
| path_snmpgetnext | c:/net-snmp/bin/snmpgetnext.exe |
| path_cactilog | C:/apache/htdocs/cacti/log/cacti.log |
| rrdtool_version | rrd-1.2.x |
| log_destination | 1 |
| log_snmp | on |
| log_graph | on |
| log_export | on |
| log_verbosity | 2 |
| log_pstats | on |
| log_pwarn | on |
| log_perror | on |
| snmp_version | net-snmp |
| snmp_ver | 1 |
| snmp_community | public |
| snmp_username | |
| snmp_password | |
| snmp_timeout | 500 |
| snmp_port | 161 |
| snmp_retries | 3 |
| remove_verification | on |
| poller_enabled | on |
| poller_type | 1 |
| concurrent_processes | 2 |
| max_threads | 1 |
| php_servers | 1 |
| script_timeout | 25 |
| max_get_size | 10 |
| availability_method | 1 |
| ping_method | 2 |
| ping_timeout | 400 |
| ping_retries | 1 |
| ping_failure_count | 2 |
| ping_recovery_count | 3 |
| path_rrdtool_default_font | |
| path_cactid | c:/cacti/cactid.exe |
| num_rows_graph | 30 |
| max_title_graph | 80 |
| max_data_query_field_length | 15 |
| max_data_query_javascript_rows | 96 |
| num_rows_data_source | 30 |
| max_title_data_source | 45 |
| num_rows_device | 30 |
| num_rows_log | 50 |
| log_refresh_interval | 20 |
| title_size | 12 |
| title_font | |
| legend_size | 10 |
| legend_font | |
| axis_size | 8 |
| axis_font | |
| unit_size | 8 |
| unit_font | |
+--------------------------------+--------------------------------------+
59 rows in set (0.01 sec)
doqb
Posts: 8
Joined: Sun Oct 22, 2006 6:19 pm

Post by doqb »

sorry...seems like attachments dont work...

to complete the information you requested, I am using php.ini-dist (which is renamed to php.ini of course).
doqb
Posts: 8
Joined: Sun Oct 22, 2006 6:19 pm

Post by doqb »

Hello....

Here is my little contribution....I found the following in cmd.php file...

/* PHP Bug. Not yet submitted */
if ($config["cacti_server_os"] == "win32") {
$guess = substr(__FILE__,0,2);
if ($guess == strtoupper($guess)) {
$response = "ERROR: The PHP Script: CMD.PHP Must be started using the full path to the file and in lower case. This is a PHP Bug!!!";
print "\n";
cacti_log($response,true);
exit(-1);
}
}


for some reason, the variable $guess was having the value "C:" in upper case.

so I added the following:

$guess = strtolower($guess);

After that, when I run: php.exe c:\apache\htdocs\cacti\poller.php

I get the following (which looks ok)

OK u:0.01 s:0.01 r:2.88
10/23/2006 07:46:28 PM - SYSTEM STATS: Time:5.2522 Method:cmd.php Processes:2 Th
reads:N/A Hosts:2 HostsPerProcess:1 DataSources:1 RRDsProcessed:1


Please let me know if this fix is fine or will have more problems....

Thanks.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Hmm, interesting. One of the devs should look at this and comment, since you really shouldn't have needed to change that.
tymbow
Cacti User
Posts: 54
Joined: Sat May 14, 2005 8:00 pm

Post by tymbow »

BSOD2600 wrote:Hmm, interesting. One of the devs should look at this and comment, since you really shouldn't have needed to change that.
I can confirm this. I was doing some tests using PHP 5.2.0 and I have the same error message from the cmd.php poller. The test system was PHP 5.1.6 and all was OK until the upgrade of PHP (which was the only change). I also did the little test with the $guess variable and noted that with PHP 5.2.0 it is indeed upper case (in my case D:) however with the previous PHP 5.1.6 version it was lower case (in my case d:).
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Looks like they fixed the bug. But, since we have to support multiple versions of PHP, I am reluctant to make changes at this point. BSOD, if you have time to perform the forensic's, I can make the changes to the poller code to reflect the correct versions and bypass this warning in those cases.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Oh, I am pretty sure this is script server related... My dog ate my notes...

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Interesting. Well yay for them for finally fixing it... now it's up to the Cacti devs to write a patch ;-).

The only thing I could find that possible affected the change for __FILE__ is actually in the PHP 5.1.3 changelog, bug 36809. Besides from that, nothing else in the 5.2.0 changelog stood out that'd affect the change. Anyone feel free to browse the PHP CVS looking for changes that affect __FILE__ :-P.
papalemon
Posts: 1
Joined: Thu Jul 26, 2007 5:22 am

Post by papalemon »

Hi
I just want to know where do i add the

Code: Select all

$guess = strtolower($guess);
just abit confused =X Everything else is working fine it seemed I'm at step 6 of the installation guide... which is discribed in the first post. sorry if i really overlooked the part where it tells me where i place the code.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Post by BSOD2600 »

Don't bother with that hack anymore. Read the installation guide in my signature. There is a FAQ in there which addresses this problem and the fix.
tom696
Posts: 19
Joined: Sun Aug 15, 2010 8:47 pm

cacti didn't show any reaction

Post by tom696 »

i already install cacti..but cacti didn't show any graph..

i have follow step by step to used this cacti but i always have get problem..

this the link that i follow to used cacti....
http://bsod2600.home.comcast.net/~bsod2 ... s.html#FAQ
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest