Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Exec - Create An Executable That Return The System Drives


I need some help about exec command. I have create an executable that return the System Drives. It is based on DOS and does not need any parameter.

I have create my php script that executes the executable i've create and the source code is the following: ...




View Complete Forum Thread with Replies

Related Forum Messages:
Return Same Data From Executable To Php As In Command Prompt
I've been trying to use passthru() exec() and system() to execute Apache's htdbm.exe (htaccess user database) and to get some info returned. For example I have tried as a test to htdbm -l .htpasswd, this to return the users in the databaase. None of the functions return the
users in the database while the same string does do this in command prompt. I know there is nothing wrong with the string because when I replace some vars at the end I can add users to the database with php, now it does return a message that this has been done. Al I want is that the same thing that is being returned in command prompt is also returned to PHP.

View Replies !
Exec Gives Return Code 127
I'm trying to run this Code:

exec($gpg_cmd,$return,$exit_code)

and the command is Code:

/usr/bin/gpg -a --no-tty --batch --yes --no-secmem-warning -o '/var/www/html/uploads/agla/new_leads 11-03-2006.csv.pgp' -r '***Key Goes Here***' -e '/var/www/html/uploads/agla/new_leads 11-03-2006.csv'

it works fine from the command line. But ran from the script it returns 127, my apache installation is not chrooted, safe mode is not on, I turned off selinux, I even tried a symbolic link to the binaries in my cgi-bin directory, then changing the paths in my script. I've tried using system, and got the same problem.

View Replies !
Exec() Return Code 127
I'm having problem executing shell command as well as script using exec(), system(), or passthru(). It always return code 127, and even really simple script doesn't works :

<?php
exec("date",$date, $int);
print 'date :'.$date[0]."return value " .$int."<br>";
?>

I tried to change the permission of the file, move the file, change the owner of the file without any sucess. My guess is that "php" doesn't have the right permission.

View Replies !
Using Exec Function To Get A .exe Return Status Gives CGI Error
I'm trying to make a web page to work. It worked before so it has to
be something related with the configuration.
My problem is a call to a compiled executable (made for me) that
returns 1 or 0. It does not print any text to the standard ouput so
the error is strange:
CGI Error: The script can .. because of the HTTP headers (I have it in
spanish so the message is not the exact one).

As supposed, the HTTP headers are needed only if the executable prints
out a text to the browser but it's not the case. And (I repeat) It
worked as it before. The machine had to be formatted and the guy in
charge of that is not with me anymore.

View Replies !
PHP System() And Exec()
Background: I am trying to execute a binary on the server located in the current directory where the php script is being run. The server is a linux (debian based). I am having trouble getting php to execute the binary properly, below is my code. Code:

View Replies !
System() And Exec()
If you start a program using this function and want to leave it running in the background, you have to make sure that the output of that program is redirected to a file or some other output stream or else PHP will hang until the execution of the program ends.

I have tried numerous time by redirecting to a file or other stream to free up a php web page that called a perl script for example, but the php script always hangs...has anyone had any luck freeing up a calling php script from a process, or program that it launched in the background? Code:

View Replies !
Exec(), System()
I write very, very simple script who call external program. The script is run on Linux Slackware, Apache/1.3.37 (Unix) mod_ssl/2.8.28 OpenSSL/0.9.8b PHP/4.4.4 here is my script:

<?php
echo exec('ls');
?>
this work properly.

but if i write:

<?php
echo exec('xine'); //xine is a multimedia player
?>

View Replies !
Bug In System And Exec Commands
If PHP is running via a web server, and mutiple system
calls are made within the script to another script,
hundreds of processes are created. Here is an example:

Script 1:
<?php
for ($i=1; $i<=5; $i++) {
system("php script2.php");
}
?>

Script 2:
<?php
exit;
?>

The effect is the same (and more difficult to stop) when
the system calls are made in the background. e.g.

system("php script2.php >>/dev/null 2>>/dev/null &");
system("php script2.php >/dev/null 2>&1");

I have even tried calling a shell script, which in turn
calls the second PHP script (both in the background), but
it still causes lots of processes.

