Eddie Shipman
asked on
mySQL command like MSSQL EXEC?
In MSSQL, you have access to the command line using the EXEC xp_cmdshell 'DOS command goes here'.
Is there anything like this using mySQL to run a PHP script?
Is there anything like this using mySQL to run a PHP script?
I don't believe there is for security reasons.
I think I misunderstood the question. |Sorry about that.
PHP has an exec() function for this purpose (provided your server has it enabled) - does that not work for you?
http://php.net/manual/en/function.exec.php
PHP has an exec() function for this purpose (provided your server has it enabled) - does that not work for you?
http://php.net/manual/en/function.exec.php
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yes, jrm213jrm213, exactly what I need. I don't think the others quite understood. ;-)
I'm not saying MSSQL is any more secure than mySQL, BTW, but if it's for security reasons, why would MSSQL have something like it?
The whole reason behind this is that I have a stored procedure where I need to actually download a file and store the file name in the database. This is for a vendor file import routine for my e-commerce solution. The images are links and I can do it in PHP but I *NEED* to do it in my stored proc.
I have a PHP script to do the import but have converted the whole thing to mySQL functions and stored procedures to speed up the process and that is the last thing on the agenda, importing the image.
I'm not saying MSSQL is any more secure than mySQL, BTW, but if it's for security reasons, why would MSSQL have something like it?
The whole reason behind this is that I have a stored procedure where I need to actually download a file and store the file name in the database. This is for a vendor file import routine for my e-commerce solution. The images are links and I can do it in PHP but I *NEED* to do it in my stored proc.
I have a PHP script to do the import but have converted the whole thing to mySQL functions and stored procedures to speed up the process and that is the last thing on the agenda, importing the image.
Hi!
Here are some PHP MySQL procedure examples
http://www.java2s.com/Code/SQL/Procedure-Function/CallingastoredprocedureinPHPanddealwiththeresult.htm
http://www.java2s.com/Code/SQL/Procedure-Function/ReturnthefilesizebyusingtheLOADFILEfunction.htm
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_load-file
which gives you an idea on how to call procedure and insert a image/file into blob using LOAD_FILE function.
Regards,
Tomas Helgi
Here are some PHP MySQL procedure examples
http://www.java2s.com/Code/SQL/Procedure-Function/CallingastoredprocedureinPHPanddealwiththeresult.htm
http://www.java2s.com/Code/SQL/Procedure-Function/ReturnthefilesizebyusingtheLOADFILEfunction.htm
http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_load-file
which gives you an idea on how to call procedure and insert a image/file into blob using LOAD_FILE function.
Regards,
Tomas Helgi
Hi!
One other thing. You would have to download the images from a remote website to your site temporarily (to a tmp directory) using PHP and then issue a
call to the MySQL procedure to store the file to db.
Regards,
Tomas Helgi
One other thing. You would have to download the images from a remote website to your site temporarily (to a tmp directory) using PHP and then issue a
call to the MySQL procedure to store the file to db.
Regards,
Tomas Helgi
ASKER
I cannot do that without some kind of EXEC functionality because my procedure iterates through the records of the import file that was loaded into a table using LOAD DATA INFILE.
Since the file must already reside on the host, LOAD_FILE ain't gonna do that for me.
I don't need to load them in a BLOB field because the local filenames are stored in a table,
like it should be .vs in a BLOB.
BTW, I already know how to call the stored proc from PHP.
Since this seems undoable, I may just do the images after the initial data load.
Since the file must already reside on the host, LOAD_FILE ain't gonna do that for me.
I don't need to load them in a BLOB field because the local filenames are stored in a table,
like it should be .vs in a BLOB.
BTW, I already know how to call the stored proc from PHP.
Since this seems undoable, I may just do the images after the initial data load.
You execute mysql queries using it, though, not PHP.
PHP has it's own command line executable which will execute a PHP page though, PHP.EXE.