PDA

View Full Version : PHP script documentation


maddin
11-10-2004, 11:40 AM
as there is a php script support in ioftpd, i want to write some test scripts for myself, but i don't find any documentation about that topic. even searching the forums brought no real matches. so, can anybody tell me how to write a php script for io or how i can access io-vars?

i'm not a complete php newbie, i wrote many web-scripts, but i haven't written any cmd-line scripts so far...

thx in advance

by the way: php5 support would be nice because there are many errors when starting io with php5 (which is installed for my local webserver)

ADDiCT
11-10-2004, 12:23 PM
Originally posted by maddin
... but i haven't written any cmd-line scripts so far. currently, there is only php support for the internal webserver. next ioFTPD version wil (probably?) have support for scripts on events (like iTCL now)

edit: oh yeah, u can run "php.exe script.php" on events, and then read the environment variables from $_SERVER (i think, check phpinfo(); to see which system array contains them)

this (http://www.ioftpd.com/board/showthread.php?s=&threadid=2597) documentation has been enough for me to write some http pages to list active users, browse the directory structure, add users, ...

jeza
11-10-2004, 03:34 PM
php scripts


site transfer
http://www.ioftpd.com/scripts/script.php?id=156

php_psio
http://www.ioftpd.com/scripts/script.php?id=6

maddin
11-10-2004, 03:44 PM
well ok

that means that i have to run my scripts for example by the following lines (copied from php_psio) with optional parameters

[events]
OnUploadComplete = EXEC php.exe -q D:\ioFTPD\php_psio\zipscript-c.php
OnUploadError = EXEC php.exe -q D:\ioFTPD\php_psio\zipscript-c.php

i'll try that

thx for the help

SnypeTEST
11-10-2004, 07:51 PM
maddin.. yep, or wait for next version of io :)

maddin
11-11-2004, 10:50 AM
until next version is out, i'll have to use this method


but now i have another problem:

quick system information:
- win xp sp2
- ioftpd 5.8.5r
- apache 2 + php 5!! + mysql 4.0.21
- php folder c:\programme\php (would be c:\program files\php on englisch xp)
- php.ini from php5 in c:\windows

when i run my short test.php ( <?php echo "test 1 2 3"; ?> ), i get the following "error" message, the script works though:

[R] SITE test
[R] 200-test 1 2 3
[R] 200-200 SITE COMMAND SUCCESSFUL
[R] 200-Cannot find module (IP-MIB): At line 0 in (none)
[R] 200-Cannot find module (IF-MIB): At line 0 in (none)
[R] 200-Cannot find module (TCP-MIB): At line 0 in (none)
[R] 200-Cannot find module (UDP-MIB): At line 0 in (none)
[R] 200-Cannot find module (SNMPv2-MIB): At line 0 in (none)
[R] 200-Cannot find module (SNMPv2-SMI): At line 0 in (none)
[R] 200-Cannot find module (UCD-SNMP-MIB): At line 0 in (none)
[R] 200-Cannot find module (UCD-DEMO-MIB): At line 0 in (none)
[R] 200-Cannot find module (SNMP-TARGET-MIB): At line 0 in (none)
[R] 200-Cannot find module (SNMP-VIEW-BASED-ACM-MIB): At line 0 in (none)
[R] 200-Cannot find module (SNMP-COMMUNITY-MIB): At line 0 in (none)
[R] 200-Cannot find module (UCD-DLMOD-MIB): At line 0 in (none)
[R] 200-Cannot find module (SNMP-FRAMEWORK-MIB): At line 0 in (none)
[R] 200-Cannot find module (SNMP-MPD-MIB): At line 0 in (none)
[R] 200-Cannot find module (SNMP-USER-BASED-SM-MIB): At line 0 in (none)
[R] 200-Cannot find module (SNMP-NOTIFICATION-MIB): At line 0 in (none)
[R] 200-Cannot find module (SNMPv2-TM): At line 0 in (none)
[R] 200 Command successful.

i think it's because php5 is installed and io is shipped with php4

the script is called by:
[FTP_Custom_Commands]
test = EXEC php.exe -q C:\Programme\ioFTPD\scripts\test.php

any ideas?

SnypeTEST
11-11-2004, 10:53 AM
nope, havent tried 5.0 yet, actually, I have :P .. try umm, puttin the windir or systemroot dir in the ioftpd.env ?

maddin
11-11-2004, 11:10 AM
found a solution myself faster than i thought... ;)

in the log there are many lines saying something about snmp. so i just commented out a few php extensions which i don't need. one of these was "php_snmp.dll". furthermore i moved my php.ini from c:\windows to c:\programme\php. now it works...

[R] SITE test
[R] 200-test 1 2 3
[R] 200-200 SITE COMMAND SUCCESSFUL
[R] 200 Command successful.

thx for all your help anyway

maddin