I am trying to copy file from my local machine to Windows server.
$local_dir = 'C:\Users\host\Pictures\Camera Roll'; //source url
$local_server_dir = '\\10.1.0.1\new'; //destination url the ip is
The segment that I use to copy the image is
copy("$local_dir/$files[$i]","$local_server_dir/$name")
recursively using for loop, but the system throw a warning as mention below.
Warning: copy(\10.1.0.1\new/IMG_1844.JPG): failed to open stream: No such file or directory in C:\wamp64\www\image\index.php on line 22
What can I try to investigate the cause of this?
Related
I just changed hosting companies and I have created a new WP install and we created a new website (We did not move over the old site). I just realized there was a second WP install on the old hosting account for a scholarship contest and I need to move that over to the new hosting company. I moved over the database and all of the files. I also updated the wp-config file with the database and username/password. But when I try to verify the site here aflbs.org/scholarshipcontest I am getting the below errors. Am I missing a step somewhere?
Warning:
require(/home/aflbs/www/www/scholarshipcontest/wp-includes/load.php):
failed to open stream: No such file or directory in
/home/aflbs/www/www/scholarshipcontest/wp-settings.php on line 19
Warning:
require(/home/aflbs/www/www/scholarshipcontest/wp-includes/load.php):
failed to open stream: No such file or directory in
/home/aflbs/www/www/scholarshipcontest/wp-settings.php on line 19
Fatal error: require(): Failed opening required
'/home/aflbs/www/www/scholarshipcontest/wp-includes/load.php'
(include_path='.:/usr/local/php56/lib/php') in
/home/aflbs/www/www/scholarshipcontest/wp-settings.php on line 19
Please check whether web server have appropriate permission to access files or not. This usually happens due to permission or ownership.
Try changing permissions and see if it works.
Within my script I need to connect to ftp and download few zips files and then extract them in a directory. I have already got this implemented and it works as expected when I run the script through browser but when the crontab run this script it throws me error that it failed to extract file. I tried to research but I had no luck I don't understand the reason for this.
Below is the error that I am getting:
A PHP Error was encountered
Severity: Warning
Message ZipArchive::extractTo(/home/name/files/complete//filename.txt): failed to open stream: Permission denied
Filename: controllers/import.php
Line Number: 66
Script:
$txt_file: "/home/name/files/complete/Data.zip";
$server_txt_file = "/TXT/Data.zip";
if (ftp_get($ftp_conn, $txt_file, $server_txt_file, FTP_BINARY))
{
$zip = new ZipArchive;
if ($zip->open($txt_file) === TRUE)
{
$zip->extractTo('/home/name/files/complete/');
$zip->close();
unlink($txt_file);
}
}
I am trying to fix this for days now but I can not figure out what the issue is.
The error is telling you everything you need to know:
failed to open stream: Permission denied.
So your php process has no permission to write to the specified folder. So you should change the permissions of specified folder.
I am using scandir() function to scan the directory from the cloud. This function working in the local system but not worked in the sever. I have run this function using php code in the server i het the following error
Warning: scandir(https:// xxxx/yyyy/folder/): failed to open dir: No such file or directory
Warning: scandir(): (errno 2): No such file or directory
Warning: Invalid argument supplied for foreach()
How to solve this error..
You have to access the S3 Bucket for getting files from cloud server..
Refer this
I have following code:
$fh=fopen($api,"r");
$theData = fgets($fh);
echo $theData;
This throws the error as :
Warning: fopen(http://xxxxxx.xxxxxxxx.com:8080) [function.fopen]: failed to open stream: Connection refused in /home/xxxx/public_html/xxxx/index.php on line 18
Warning: fgets(): supplied argument is not a valid stream resource in /home/xxxx/public_html/xxxx/index.php on line 19
What is the solution for this?
Your file did not open as you intended. Check the value of $api and be sure the file name is in the current working directory, or the entire path to the file.
Since it is a remote system on :8080, be sure the port is open to the public. This is typically a value reserved for localhost (ie: the webserver is only a webserver to that computer, no one else's) and wouldn't be accessible to you. If the url you are opening is the same computer you are using, navigate to the file using local folders instead.
I wrote a PHP Application (that works) and I have moved it to a different directory. As a result it needs to get a file from a directory above it, but the file must remain hidden, ie:
Root
--config
---users.xml (Permissions 600)
--lib
----loginUtil.php
I have tried two different methods of getting the file:
$xml = file_get_contents("../config/users.xml");
Which returns the following Error:
[13-Jun-2012 08:54:04] PHP Warning: file_get_contents(../config/users.xml) [<a href='function.file-get-contents'>function.file-get-contents</a>]: failed to open stream: No such file or directory in public_html/test/lib/loginUtil.php on line 18
and
$xml = simplexml_load_file("../config/users.xml");
which returns
[13-Jun-2012 08:56:17] PHP Warning: simplexml_load_file() [<a href='function.simplexml-load-file'>function.simplexml-load-file</a>]: I/O warning : failed to load external entity
I have tried using the full URL, and that works, but I must then make the users.xml file public (as PHP is doing a URL Request).
What can I do to resolve this issue? (Thanks for your help)
try setting the full path and not the relative
$path = '/var/full/path_dir/file.xml';
if(!is_file($path)){
// if this is the is output then you need to check permissions
// double check the file exists also.
// check the web service can read the file
echo "FILE NOT FOUND FOR $path";
}
else{
$xml = file_get_contents($path);
echo $xml;
}