Re: [PHP] Can not read write file from Desktop

2009-05-12 Thread Thodoris



Thodoris wrote:
  

hi
I was trying to read a file from Desktop (Centos),

Simply saying (php code file is in /var/www/html/ )

if (file_exists("/root/Desktop/conf_files_linux"))
echo "yes file is there";
else
echo "no none";

It gives me none.
If i place conf_files_linux file in /var/www/html. i get yes...


After checking log file i got

[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

What  i need to do, so tht i can access files from outside?
help pls

thanx
  
  

I assume that this running by the web server (/var/www/html) so a wild
guess is that the user that your web server uses to run (usually apache
or www) cannot access the Desktop directory. In order to use the suexec
feature you need to configure it or else the web server user needs to
have read/write rights to the directory you need to access like the
Desktop.

Though this not recommended. You could always run this script from
command line being root or whatever user is the owner of the Desktop
directory.  Read this if you are not aware of how this can be done:

http://www.php.net/features.commandline




If the OP's system is set up properly, then nobody but root should be able to
read ANY of root's home directory, so the files will not be found.
For a start, one doesn't want config files in anyone's home directory if they
are for a system-wide server.
  


There is always suexec so this is partly true.


And one doesn't EVER want to have anything in /root that anyone but root needs
to access.
  


Couldn't agree more.


And one shouldn't be logged in as root unless one is doing a short-lived system
maintenance task: certainly one should not doing development work there...
  


This is the principle but handling files at root directory might be a 
maintenance task and since PHP is a scripting language it can be used 
for this kind of tasks mainly running from command line.



I know it sounds dictatorial, but it's (part-way to) best practice...

Those config files should be in something like /etc/apache/extra, perhaps, if
they are not safe in the web root (which they probably are not, unless the web
server is configured to keep them safe)

  


The OP could always use one of the already developed file browsers in 
PHP. Never tried one besides webmin but a little googling could end up 
very resourceful.


--
Thodoris



Re: [PHP] Can not read write file from Desktop

2009-05-12 Thread Peter Ford
Thodoris wrote:
> 
>> hi
>> I was trying to read a file from Desktop (Centos),
>>
>> Simply saying (php code file is in /var/www/html/ )
>>
>> if (file_exists("/root/Desktop/conf_files_linux"))
>> echo "yes file is there";
>> else
>> echo "no none";
>>
>> It gives me none.
>> If i place conf_files_linux file in /var/www/html. i get yes...
>>
>>
>> After checking log file i got
>>
>> [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
>>
>> What  i need to do, so tht i can access files from outside?
>> help pls
>>
>> thanx
>>   
> 
> I assume that this running by the web server (/var/www/html) so a wild
> guess is that the user that your web server uses to run (usually apache
> or www) cannot access the Desktop directory. In order to use the suexec
> feature you need to configure it or else the web server user needs to
> have read/write rights to the directory you need to access like the
> Desktop.
> 
> Though this not recommended. You could always run this script from
> command line being root or whatever user is the owner of the Desktop
> directory.  Read this if you are not aware of how this can be done:
> 
> http://www.php.net/features.commandline
> 

If the OP's system is set up properly, then nobody but root should be able to
read ANY of root's home directory, so the files will not be found.
For a start, one doesn't want config files in anyone's home directory if they
are for a system-wide server.
And one doesn't EVER want to have anything in /root that anyone but root needs
to access.
And one shouldn't be logged in as root unless one is doing a short-lived system
maintenance task: certainly one should not doing development work there...

I know it sounds dictatorial, but it's (part-way to) best practice...

Those config files should be in something like /etc/apache/extra, perhaps, if
they are not safe in the web root (which they probably are not, unless the web
server is configured to keep them safe)

-- 
Peter Ford  phone: 01580 89
Developer   fax:   01580 893399
Justcroft International Ltd., Staplehurst, Kent

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Can not read write file from Desktop

2009-05-12 Thread Vikas Sharma
thanks for replying


>From command line can access that file.

But i need some interface, through  that i want to change some files.
I am using apache (httpd) server.
Now i need to give access to apache user of those folders, which is not
recommended as per you.
or in order to use the suexec feature you need to configure

How can configure tht?



On Tue, May 12, 2009 at 6:39 PM, Thodoris  wrote:

>
>  hi
>> I was trying to read a file from Desktop (Centos),
>>
>> Simply saying (php code file is in /var/www/html/ )
>>
>> if (file_exists("/root/Desktop/conf_files_linux"))
>> echo "yes file is there";
>> else
>> echo "no none";
>>
>> It gives me none.
>> If i place conf_files_linux file in /var/www/html. i get yes...
>>
>>
>> After checking log file i got
>>
>> [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
>>
>> What  i need to do, so tht i can access files from outside?
>> help pls
>>
>> thanx
>>
>>
>
> I assume that this running by the web server (/var/www/html) so a wild
> guess is that the user that your web server uses to run (usually apache or
> www) cannot access the Desktop directory. In order to use the suexec feature
> you need to configure it or else the web server user needs to have
> read/write rights to the directory you need to access like the Desktop.
>
> Though this not recommended. You could always run this script from command
> line being root or whatever user is the owner of the Desktop directory.
>  Read this if you are not aware of how this can be done:
>
> http://www.php.net/features.commandline
>
> --
> Thodoris
>
>


-- 
vikas sharma


Re: [PHP] Can not read write file from Desktop

2009-05-12 Thread Thodoris



hi
I was trying to read a file from Desktop (Centos),

Simply saying (php code file is in /var/www/html/ )

if (file_exists("/root/Desktop/conf_files_linux"))
echo "yes file is there";
else
echo "no none";

It gives me none.
If i place conf_files_linux file in /var/www/html. i get yes...


After checking log file i got

[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

What  i need to do, so tht i can access files from outside?
help pls

thanx
  


I assume that this running by the web server (/var/www/html) so a wild 
guess is that the user that your web server uses to run (usually apache 
or www) cannot access the Desktop directory. In order to use the suexec 
feature you need to configure it or else the web server user needs to 
have read/write rights to the directory you need to access like the 
Desktop.


Though this not recommended. You could always run this script from 
command line being root or whatever user is the owner of the Desktop 
directory.  Read this if you are not aware of how this can be done:


http://www.php.net/features.commandline

--
Thodoris


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Can not read write file from Desktop

2009-05-12 Thread Vikas Sharma
hi
I was trying to read a file from Desktop (Centos),

Simply saying (php code file is in /var/www/html/ )

if (file_exists("/root/Desktop/conf_files_linux"))
echo "yes file is there";
else
echo "no none";

It gives me none.
If i place conf_files_linux file in /var/www/html. i get yes...


After checking log file i got

[notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)

What  i need to do, so tht i can access files from outside?
help pls

thanx
-- 
vikas sharma