I've looked at multiple tutorials on the matter and apparently MPDF is a simple as can be.
<?php
require_once('tools/mpdf.php');
$mpdf = new mPDF();
$mpdf->WriteHTML('<p>Your first taste of creating PDF from HTML</p>');
$mpdf->Output();
exit;
?>
Obviously I'm going to build on top of this but I can't even get the basics working for some reason. All I get is a "500 Internal Server Error". I've stripped the file down to just
<?php
require_once('tools/mpdf.php');
?>
And I get that error. I've ensured that the mpdf.php file is in the tools directory and properly loaded onto my server, so there's no issue there..
Any ideas?
I was having this issue and found a simple solution. Mpdf worked well on my local machine but I had the trouble when using it on a remote server.
If anyone else is having the same issue when deploying your app on a remote server.
Check your server error log
If you see an error like this "Exceptioncaught Mpdf\\MpdfException: Temporary files directory.... is not writeable"
You may try to change the permission of the mpdf/tmp folder example: chmod 777 /vendor/mpdf/mpdf/tmp, which I do not recommend because it would give read, write and execute permission to the owner, group and public
The best approach is to check the owner of the directory and assign it to your web server if you are using apache, example: chown www:www /vendor/mpdf/mpdf/tmp
It worked for me, I hope it can help others.
I had the same problem, I was desperate in the end but I deleted tmp sub-folder from mpdf folder and it started working.
Related
Tried everything..
Permissions, error logs, re-cloning, etc.
Works fine on another workstation so can't be the application code.
Any ideas?
Upload some small script containing only phpinfo(); call, find out what php.ini file is used and edit it. Turn on error display. If web server is working it can't return empty screen - there must by some error message if errors are enabled.
Just to further expand on this.
Local setup of Drupal
All the front-end pages work
Can login as a user or admin successfully at the URL '/user'
Colleague has followed the exact same process and works fine for him
Cannot access any page that has URL '/admin/...'
Tried everything...
.htaccess file from fresh Drupal install
.htaccess file from working local copy on colleagues machine
.htaccess file from working other local Drupal build that works
Increased php.ini memory limit to 256m
WAMP server apache rewrite_module is turned on
etc...
Whats really strange is that I have other Drupal builds locally that work fine.
After doing some research, I still cannot understand why my assets in the bundles folder return 404 errors when I try to reach them.
I can see the files on the server, but when I try to reach them, symfony returns a 404 error.
For example, I have this file on the server : web/bundles/aluser/images/li-plus.png, but trying to access it with https://my-site.com/bundles/aluser/images/li-plus.png returns a 404 error. But on the other hand I can access files in https://my-site.com/images/li-plus.png for example.
I did the assets install and dump commands, cleared the cache but no results.
Thank you.
Unless you are on a local install it probably has to do with your server not pointing to the web folder. I had that problem on a shared hosting what i did was to make a symlink from server home (www, public_html or whatever) to web and it worked like a charm.
Thank you all for your answers,
they pointed me in the right direction (a problem with the server) :
I did a asset install and dump commands with the root user of the server, all files created were then associated to this root user, and apache wouldn't serve them anymore.
After a chown, everything was working again.
Thanks again :)
In Openshift I have 1 application. I copied it to my localhost running wordpress website. I overwritten my localhost files. I copied all the files from data directory and as well as I copy mysql to overwrite my localhost mysql. Now I try to run the website. It gave me the following error message.
Warning: require_once(.openshift/openshift.inc): failed to open stream: No such file or directory in C:\wamp64\www\my-site\data\current\wp-config.php on line 114
any idea what I can do to fix this problem. What are the things I miss setup?
Thank You
If you run your wordpress site on localhost you don't need the openshift references. So comment out wp-config.php line 114 (because it requires the .openshift directory). Run it again and you will probably get some more errors (you don't need openshift hooks etc). Furthermore, it seems you didn't do the mysql part right. You should create a database (you dont have to overwrite one) and set the database credentials in your wp-config: https://codex.wordpress.org/Editing_wp-config.php#Set_Database_Name
Hope this helps
I've just migrated a client site to her production server using the latest version of BackupBuddy v3.0.40, and at first glance everything looks dandy, but on closer inspection, most WP file functions are borked: update wp, upload images, upload plugin.
I've done this a ton of times (several times on this host), and don't know why its not working here
I suspect it has to do with the tmp directory, but i can't see a problem..
another possibility is that a script (installatron via cpanel maybe interfering.. i notice that there are upload folders created for all months up to 2016! i read about this being a solution to permissions issues in WP's past)
This is what I've tried:
changing the wp-media upload location to the default, changing the 'store in year/month' setting and general wiggling. this was imported as '/home/###/public_html/wp-content/uploads' which looks correct, but unnecessary, the default is wp-content/uploads. neither work.
changing the permissions on wp-content and uploads dir to 777 (not all contents)
adding a line to wp-config.php:
define('WP_TEMP_DIR', ABSPATH . 'wp-content/'); no dice
uninstalled all traces of the installatron scripted wp installation (no files or db remain)
repeating the migration (same backup file, identical results)
confirming that:
i can create new posts, just not upload media
it works on the staging server (same host)
safe mode is off
apache is running as user, tx suPHP
the files were extracted by php via the browser
i've compared phpinfo to other working sites and dont notice anything out of the ordinary
hope you can shed some light!
thanks, Tim
image upload error:
“envelope-9887.jpg” has failed to upload due to an error
The uploaded file could not be moved to /home/###/public_html/wp-content/uploads/2012/07.
wordpress update error:
Download failed.: Destination directory for file streaming does not exist or is not writable.
plugin install error:
Download failed. Destination directory for file streaming does not exist or is not writable
sometimes when migrating you may have to look through the database options table and change a few entires, ie:
from the old site structure it could be: /home/yoursiteid/public_html/wp-content/ etc..
but on the new server the structure could have changed?
ie: /home/differentuserid/wwwroot/wp-content/
edit a file on the server to include :
echo getcwd() . "\n";
just to see if the home directory is the same as your current server or if its changed from your old sevrer, have a check in your database options table and update the entires which ref the old dir structure..
I found, eventually, that I'd overlook the line
define('WP_TEMP_DIR', 'old-hard-link-here');
which I believe was nestled directly under the wp salts, camoflaged to the tired eye! Simply removing that line and setting the media path to the default fixed the issue.
I believe that that line was installed by the cPanel script 'Installatron'.
Case closed
I have a problem when trying to manually upload a new plugin in wordpress.
Uploading media is working perfectly, and also automatically install plugins work as it should, but manually uploading plugins generate an error message:
The uploaded file could not be moved to C:\inetpub\wwwroot\Wordpress/wp-content/uploads/2010/11.
I have checked permissions on wp-content and uploads and it is set to Everyone. I do not think there is anything wrong with permissions since I can upload images, and I see them inside my uploads folder.
I think there might be a problem with the slashes beeing incorrect, does anyone else have this problem?
I'm using IIS7, Windows Server 2008 and Wordpress 3.0.1. Everything is installed with Microsoft Web Platform Installer.
I know this is way late in answering, but I hope someone may find it useful.
This is most likely a problem with the settings involving the temporary upload location.
Here is what I did to solve a similar problem:
Ensure that you are editing the correct initialization file. Putting:
in a test.php file and executing it from your web browser will get you the setting.
Look for the setting for "Loaded Configuration File"
In that configuration file search for (or add if missing) the following setting:
upload_tmp_dir = "c:\inetpub\temp\uploads"
Ensure that c:\inetpub\temp\uploads exists and is writeable by everyone. You can tighten this up with specifying the IUSR account if you wish.
Recycle/Restart the IIS worker process. Your choice here as there are a number of ways to accomplish this.
I found a good bit of this info by referring to c:\tmp\php_errors.txt. The fastcgi.logging should be enabled by default on windows installations.
Just wanna add a solution to the good Harold's answer for PHP.
Despite changing the setting "upload_tmp_dir", I was still getting the same error message The uploaded file could not be moved to C:\inetpub\wwwroot\Wordpress/wp-content/uploads.
So i have changed also the setting "upload_max_filesize"
upload_max_filesize=16M
(16M or greater depending on the wordpress's themes size file)
Hope it helps someone who was stuck like me.
With Filezilla
directory uploads>2010>11 to set permision 777