I put permission 777 on the other server I can send the file, but when access the file shows internal server error 500
This is related to the permission of owner I think, someone knows how I can solve? Obs: I already tended all types of file permissions and all that let me send the file shows the error 500
$dir_https_braip = "/home/braip/public_html/https/";enter code here
$dir_https_way = "/home/waycash/public_html/dir/https/";
$dir_https_pega = "/home/pegatudo/public_html/dir/https/";
if(!copy($_FILES['file_upload']['tmp_name'], $dir_https_braip . $nome)){
die('erro');
}
Related
I'm facing an issue in PHP where I can't open a file located on a network drive for reading
I have tried a lot of different path name
$file = fopen('G:/Folder/vak.xlsx', 'r');
$file = fopen('//10.X.X.X/Folder/vak.xlsx', 'r');
$file = fopen('\\\\10.X.X.X\\Folder\\vak.xlsx', 'r');
But I always get the same error
Could not open "G:/Folder/vak.xlsx" for reading! File does not exist.
I have read a lot of post related to this issue and try all the solutions that i've found, but nothing works.
The network drive is mapped on the server under G: and the apache service is launched with a domain user account who's allowed to access to the network drive.
The server is running WAMP (Apache + Mysql + PHP 5.6)
I don't know why it's not working. Maybe someone has already solved this issue.
EDIT :
I have also try to use scandir() like this :
$files = scandir('\\\\10.X.X.X\\');
var_dump($files);
And I get
The network name cannot be found. (code: 67)
I´ve written a tool using PHPseclibs SFTP solution to uplaod various files to different target server. All targetserver are using wingFTP.
Under some conditions the upload fails without giving any debug message or error code.
I could figure out that the error (if it occures) allways occures in the following line of my code:
[...]
if(!$sftp->put($aResult[0]["targetpath"] . $sFilename, EXPORTFOLDER . "/" . $sFilename, NET_SFTP_LOCAL_FILE)){
[...]
Is there any way to see what is happening? There are no error messages or something... can I configure debug/error messages while using PHPseclib somewhere?
In about 95% of all cases the Upload is successfull and it does not only appear on one target server or for one file. Does someone have an idea where the problem could be located?
When I try to use ftp_delete() I get the error: Warning: ftp_delete(): File not found. My ftp server should be working fine, I can upload files fine to the same directory without a problem. Here is the PHP:
$fileSource = 'http://localhost/user/images/dfdf.png';
$ftpCon = ftp_connect('localhost');
ftp_login($ftpCon,'---','---');
ftp_delete($ftpCon,$fileSource);
Also when I look at the server logs I can see I get the message: 550 File not found
The url for $fileSource is the file's exact path, I went into localhost and copy/pasted it into the code, still for some reason it can't be found.
The ftp_delete function acccepts a path to the file. You are providing http://localhost/user/images/dfdf.png which contains the host (http://localhost/). I think you mean to provide /user/images/dfdf.png, which is just the path.
Example:
ftp_delete($ftpCon, '/user/images/dfdf.png');
When, for example, your FTP root is /user/, it will mean you need to provide ftp_delete with /images/dfdf.png. Thanks to #maremp.
I am working on a leaflet map site with access to real time weather data. To avoid having to use SUID, because of it's security problems, I am using symbolic links from /var/www to my imagery data. These are simple png files, and this is working.
I then wanted to have real time data based on mouse position hovering over the image data. For this, I created an SQLite3 database with the actual values. At first, as a test, I manually put this database in the site root, and everything worked out perfectly. Unfortunately I cannot have that database in that location. I then did the exact same procedure used for my imagery data (which worked) with this database.
The process was:
In my site root:
ln -sf /path/to/db/ db
chmod 777 /path/to/db/data.db
The file is then read by a simple PHP program for querying:
<?php
$lat = floatval($_GET['lat']);
$lon = floatval($_GET['lon']);
$db = new SQLite3('db/sst.db'); # line 6
$results = $db->query("SELECT sst FROM current ORDER BY (($lat-lat)*($lat-lat) + ($lon-lon)*($lon-lon)) ASC LIMIT 1");
while ($row = $results->fetchArray()) {
echo $row['sst'];
}
?>
Unfortunately, now I am getting this error in the browser console:
Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Inspecting /var/log/apache2/error.log file I get the following error:
PHP Fatal error: Uncaught exception 'Exception' with message 'Unable to open database:
unable to open database file' in /var/www/Mapea/sst.php:6\nStack trace:\n#0
/var/www/Mapea/sst.php(6): SQLite3->__construct('db/sst.db')\n#1 {main}\n thrown in
/var/www/Mapea/sst.php on line 6
Following CL's query on what permissions I had on /path, /path/to, and /path/to/db, I discovered that /path permissions were not correct.
After using the following command:
chmod 755 /path
My application is now working 100%.
In addition to the obvious rights on the full path to the file, one additional thing that may be an issue is SELinux.
If you still have permissions issues after double checking the file rights, this is the most likely culprit.
For example, on RHEL 8, the default security policy doesn't let Apache accessing a file on an NFS volume, and you'll need to pass the command
setsebool -P httpd_use_nfs 1
to (permanently with -P) authorize it.
I cant able to login after moving files icehrm from local to server.
Below is the only config file i changed in server,
define('CLIENT_NAME', 'app');
define('APP_BASE_PATH', '/home/xxx/public_html/example/');
define('CLIENT_BASE_PATH', '/home/xxx/public_html/rmsintranet/app/');
define('BASE_URL','http://example.com/icehrm/');
define('CLIENT_BASE_URL','http://example.com/icehrm/app/');
define('APP_DB', 'bd_name');
define('APP_USERNAME', 'bd_user');
define('APP_PASSWORD', 'db123');
define('APP_HOST', 'localhost');
define('APP_CON_STR', 'mysql://'.APP_USERNAME.':'.APP_PASSWORD.'#'.APP_HOST.'/'.APP_DB);
//file upload
define('FILE_TYPES', 'jpg,png,jpeg');
define('MAX_FILE_SIZE_KB', 10 * 1024);
Whenever i tried to login i'm getting login failed message
How to solve this? Is there any other config file need to update ?
Finally got my answer now able to run on server to icehrm
simply open server.includes.inc.php and comment line no :4:
include(APP_BASE_PATH.'lib/aws.phar');
Now your code will run smoothly