Forum Moderators: coopster

Message Too Old, No Replies

Strange copy file problem

Proven script does not work on new site

         

henry0

10:12 pm on Jan 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is strange
I have no MySQL problem (write and read DB fine)
no PHP flag error

script works on other sites
the sample does a simple file copy but results in my echo error message "failed to open..."

I do not manage that server although my address source and destiantion has been verified and is fine

so the question is where should I look, what can go wrong?
thanks
<<<
$source="/pub/comwww/site_name/main/biz_templates/any_name_tpl.php";
$dest="/pub/comwww/site_name/main/biz_members/any_name_tpl.php";
if (!copy($source, $dest)) {
print ("failed to copy $dest...\n");
}
>>>>

mykel79

10:39 pm on Jan 29, 2004 (gmt 0)

10+ Year Member



Maybe when the script runs it doesn't have the correct permissions to open the file?
Try setting the permissions of the file it can't open to
a+r

henry0

10:44 pm on Jan 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome on WebmasterWorld
out of experimenting all files and folders are shmod to the max

coopster

10:46 pm on Jan 29, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Are you sure error_reporting is on so you can see PHP messages?

henry0

11:06 pm on Jan 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



well I cannot access to php ini

but asides the path it should be no error
it works fine on my RH test server
that script is a part of my templating system that has been working on other sites

is there a chance to use a http path instead of a unix path?

coopster

1:00 pm on Jan 30, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



You don't need access to the
php.ini
to turn on
error_reporting
. See PHP Troubleshooting [webmasterworld.com] in the PHP Forum Library [webmasterworld.com] for examples. Hopefully, with
ALL error-reporting ON
, including
NOTICES
you will get a message from PHP describing the issue it is having.

Yes, you can use a URL rather than a path/file. However, review the notes in the manual, particularly:

Note: As of PHP 4.3.0, both source and dest may be URLs if the "fopen wrappers" have been enabled. See fopen() [php.net] for more details. If dest is an URL, the copy operation may fail if the wrapper does not support overwriting of existing files.

henry0

1:43 pm on Jan 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Coopster thanks great thread on error reporting

I got
unable to create ........ not a directory in etc...

which does not mean much for the path is still correct
and all named ffilesand directory in the warning are there without typos or path error

I will try with a full url, I should not have a wrapper problem

regards

Henry

coopster

2:02 pm on Jan 30, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Two things I would check:
  1. If you can get command line access to the server, navigate to the directory where your templates are stored. Execute the
    pwd
    command and have a look at the filepath of the working directory. It should match your variable. (Some FTP clients also have the ability to display the working directory if you cannot get command line access).
  2. Double check the
    biz_templates
    as well as the
    biz_members
    directory permission settings.

henry0

2:49 pm on Jan 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



File path checked: OK plus my FTP same path:OK

I am shmod to the roof!

I even for test purpose deleted a few hundred lines out of the scrit in order to retain only the 2: source and dest lines

It is pointing (what else left?) to a server setting that ought to be the problem source

I will within minutes speak with them (ISP)
definitely need to know what's happening

If I had a good server security knowledge
I would transfer some of the sites I manage
on my own server but not there yet..
thanks

henry0

4:34 pm on Jan 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Last news..

Files reloaded and permissions reset

and it works

Coopster, thank you very much, quite often you helped me

I learned and learn a great deal from you

best regards

Henry

coopster

4:46 pm on Jan 30, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Awesome! Good work. And thank you for the kind words.