MPDF dejavuserifcondensed.mtx.php No such file or directory - php

Can someone help me with this I am getting the following message when trying to use MPDF
include(/var/www/svn_data/skeletonapp/mpdf/ttfontdata/dejavuserifcondensed.mtx.php): failed to open stream: No such file or directory
I have chmod'ed the correct files ttfontdata, tmp and graph_cache
It seems like the system has to generate the files but its not.
Thanks,
Ross.

The problem is that directory ttfontdata/ is not writable for the process under which the PHP code is running. MPDF needs to generate and write some files there.
Simplest solution is:
chmod 777 ttfontdata

Related

Permission error when attempting to "write" pdf file (PDFLIB)?

I am working with PDFlib's php code in an aws server and I keep getting he following error message
Couldn't open PDF file 'file.pdf' for writing (permission denied)
I considered editing the permissions of this particular directory but the permissions are
drwxrwxrwx+
Which seem to be appropriate for this script to function. Anyone has any idea why I am getting this permissions error?
Thank you for the input I have discovered the error.
My issue was that I was not specifying the path to my output document and temp directory.
I was declaring my output document as :
$output_document = "file.pdf"
instead of
$output_document = "/path/to/output/file.pdf"

Why is my PHP copy() function creating a blank file?

I have a copy function per say:
<?php
copy ( "$source" , "$destination" );
?>
The code does create a copy succssfully however the $destination (or copied file) is left blank. if i open it it is empty unlike the $source file.
The file size is 0b.
My situation:
nginx/1.10.0 (Ubuntu)
PHP 7.0.13-0
ubuntu0.16.04.1
The file permissions for the code processing file is 0777
The permission for the source file is 0777
The file permission for the destination file after being copyed (the blank one ) : 0644.
Obviously no control over the permission before copying.
Anyone know the reason for this and how to make the php copy() function copy the file with the original file contents?
Best regards,
AT
Ok so i seemed to solve this apparently my server ran out of disk space.
Makes sense. should have known.

PhP download to root folder

If I have a php file on my root folder on my website, is there a way to go to a download line with that file and download the file to the directory where the php is rather than to the computer>
As #Cale_b said, no, not without FTP. The PHP file will execute if you try and get it through the browser. Why do you want to do that anyway?

give file permission to file on upload time

Hello everyone i have a question with upload a file with php ocde.
please tell me with php code how can i give file permission(777) at the time of uploading .
Thanx in advance
You should follow the best practices on the PHP website for handling file uploads and once you move the uploaded file to the location you want it, you can do a chmod on the file to whatever permissions you want.
I would be careful using 777 permissions on any file, it can be dangerous, especially if you are running your code on a shared server. 755 is a much safer alternative for file permissions and is generally recommended.

file uploaded via php: no such file or directory

i'm working on a website wherein the users can upload images (uses php 4.3.11). the files are uploaded with no problem as i can see them in the upload directory and i don't get any error message, but when i try to access the uploaded files via ftp, i get an error: no such file or directory. sometimes, i am able to access the file sometimes i get this error. what could be the problem here?
[update]
thanks for the help guys. i'm not familiar with the ftp daemon stuff. but i do access my files via ftp using FireFTP. the files are there but when try to download them or change the file properties, i get the said error. i also tried uploading a file in the folder through ftp and i was able to download it with no problem.
here is some of the code i'm working on, its kind of roundabout but i'll see on how to improve it.
my working directory is something like this www.domain.com/register/
and the upload directory is here www.domain.com/register/uploads/
users are required to register and upon sign-up, a folder is created for them in the uploads directory. i couldn't find a way to create a folder without having to be in the uploads folder itself so i redirect to a create-user-folder.php file in the uploads dir.
the file just contained this code:
$user_foldername = rawurldecode($_GET['name']);
mkdir($user_foldername);
header("Location: ../form.php"); // redirect back to the page
i checked and the created folder's permission is set to 775.
and here's part of the code i use in uploading ( /register/function/function.php ):
$path = "../uploads/$user_foldername/";
for($j = 0; $j < $num_of_uploads; $j++){
if(is_uploaded_file($_FILES[$file]['tmp_name'][$j])){
$filename = $_FILES[$file]['name'][$j];
copy($_FILES[$file]['tmp_name'][$j],$path.$filename);
}
}
i checked using FireFTP and the files are in the /uploads/user_foldername/ directory and its permission is set to 664. the strange thing is that when i try to download the files, at times there would be no problem at all but there are times when the error will appear.
[another update]
i added chmod() after the copy() function,
$filename = $_FILES[$file]['name'][$j];
copy($_FILES[$file]['tmp_name'][$j],$path.$filename);
chmod($path.$filename, 0755);
but i still get the error.
another thing is that when i access /register/uploads/user_foldername/ through the url, i can see all of the uploaded files and view them, but how is it that i can't access them via ftp?
thanks again!
This is either a permission issue, or a configuration error. Here are things you should try:
What are the permission of the uploaded files? Does the FTP user has access to these files? Have you tried logging in as the user the FTP daemon would use and see if you could read the file that way?
Do you really see the correct directory? Have you verified by putting a file in that directory yourself and downloading it? Have you used the ftp command ls to verify the presence of the folder/folders/files?
You might need to chmod the folder the files are in, or in some cases the files themselves.
try chmoding them to 775
You can chmod files and folders through PHP it's self, with the chmod function. Or, you could use a FTP program such as filezilla.
Also check to make sure the intermediate directories are also permissioned as 755, as all the directories in the path need to be executable to be traversed.
i just figured out the problem. it was all because of the file name having accented characters in it, which explains why i do not always get the error message :|
<sigh> i should have seen this earlier, but anyway i hope this helps in case someone ran into the same problem.
thanks again! i really appreciate it :)

Categories