The "exec" command is also affected.

At first, I thought this was a problem with either Zeus web
server of Fast CGI, but I have since tried it with Apache
and normal CGI with the same effect.

Does anyone have any idea why this happens and whether there is any way to prevent it? I have posted a bug report to bugs.php.net (ID 14997), but so far to no avail.

View Replies !
System() Or Exec() And Permissions
I'm trying to run a command (mogrify) that requires that I'm logged in as root, or at least I think this is the case. How can I do this?

View Replies !
Exec() And System() Problems
I am trying to use php's exec() or system() to execute a shell script that I wrote.

exec and system() work fine with a simple command like ls, but nothing happens when I point it at the shell script.

The shell script works fine from my shell login. Can't figure out what tho problem is. Is php just incapable of running shell scripts?

View Replies !
Using Passthru(), Exec(), System() Etc.
I have an executable that runs as expected from a command prompt but seems to do nothing when I try to run it from php, using passthru(), exec(), etc.

View Replies !
System/shell/exec/etc
I've got PHP 5.1.6, Apache 2.2.2, on Fedora 5. Everything is great except that when I use an of the external launching commands, persistent apps dont stay open. I have a simple shell script set up to load an app, and I have it write a PID file. Immediately after calling exec (milliseconds later) the PID is alive. However, within a few more milliseconds it seems to close.

I've made sure that the apache uid/gid have full access to the script and the apps it calls. When sudo'ing manualy in a shell with the apache uid, the script works flawlessly and loads the program, and stays open, as it should. I've verified that the app loads under the uid 'apache' with ps. When running it through PHP, it seems to close almost immediately after succeeding.

