Copy() not working

software development



I am trying to run the copy() command in PHP to transfer files from one server to another

Warning: copy() [function.copy]: URL file-access is disabled in the server configuration in /home/.godwin/amckern/ on line 16

Is this another case of ‘compile your own PHP’?

If so, i try and use the ssh/putty tools to build the install script, and end up with errors, and strange ascii/numbers…

Any help?




Possibly, but there may be an easier alternative :slight_smile:

Probably the simplest option is to replace the copy() in your script with equivalent CURL commands;

Another possible option is to copy the existing DreamHost PHP install to your domain directory and tell Apache to use this PHP install for your domain (via .htaccess). There is a wiki article detailing this and it has been covered in a few forum threads, including this (very) recent one :slight_smile:


Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )



I am however getting a very garbled text editor when i run plink, example code bellow - i dont know what keys to press to save etc.

[starburst]$ crontab -e
no crontab for amckern - using an empty one
☼^G←[m☼ Get Help ←[0;7m☼^O←[m☼ WriteOut ←[0;7m☼^R←[m☼ Read File ←[0;7m☼^Y←[m☼
←[24d←[0;7m☼^X←[m☼ Exit←[14G←[0;7m☼^J←[m☼ Justify ←[0;7m☼^W←[m☼ Where Is ←[0;
7m☼^V←[m☼ Next Page ←[0;7m☼^U←[m☼ UnCut Txt ←[0;7m☼^T←[m☼ To Spell ←[22;33H←[0;
7m☼[ Reading File ]←[m☼←[39;49m←[H←[39;49m←[m☼←[K←[2d←[K←[3d←[K←[4d←[K←[5d←[K←[6
K←[17d←[K←[18d←[K←[19d←[K←[20d←[K←[21d←[K←[22;32H←[1K ←[0;7m☼[ Reading File ]←[m
←[23d←[0;7m☼^G←[m☼ Get Help ←[0;7m☼^O←[m☼ WriteOut ←[0;7m☼^R←[m☼ Read File ←[0
←[24d←[0;7m☼^X←[m☼ Exit ←[0;7m☼^J←[m☼ Justify ←[0;7m☼^W←[m☼ Where Is ←[0
;7m☼^V←[m☼ Next Page ←[0;7m☼^U←[m☼ UnCut Txt ←[0;7m☼^T←[m☼ To Spell←[K←[22;39H←[
0;7m☼ 0 lines ]←[m☼←[H←[0;7m☼ GNU nano 1.2.4 File: /tmp/crontab.mHJO4Z
←[4d←[22;25H←[0;7m☼[ XOFF ignored, mumble mumble. ]←[m☼


Yeah, plink is not a good tool for this. From the PuTTY docs:

[quote]Plink (PuTTY Link) is a command-line connection tool similar to UNIX ssh. It is mostly used for automated operations, such as making CVS access a repository on a remote server.

Plink is probably not what you want if you want to run an interactive session in a console window.


The output sent by the server will be written straight to your command prompt window, which will most likely not interpret terminal control codes in the way the server expects it to. So if you run any full-screen applications, for example, you can expect to see strange characters appearing in your window. Interactive connections like this are not the main point of Plink.[/quote]
Just use PuTTY proper (see the Dreamhost Wiki Guide to using PuTTY) , and you will be fine! :wink:



I am not that familiar with Plink, but I believe it was not intended for interactive use and therefore doesn’t handle the full set of terminal escape codes, which is probably why you are seeing the garbled output.

Try using PuTTY or similar instead.


Save [color=#CC0000]$50[/color] on DreamHost hosting using promo code [color=#CC0000]SAVEMONEY[/color] ( Click for promo code details )



I’m using putty now and i can see the text editor, i might now do a custom build of PHP5 so i can get the copy() command to work :slight_smile:


copy($file, $newfile) will still work. It is only things like copy($url, $newurl) that will not (and a good thing too). Use cURL if you want to access a remote resource.

Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]