![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 54
Rep Power: 4
![]() |
PHP system commands
Hi all!
I want to execute system commands through the functions provided by PHP (like exec, system etc) In the LINUX machine in my work, everything seems to be OK, when, for example, I write system `ls`; and I print it on the screen. In my home PC on the other hand, where I have winXP and the Cygwin platform installed, none of these works. 1) Is the Cygwin platform sufficient to run system commands or must I have LINUX machine? 2) Do I need to change anything in my php.ini file in order to 'activate' the system commands? Thanx! |
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
The systems have different commands. 'ls' would need to be 'dir' on a Windows machine or you'd need aliases. Arguments would no doubt vary to some extent, also. If your PHP app is in a client/server relationship with the client issuing system commands through interaction, you're in a very insecure situation.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Programming Guru
![]() |
The system execution commands have also been seen by me, and a few other people, to have issues with Windows XP. Are you testing your php script in a Cygwin Linux environment, or on the windows one?
__________________
|
|
|
|
|
|
#4 |
|
Programmer
Join Date: Oct 2005
Posts: 54
Rep Power: 4
![]() |
Yes, you are right.
I used `dir` and it worked fine.. So I guess I can't easily communicate with windows as I can with Linux ... Thanx for your time! |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Sep 2004
Posts: 207
Rep Power: 5
![]() |
Of course not. :p
__________________
_______________________________ BlazingWolf |
|
|
|
|
|
#6 |
|
Newbie
Join Date: Sep 2005
Posts: 3
Rep Power: 0
![]() |
detect the os first
after detecting the os, then customize your system commands... (i hope it works)
|
|
|
|
|
|
#7 |
|
Programming Guru
![]() Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5
![]() |
yeah, after hearing that two completely different operating systems use different commands i'm still scratching my head...?
why couldn't leibniz simultaneously come up with newton's notation? i like that one better. (albeit somewhat less descriptive) :p
__________________
i put on my robe and wizard hat... Have you ever heard of Plato, Aristotle, Socrates?...Morons. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|