Is there some fundamental issue with how this works that I'm missing? I can't seem to get any real errors out of php, apache, or even the shell when redirected to a file. Should I try PHP4? Is PHP5 buggy with this kind of thing? I even tried running 'at' to schedule the script (so that it'd be invoked by at instead of the shell itself) but that failed, silently, as well.

View Replies !
Exec(), System() And Win 2003
I have searched high and low for the past 2 days for an answer to my problem. I have found a few references, but nothing has helped me. My problem is this: I am trying to ping a remote server from a PHP script in IE 6.0. When I load the page, the cmd.exe loads on the server and takes up all my CPU. I have to manually stop the process for it to go away.

My setup is this:
Windows 2003 Server
PHP 5.0.1

I have tried
- giving my system32cmd.exe full IUSR_%machinename% rights
- moved the cmd.exe to the script folder, to the PHP folder

And about a million other things that I can't remember =(. I have tried multiple functions, written in mulitple ways and the outcome is always the same. when the cmd.exe is opened it hangs on the 2003 server.

View Replies !
Use Exec() In PHP 5.2 On A Windows XP Pro System
I'm trying to use exec() in PHP 5.2 on a Windows XP Pro system. What I'm trying to do is use it to tell an already running program what to.

For example:
X:pathprogram.exe /something
or
X:pathprogram.exe /something_else

If I do the command through the command line, it works, but so far I have been unsuccessful in PHP. Usually it PHP just hangs, and give no error message, and does nothing to the program.

View Replies !
Problem Using System/exec Function.
I am faced with strange problem. Basically I want to make a script which would take mysql back up for me. I have come up with following. [ basically code is borrowed from some other place ]
PHP Code:

View Replies !
Using System/exec, How To Backup Database?
system("mysqldump --opt myDatabase > backup.sql");

here are my problems,

i don't think it works on the webserver. next, where exactly the file, backup.sql be place if it does succeed.

i believe we just can't execute commands on the webserver can we?

i also tried using the sql query BACKUP TABLE ... TO .. but i'm guessing the problem lies with the TO... how do i know what directory shall i place it therE?

for instance, my pages are placed in,

home/myname/public_html/...

i tried to put
home/myname/public_html/backup in the TO but nothing happens.

View Replies !
Exec(), System(), Shell_exec(), Etc + Nmap
i'm trying to create a script that executes nmap from my server, then displays the output.

i've tried:

$output = passthru('nmap -v -A'.' $ip');
$output = shell_exec('nmap -v -A'.' $ip');
system('nmap -v -A'.' $ip');

the problem i'm having is that using the above methods i only get the first line of output, ie.

Starting Nmap 4.20 ( http://insecure.org ) at 2007-08-31 21:46 CST

and nothing else. i've managed to find a way around it by sending the nmap output to a textfile, the using file_get_contents() to pull the data back in:

exec('nmap -v -A '.$ip.' > /usr/local/www/apache22/data/nmap/'.$ip.'.html');    
$file = "/usr/local/www/apache22/data/nmap/$ip.html";
$result = file_get_contents($file);
echo "(pre)$result(/pre)";

that works perfectly, but i'd rather not be writing anything to the drive. i guess the problem might be that nmap takes about 5-10 seconds to do its scan, and for some reason php doesn't want to wait that long, i really have no idea. can it be made to work without needing to write to files?

and for the curious minds, i'm not doing anything dodgy, i just wanted an online tool i could access from any computer to test networks i support .

View Replies !
System/exec Not Working In Browser
In two files, and I serve foo.php then I notice If I use commandline execution i.e. php foo.php then foo.txt is touched/created all right. i.e. system command is executed as expectedBut If I use browser then I notice that the shell command in config.php is *not* executedAny ideas as to why this might be happening? Code:

View Replies !
Command Window - Exec/system
I'm in the process of developing a script in Windows where I need to use exec/system. Whenever I execute either, Windows spawns a command window which automatically sappears. Is there a clean way to force Windows to NOT display the command window?

I've seen this discussed a few times previously, but, none of the
solutions seem to be working (tried both exec and system; tried using
cmd /c, tried using start /B, etc.)



View Replies !
Exec, Shell_exec, System, And Passthru Not Working At All
Can't get these commands to work! The following page simply doesn't
finish loading ( Waiting... Opening... :-( )

<?php echo system("dir"); ?>

The same for <?php echo exec("dir"); ?> or <?php echo
shell_exec("dir"); ?>, etc...

I'm running Apache 2.0.55 & PHP 5.0.5 with Zend Optimizer v2.5.10 on
windows XP SP2.

View Replies !
Exec And System Commands Blocked By Host
I've got this code, its the simpliest example I could make. It works perfectly on my windows xp/apache/php box, but doesn't do anything on a commercial website host. The actual code should use gzip to compress a folder but that doesn't work either.

Anyone know the reason why they would be blocking these commands? I suspect the problems with commonly used php apps like phpBB to be the real reason.

<?
exec("ping 127.0.0.1 > test.txt") or die();
// get contents of a file into a string
$filename = "test.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));

fclose ($fd);

echo $contents;

?>

View Replies !
Alternates To System() And Exec() In Order To Use ImageMagik?
My Web host apepars to not allow exec() and system(), as a line in my script:

system("convert -scale 100x100 $uploadfile $toimage");

gives the error:

"Warning: system() has been disabled for security reasons"

Is there some other way to use ImageMagik (or is it GhostScript?)'s
"convert" command in PHP that may be safer and generally allowed by Web
hosts?

View Replies !
Running An .exe File Using Exec() Or System(), Unable To Fork Error
I have a problem with running an .exe file using exec() or system() I have downloaded a file called ffmpeg.exe for converting movie clips. I can use the program thourg the command line in windows (cmd), but I'm not able to have PHP run the file. First PHP gave be an "unable to fork" error. But then I gave users access to the cmd.exe file and solved that problem. So now is no problem running for example exec("dir");

View Replies !
Create Db Firebird With Php, Exec Does Not Want To Execute A File .bat
I am trying to create db firebird with php, script php generates and executes a file .bat . the file .bat creates db using isql in c:firebirdin, but .bat does not create db when is called by php script, but the file .bat if it works when it is executed from MSDOS, creates db correctly,

the question is ¿why the file .bat creates the data base when it is executed by MSDOS but it does not work when is executed by exec in php script? as php script can execute .bat to create db? PHP Code:

View Replies !
System Call Doesn't Return Correctly
i've got a function to convert media-files. the funny thing about it is that it converts the files but doesn't recognize it did. the system- and exec-calls return 0.

i execute it in the shell with php phpfile.php and the output of ffmpeg is correct and doesn't show any errors. the line "print_r($tmp)" returns "0"! why? Code:

View Replies !
System() Call Perl Script Return Code 13 ?
I run into major problem here and I still cant get it resolved ?

I tried to execute a perl script using the PHP system call

$haha = system('perl /home/testing/cron_scripts/generate.pl', $retval);

echo "Haha is $haha<br>";
echo "Ret Val is $retval<br>";

The problem is I keep getting $retval = 13 ? But if I were to run them from Command line it works. However the script will take sometime. I am not sure if 13 means the code is running or something ? But the problem is my PHP script just exit !

View Replies !
Create A Query That Will Return All Of The DB's TestIDs,
My site's users take tests, and their responses are recorded in a "response" table. Here are the relevant tables:

User
userID

Test
testID

Response
responseID
testID
userID

I'm trying to create a query that will return all of the DB's testIDs, and indicate if a given userID has taken them. For tests not taken by a user, NULLs will be returned.

Let's say that the DB contains six tests, numbered 1-6. User #4 has taken every test, except for numbers 4 and 5, so there would be responseIDs linking userID #4 to those testIDs.

View Replies !
Query Mysql, Return Highest Value Then Create Value +1
I have a product input form I created (with php freaks help) for my website which I input general information and specs on our products. What I'd like to do now is when that form loads, it searches a seperate table and looks for the highest "ID" number.

It returns the number, adds 1 to it and displays the number somewhere on the input form for reference + error checking. When the form is submitted it takes that form and creates a record pushing that number in the correct field.

View Replies !
Function To List Drives
Is there a PHP command to list the drives of the Server.
Or should I check each letter from a...z if it exists?

View Replies !
Create Dynamic Return Paths As Links On Site Pages.
I would like to create dynamic return paths as links on site pages. For example, there might be a link to the whet stone page on both the chisel and plane pages. If my viewer came from the plane page, I'd like the return path to indicate "home->planes->whet-stones", appropriately linked. Likewise if from the chisel page, "home->chisels->whet-stones".

Above the immediate back link, normal site layout logic would apply. Should the referer page be off site, site layout would rule. This doesn't appear to be particularly difficult.

View Replies !
How Do You Retrive Drives And Net Work Connections?
I want to retrieve a list of all the drives (HD, CD-ROM, Removable,
etc) and also network connections/mappings and shares connected to the
computer which is Windows XP.

I am trying to avoid using FileSystemObject if possible. Is there
anyway of doing this with PHP extensions?

My other thought would be to use exec() or a Java applet.

View Replies !
Fopen With Unmapped Novell Drives?
I need to do is when a user clicks on a link I need to check if the link is valid and if it isn't then redirect to another link. Under normal circumstances this would be easy enough to do with fopen(), however here's where it gets messy. The link isn't a standard URL it's a link to a shared Novell drive (for example href="\Novell_Servershare_dirfile.ext) . Does anyone know how to do this with fopen or any function?

All I really need to know is if I can reach that file so that I can link to that file, otherwise try the backup server and path. I have to do this because the files must be on the Novell servers, however the servers themselves may go down in the future during planned upgrades.

If anyone has any input I'd appreciate it. Also, I guess if it's possible to check the Novell server via a linux shell command that might be a workaround, but I'd prefer not to have to do that.

View Replies !
Can PHP Script Read From Mounted Drives?
I have a PHP script which is triggered via an .htaccess file utilizing AddHandler and Action commands. The script has worked perfectly up till recently when I moved most of our web content to a separate RAID server.

PHP includes work for pulling in any page located under my web folder (htdocs). However, if I try to pull in a file from a mounted drive (folder sitting outside the web folder, mapped to a completely different hard disk), nothing happens.

This mapped folder (‘ /content ‘) is a mounted alias that points to the raid server drive. The permissions on the ‘/content’ folder itself, the folder contents and the test script all match those of the web servers Apache process.

To isolate the problem, I wrote a script to read the contents of the mounted drive directory. If I run the script from a shell, it will read the mounded drive directory. However, if I run that same script using a browser from the web folder, it will not read the directory.

Would anyone recommend a different approach?

Are there built in web server or PHP restrictions that will not allow me to read from a folder so close to /root?

View Replies !
System(), Exec(), Shell_exec(), But "Permission Denied"
I want to execute the php script via web server to run linux command. I try to use system(), exec(), shell_exec(), but the system show me "Permission Denied". i have set the file permission by using chmod 777 file.php .

View Replies !
Create A Rating System
I am trying to create a rating system for my site where users can rate items x out of 5. I am having a bit of trouble with doing the math though, I am trying to get an average vote from all the votes atm i am doing it this way:

Current Vote + New Vote / # of votes

That doesn't seem to be correct though because no matter what vote you choose the total rating only goes down, I can vote 5 20 times and the rating will keep going down until it hits 0

View Replies !
What System Everyone, Or Anyone(?) Uses To Create Pdfs?
just wondering what system everyone, or anyone(?) uses to create pdfs?

php has a built in one, then there's ezpdf, which is an add-on? and I think a few others? anyone have an opinion on which is best?

I got confused real fast as you have to count from the bottom UP and I for the list I want to export, some things are 1 line, some 3 lines, etc, so counting up looks confusing... especially I don't even know how to gauge what's one line or not... eg, 100chars of i and 100chars of Z take up a different amount of space.

View Replies !
How Can I Create An Authintication System?
I'm making a financial site based on PHP/MySQL, there are two sections in that site, first one which is a free section have news, stocks calculator and chat.

second section which is paid section has the same fetures plus a portfolio manager for each member, financial analysis also it has a game which is available to members only too.

The Problem i face at the moment is i need to code a php/mysql authentication system so only paid members can access the pages which is in the second section, i need to code a registeration page and loging in page.

View Replies !
What's The Best Way To Create A Page System?
what's the best way to create a page system? My problem is I have a lot of images (around 30) on 1 page that just goes straight down, what's the best way to make some sort of page system that puts like 5 images per page with 6 pages or something like that? Code:

View Replies !
Create A System Where On Every Page There Is A Box With A Space
I'd like to create a system where on every page there is a box with a space: username / password. Also there is one page with similar boxes, as well as one for email address and first/last name. When you sign up originally it takes the entered password and stores in mysql as md5() then when you login it will also md5() password.

I want it to mp5() it from the browser once (javascript) and then again on the server for added security. Anyone can give me the code to this so I can learn the rest.

View Replies !
Create An Upload System For New Users
i wish to create an upload system for my new users to use on my community site.
I want the images to be uploaded to a db, and the db to tell me which user uploaded which image, so i can filter the images out on their profile page.  I would also like to be able to allow them to set a default image.

View Replies !
Create A User Managment System
i want to create a user managment system and I found some scripts and they are kinda what I am looking for for my website.

But I need a script that I can easaly add some of my own coding like. FOR EX/ I want the users to beable to have an ABOUT ME section in their profile along with all the other feilds the UMS comes with.

View Replies !
Create A Session For A Login System.
I have php 5 and I am trying to create a session for a login system. My code is below:

<?php
session_start();
register a session-variable
session_register("color");
$color = "blue";


However upon running this script the following error occurs:

"Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. You can disable this functionality and this warning by setting session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0"

I can view the session being created in a tmp folder but cannot store variables within sessions or view the sessionID. I toggled the register_globals from off to on in the php.ini file and saved that however the changes were not reflected when I ran the script:

</php
phpinfo();
?>

Is there another way to toggle register_globals. Will this solve my sessions problem?

View Replies !
Create A Email System Like Yahoo.
I have to create a email system like yahoo. But i just list emails (Inbox 8) and read emails from server. But i don't know from where i starts. Tell me script or refrence tutorial if any present anywhere and tested. What configuration i have to done please also tell me.

View Replies !
Create A Payment/Subscription System
If you read the terms you agreed to when you signed on, you would see that solicitation is forbidden on these forums.

View Replies !
How To Find The Free Disk Space On The Network Drives
I need to find the free drive space on the network machines. Looked in to the PHP functions and found that there is only one function 'disk_free_space'. But its written that the function cannot be used to find the free disk space on  the network drives.

View Replies !
Login System - Is It I Need To Create .htaccess File?
if i let only registered user can login to the system, using the system such as add some record (add.php)but i must prevent either unregisterd or registerd user from directly add record in the system without login..that means they directly goto(for example)http://www.mypage.com/system/add.php and add record to the system. how can i do it? is it i need to create .htaccess file? how to create? any guide for doing a system like these?

View Replies !
How Would I Create A Login System With Flash Then Load A Page?
I'm creating a login in system using flash mx, php and mysql. flash is being used to create the fields...i know (i think) how to get the login in working but what i'd like to know is how would i get (once the user has logged in) a page to load in a frame?

any help would be greatly appreciated.

View Replies !
Create A Content Managment System For News Section
I am trying to create a content managment system for my news section. Basically I just want a simple way to add new stories, then have older stories move down the page, and after a set amount of new stories are ahead of it move to another page, which will be linked in "<<prev 1 2 3 4 next>>" dynamically as new stories are added. Kinda like a blog but much much more simple.

I really have no idea where to start. I know some php, but mostly just what i pick up from this forum (thanks)and tutorials. If someone could point me in the right direction, or enlighten me on where to start, suggest a good tutorial, suggest another way to go about this, etc.. Any info at all would really be great.

View Replies !
Create New Pages For A Portfolio Using A Content Management System
I need to create new pages for a portfolio using a content management system. Is this possible and if so how? Essentially there will be a template page that the rest are built on but the text details and pictures will change.

View Replies !
Create A Script That Manages My Layout System On My Site
I am trying to create a script that manages my layout system on my site ok and I would like the page to display 10 layouts on the page at once so how would I get it to do so. Code:

View Replies !
Create A Banner Management System Where The User Can Use Both Gif And Swf Files
I'm trying to create a banner management system where the user can use both gif and swf files. Is there a way to get the uploaded file's extension in order to use the appropriate code for each file type to be displayed?

View Replies !
Create A Simple Transaction Handling System Where Users Pay Eachother Via Points Of A Sort.
this might better be suited for the MySQL newsgroup, but I
figured I'ld post here and see if anyone can help me.

I'm trying to create a simple transaction handling system where users
pay eachother via points of a sort.
I have a table where each transaction is stored, in a single row.
It looks like this

transid,from_user,from_amount,to_user,to_amount

Given the above, I just want a simple single SQL statement that can
return a full balance.
Now originally I did this in PHP by querying the DB with the following.

$query[0] = "SELECT SUM(to_amount) WHERE to_user = '$user->uid'";
$query[1] = "SELECT SUM(from_amount) WHERE from_user = '$user->uid'";
$deposits = mysql_result(mysql_query($query[0]);
$withdrawls = mysql_result(mysql_query($query[1]);
$balance = $deopsits - $withdrawls;

This works great, so I populated the DB with over 100,000 records and
now page loads take 75-80 seconds for the total balance sheet page (I
just loop through each user, and there are 100 users), and upwards of
10 seconds on a single user query.

After analyzing the code in the profiler (I'm using Zend), I found the
largest optimization I could make would be to cut out the 2 queries
variable assignment and simple math (basically all of the code above),
and move it into a single SQL statement that does all the math.

This SHOULD be elementary, but unfortunately, MySQL doesn't like my
solution, and searching everywhere I could, I can't seem to find where
anything similar has every been tried. But come on, I know I can't be
the first person in history with a similar need for a query like this.

Here is the most elegant solution I could come up with, in all it's raw
SQL glory.

SELECT SUM(to_amount - from_amount) as balance FROM
((SELECT from_amount as withdrawls FROM transactions WHERE from_user =
&#391;')
(SELECT to_amount as deposits FROM transactions WHERE to_user = &#391;'));

Sadly, even though by every measure I can find it SHOULD work, it just
doesn't.
I keep getting

#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near '(SELECT to_amount as deposits FROM transactions WHERE to_user =
&#391;'))' at line 3

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved