DOS Commands

Sep 12, 2005

the command which would allow me to run DOS commands from PHP. I am not quite sure, but I remember `or ' allowing me to run commands. Also could you tell me what this process is called so I can learn more about it on the PHP website.


How To Run Commands In Php

Jun 16, 2007

I am trying to run a matlab script.(This script you can run from the command line by command 'matlab -r scriptname').

But when I use this command inside a system or exec I don't get any output, nor does the matlab opens and executes as it does in case of command line..I am doing like:

echo exec(' matlab -r scriptname');

View 5 Replies View Related

Set Of Commands

Jul 17, 2005

I'm writing my own blog software, and I just want to be able to stick some commands into the body of a post and have PHP do some actions based on them.

so like if my post is:

Today I took a walk and I didn't see anything interesting at all. Here's a picture of me taking a walk:

then php would automatically replace the last line with an image #21 from my database

View 1 Replies View Related

Use The ZIP Commands In PHP?

Dec 13, 2006

I'm not sure if I understand ZIP. Must my webhost have some kind of ZIP support installed or can I just use the ZIP commands in PHP?

View 1 Replies View Related

AT Commands

Jun 1, 2007

Anyone any suggestions on sending AT modem commands to a mobile phone connected via Bluetooth, primarly to send SMS. How would you get php to send these commands



View 1 Replies View Related


Sep 24, 2007

I have PHP 5 and users upload images while they put some info and all of these data are deleted after some period of time, but i am just afraid in case of any error some images stay there in the server. So I want to know how to check its last accessed date and creation date and any info related to date, so i regularly check and delete when expired.

View 1 Replies View Related

Commands To Php

Aug 24, 2007

//# Usage: lame -b 112 original.mp3 output.mp3

lame -b 112 ("/home/rmbsite/public_html/temp/" . session_id() . ".mp3" "/home/site/public_html/temp/112_" . session_id() . ".mp3");

View 9 Replies View Related

Commands Shell From PHP?

Oct 16, 2001

How can I execute a command shell from PHP? For example a ls -l from PHP, What is the command?

View 3 Replies View Related

Multiple Commands

Jul 17, 2005

In my PHP code, I want to execute the following two commands:

use mydb;
select * from mytbl;

Now, I can get it work with the following statements:

$SQL = "use mydb";
$result = mysql_query($SQL );

$SQL = "select * from mytbl";
$result = mysql_query($SQL );

What I really wan to do is "something" like:

$SQL = "use mydb ";
$SQL .= "select * from mytbl;";

$result = mysql_query($SQL );

i. e. I want to concatenate the two statement and execute the query only

Is there a way to do this with mysql_query (or with someother function)?

View 10 Replies View Related

Shell Commands

Sep 1, 2003

Is it possible to write a script that will run commands at a command prompt? say copying some files and changing ownership on some files, like an install script?

View 4 Replies View Related

How Can I Run Root Commands In Php

Jan 3, 2008

I need to run a command as root to create users on the system for webmail

What is the best way to do this?

View 6 Replies View Related

PHP Shell Commands

Jan 11, 2008

Some php applications store database passwords into files which can be
read by the user www-data.

So, a malicious user which can write php scripts could read those passwords.
What should I do to prevent users from viewing those passwords?

View 17 Replies View Related

Which Session Commands Do I Need?

Feb 27, 2006

I have a problem and I was told to check out the sessions part in PHP. What I want to deal with is the following :

I have a PHP page with a form, where the user writes some data. These data are then written into a file which is then used in a system command as input for an external program (NOTE: The data MUST be written into a file, it cannot be done elsewhise, because the external program takes a file as input).

The thing is that I must somehow create a file everytime a user enters data into the form, so I must learn something on sessions I think. since I don't have a login system or something like that, but just want to create a different file each time (with the session_id being part of it, so that the file is unique), which session commands do I need?

View 1 Replies View Related

Using Multiple Commands

May 30, 2006

How do you use all of these commands on a single insert entry?

addslashes(), stripslashes(), htmlspecialchars(), htmlentities()

how would you use it on something such as this: $result = mysql_query("UPDATE products SET mainContent = '$mainContent'");

Anyone have a clue?

View 7 Replies View Related

Mysql Commands

Jun 4, 2005

I installed mysql server on my winxp platform. To make sure i'm connected to the mysql server i wrote the following command in the dos window:


program filesmysqlmysql server 4.1inmysqladmin -pmypass -uroot ping

and recieved the following notification:


mysql is alive

which means: i'm connected to mysql.

View 7 Replies View Related

Run System() Commands

Feb 15, 2004

at the moment, i use a couple of cronjobs and wget to update some bits of the site, i would like to be able to specify a manual update by calling wget from an admin page. the system() call works correctly, but i get permission denied. because, i presume, apache doesn't own the directory i am wget-ting to. i can't chown the whole directory to apache.apache, because i need access to the directory for other users, (ftp). doesn anyone know a way around this?

View 1 Replies View Related

System Commands!

Oct 3, 2005

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?

View 1 Replies View Related

Where Do Commands In Mysqladmin Go??

Jun 20, 2006

Ok i have to use a wordpress plugin.. but to make it all work i have to go into cpanel and then into phpmysqladmin and select my database and then give it a command..

View 2 Replies View Related

HTML Commands

Jul 28, 2006

I'm seeking a way to rasterize (that is convert to a raster of bits) HTML commands. My belief is that I'd do this by directing the HTML to an off-screen window or port, and then asking to get back a JPEG or other image format of the bits of that window.

View 3 Replies View Related

System Commands

Jul 16, 2005

i'm running the following php script, and where i would expect it to create a file, test.txt, it doesn't. it isn't in the directory i am exectuting the script in, nor can i do cat on it not that i would expect to, since it doesn't exist:


print system("ls > test.txt");

print system("cat ls.txt");


View 2 Replies View Related

System Commands Via Web

Aug 13, 2007

I am attempting to build a web form that will be used to launch the below command. However, the backslashes for the command line options are giving me a headache. The web form will have inputs for each option such as Adminuser, Adminpass, Adminhost, Adminport, CMD etc. COMMAND LINE COMMAND:

ftpconfig.exe /ADMINUSER=Administrator /ADMINPASS=password
/ADMINHOST=localhost /ADMINPORT=31000 /CMD= adduser /server="Server1" /user=user1 /password=user1password


<? PHP

if (($_POST[username] == "") || ($_POST[userpasswd]== "")) {

header("Location: createuser.html");
else {
$result = $_POST[username];

View 4 Replies View Related

Run Shell Commands With PHP

Dec 5, 2005

I want to run few shell commands with PHP. I need to run lsof i :<port_no> and kill all the process running on that port number. I tried"

$output = shell_exec('lsof -i :8080');
print "<pre>".$output."</pre>";

View 1 Replies View Related

Executing DOS Commands From It

Feb 25, 2011

I just wanted to know whether I m able to run Windows based commands like netstat using PHP code.

View 1 Replies View Related

Execute SSH Commands Via ?

Jun 7, 2011

I am looking to SSH out via PHP. What is the best/most secure way to go about this? I know I can do: shell_exec[url].....

View 5 Replies View Related

Unix And Commands

Aug 14, 2007

I'm currently working on the intranet site for our company and i've been asked to create a site where the status of our unix server is been displayed. at the moment all admins have their own logon using AIX (v4) and using the command topas to display the idle and other info.

what i want to do is create we php script that connects to the server using a logon and executing the topas command. i then want to display the idle process (but tahts not that importaint. i'll get to that when i'm able to connect to the server.

View 12 Replies View Related

Bug In System And Exec Commands

Jan 21, 2002

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:
for ($i=1; $i<=5; $i++) {
system("php script2.php");

Script 2:

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 (ID 14997), but so far to no avail.

View 1 Replies View Related

Telnet & Run Commands Thru Http

Aug 22, 2001

I need do open a telnet session from a web page then pass a set 3 sets of command to it with a 5 second delay between each command the last command is to exit and close the telnet window
I really need help will this I have heard it can be done by sockets but iI have not used it before.

View 2 Replies View Related

MySQL Commands With Require()

Jul 25, 2002

Just wondering if it is possible to run MySQL commands through a require() include file. I have a header for a page that includes some MySQL queries and such. I want to do a if/then, based on some variables, to display different headers with different MySQL commands for the same page...instead of making 10 different pages. But when I include, with require(), anything with MySQL commands, the page won't work at all. Any advice? Thanks.

View 1 Replies View Related

Displaying Shell Commands

May 14, 2001

How would I display a information on my website identical to how it would look if i typed it on a shell? For example, if I type df at the shell it puts each different partion on its own line. If i do: system("df"); It all gets jammed in to one line.

View 1 Replies View Related

File Upload Using Ftp Commands

Jul 17, 2005

Because of limitations of my provider, I am forced to use the ftp
functions to upload files to my server (the permissions on the server
will not allow me to load files via php).

I have successfully ported the sample code from to do everything
BUT upload the file. I can connect. I can log in. I can change
directories. But the file never uploads. As I note in the code, I have
tried using ftp_put with the local filename, and I have tried using
ftp_fput with the file in /tmp/php with no luck. Suggestions are welcome.

Code: ( text )

View 3 Replies View Related

How To Execute Two Commands Within 'system'

Feb 14, 2006

On PHP4, I want to execute these two system commands:
# cd /home/foo1/foo2
# /usr/local/php/bin/php /home/foo1/foo2/script.php

If I do it via shell, it works ok.

But If I do:
system("cd /home/foo1/foo2/", $retval);
system("/usr/local/php/bin/php /home/foo1/foo2/script.php", $retval);

I get this error message:
Fatal error: main(): Failed opening required '../config/config.php'
(include_path='.:/usr/local/php/lib/php') in /home/foo1/foo2/script.php
on line 2

This error is caused by the fact that the script is not executed in the
right directory.

View 2 Replies View Related

Executing Linux Commands W/PHP

Jan 7, 2002

I was just wondering if anyone knew how to properly execute a Linux command in a PHP script? I have been trying this: PHP Code:

View 2 Replies View Related

Getcwd() And Opendir() Commands

Dec 29, 2004

Ive got this PHP gallery script that reads the folders in a directory via the 'getcwd()' command to generate a gallery.

I'm trying to link this gallery into my main file, via inlucde:

the index file is in the root dir, /home/firestar/public_html/ and the gallery file is in the images/gallery/ folder.

Ive tried changing the opendir to different dir, but the script doesnt work unless its in the gallery folder!

If that sounds a bit strange, heres the script:

View 1 Replies View Related

Executing Commands (linux)

Jan 18, 2005

I'm not really sure the best way to appoach this but basically i want to be able to run game server commands in a specific linux account eg.

'screen -A -m -d -S hlds_server1 ./hlds_run -game cstrike -autoupdate +servercfgfile server1.cfg &'

I want to run this off a different liux account (not root) i tried using the search on the forum but want really sure what to search for so i didnt get very far.

Whats the best way to go about this?

can i use shell_exec() and login to my other accout and run these commands? i have tried this but couldnt figure out how to login to my other account. i would preferable like to beable to do this remotely (but atm my http server is run on the same server as the server i run my games off) so might the way to use sockets and connect through ssh port? and send the commands through that?

View 1 Replies View Related

Sh And Psql Commands From Exec()

Sep 15, 2006

I'm having problems with exec().

I'm trying to execute a shell script that executes psql command to dump results to a CSV file.

exec('/bin/sh /path/'); executes

/usr/local/pgsql/bin/psql -d dbname -u user -f /path/output.postgresql

(output.postgresql is the file that has some queries to output the results of a select statement to an output CSV file.)

while this works on my local machine (Intel Mac OS X 10.4, Apache 2.2, PHP 4.4.3) it fails to run on FreeBSD (Apache 1.3, PHP 4.4.2).

it seems like the user "nobody" running the Apache Web Server is failing to run the commands using the exec() function. I'm guessing that the reason why it's failing is that the psql is asking for a password, but I cannot place the .pgpass file since nobody has no home directory.

Also I haven't tried the NOPASSWD for nobody in sudoers file. I'm not sure if this is a good idea since apache can then run any sh and psql commands from exec().

View 2 Replies View Related

Applying Three Commands To The Same String

Dec 29, 2005

All I'm trying to do is keep this string under 36 characters, stop all caps screaming, and then ensure the first letter of each word is uppercase. Here is the code as I figured it should look.

$mail['shortsubject'] = trimtext($mail['subject'], 36) && ucfirst($mail['subject']) && strtolower($mail['subject']);

View 1 Replies View Related

Multiple Database Commands

Mar 14, 2007

is it possible to send mysql a command of this sort? PHP Code:

SELECT * FROM databaseone.tableone, databasetwo.tabletwo WHERE databaseone.tableone.idfield = databasetwo.tabletwo.idfield AND databasetwo.tabletwo.field = 'abc'

View 1 Replies View Related

Preventing SQL Inject Commands

Mar 20, 2004

The server that my website resides on got attacked on Friday when someone ran a sql inject command on a site running an insecure script. This in turn put an <IFRAME> tag into all index pages on the server which executed viruses and spyware. This problem has now been sorted by my hosting company and the offending site has been suspended.

As I write my own scripts, I was wondering what measures I should take to prevent this happening with my own scripts? I know using mysql_escape_string has been mentioned a couple of times on this forum. What do you guys do with your scripts to prevent this sort of thing?

View 1 Replies View Related

Convert Php Commands In Java?

Jul 28, 2004

Anyone has a link that can help me to convert php commands in Java? i am connecting to a mysql database and i need commands for the queries. Mostly, i have problems with commands such: if (mysql_num_rows($result12)!=0 && $result12!=0)

View 1 Replies View Related

Eval MySQL Commands

Jul 17, 2005

I'm trying to create a generic object that will work for several
different types of databases. Does anyone know why this won't work?

//Connect to the database
$cmd = $this->db_type . "_connect ("" . $this->server . "", "" .
$this->login . "", "" . $this->password . "");";
$this->id = eval($cmd);

In this case, $this->db_type = "mysql".

View 4 Replies View Related

Is There A Way To Program The Mod_rewrite Commands Into Php

Jan 17, 2006

I checked with my hosting company and they have mod_rewrite enabled. I asked how to set this up and they said I need to program this into my application. After doing some reading it seemed like you can't manipulate this in PHP and it needs to be done using server commands. Is there a way to program the mod_rewrite commands into php that I want to use.

View 2 Replies View Related

Run System Commands In A Script

Nov 10, 2005

Ive been trying to run system commands in a script that I want to create to be able to view SNMP info. The SNMP commands can only be run on a different server.

If I run the following command on the command line it works perfectly. It returns the SNMP info, but when I try to run it in the script it doesnt work

system("ssh $server snmpwalk -v1 -c $comString $routerIp CISCO-STACK-MIB:: portAdminSpeed.2.$port")

View 4 Replies View Related

Combine 2 Imagemagick Commands Together?

Jul 5, 2010

I got 2 seprate Imagemagick commands (resize and crop circle). Is it possible to combine both commands into single PHP exec.

exec('convert original.jpg -resize x100 -gravity center -crop 100x100+0+0 +repage thumbnail.jpg'); exec('convert -size 100x100 xc:none -fill thumbnail.jpg -draw "circle 50,50 50,0" circle.png');

View 3 Replies View Related

Commands That Query The Mysql?

Mar 16, 2011

i need php commands that query the mysql products database to display the name of the book wivh have the ID = 7 such as the following :

Html values: $search= name $ID_condition=7

View 1 Replies View Related

Executing Cmd Commands In Windows?

Jun 23, 2010

Is it possible to execute cmd commands in Windows OS with PHP exec() function?

I tried this:


try {
echo exec(
'O: estpdftk.exe O: estoutputsOPPout.pdf O: estoutputsOPPout2.pdf cat output O: est123.pdf'
} catch (Exception $e) {
echo $e->getMessage();

Basically, I'm trying to merge two pdf files with the pdftk program. If I just write the same exact command to the cmd by hand, it works and the O: est123.pdf file is created. But when I execute the above PHP file, nothing happens (blank page, the file is not created).

View 3 Replies View Related