|
Posted by J.O. Aho on 09/10/06 19:22
vesakilp@gmail.com wrote:
> vesakilp@gmail.com kirjoitti:
>
>> vesakilp@gmail.com kirjoitti:
>>
>>> J.O. Aho kirjoitti:
>>>
>>>> vesakilp@gmail.com wrote:
>>>>> J.O. Aho kirjoitti:
>>>>>>> So there wasn't any out put from $error_message. File was still
>>>>>>> created, but it was empty. Starting to piss me off.
>>>>>>> By the way, same mysqldump script works fine when executed in console.
>>>>>> You haven't disabled shell_exec() in your php.ini for the Apache or in your
>>>>>> Apache configurations VirtualHost tag?
>>>>> Not intentionally, at least... How can I check that?
>>>> grep for disable_functions in your php.ini (noticed that this one can't be set
>>>> in the apache config file as other like open_basedir).
>>>>
>>>>
>>>> //Aho
>>> did that, still gives empty file
>> allthought i'm not quite sure that I did what you asked me to, I just
>> put ; in front of disable_functions line in php.ini, don't really know
>> what's that grepping you're talking about, might have something to do
>> with linux shell but I'm using XP....
Okey, assumed you used linux or any other unix like OS, not that often someone
uses "shell" in microsoft.
There is a command named grep that searches for an expression in files
grep disable_functions php.ini
if there would be a line that contains "disable_functions" in the php.ini
file, then you would be given the whole line.
> Solved it!!! I had to put the directory, where mysqldump command is, in
> string that was executed:
>
> $backup = "c:\wamp\mysql\bin\mysqldump -hlocalhost -u$duser -p$dpass
> $dbase table_name > backup/table_name.sql";
> shell_exec($backup);
>
> In windows shell, command has to be driven from the directory where it
> is, of course, so simple. But how can I make it work on Unix server....?
On a unix like system you usually have the $PATH variable in the shell that
gives you which directories it will look into to find the command, of course
the $PATH can be different depending which user you are, you may assume that
the "webserver user" has a normal $PATH and then you don't give a path, but if
you want to be sure, you should give the path, the file in question is usually
in /usr/bin/mysqldump or in /usr/local/bin/mysqldump, depending a little bit
on the os/distro and if the admin has compiled it themselves, using the binary
from mysql.com or uses the one thats shipped with the OS.
You can make the path detection a bit automatic and use is_file, if you don't
want to hardcode the path.
//Aho
[Back to original message]
|