I am generating a pdf with fpdf in cakephp and I try to save it on the server.
I do it like this :
$fpdf->Output("D:/Files/mypdf.pdf",'F');
but it doesn't save.
I think it doesn't find the folder, but I don't know how specified it?
I have put the all the right on the folder.
I don't know if it is a cakephp restriction or just my directory?
Try this
$fpdf->Output(WWW_ROOT."files\mypdf.pdf", 'F');
As this code works fine locally, it's probably server-problem.
(1) Are you sure you can create files? Most free servers disallow creating files.
(2) Have you tried it with different location e.g. the current root location $fpdf->Output("mypdf.pdf",'F')
Anyway, you should enable error reporting in your index.php. If it was matter of directory not found you would get this result:
Warning (2): fopen(D:/Files/mypdf.pdf): failed to open stream: No such file or directory [ROOT\vendor\fpdf\fpdf.php, line 1025]
FPDF error: Unable to create output file: D:/Files/mypdf.pdf
Just a wild guess but change the slashes to windows style.
$fpdf->Output("D:\Files\mypdf.pdf",'F');
or even
$fpdf->Output("D:\\Files\\mypdf.pdf",'F');
Related
Ive been working on get a proxy working for when im school, to access sites that i use alot for work but my school dont like.. This is the error it comes up with when i try to upload the files to googles app engine..
C:\Program Files (x86)\Google\google_appengine>"C:\Python27\python.exe" appcfg.p
y update C:\Users\alastair\Desktop\School Files\Proxy Files\mirrorrr-master\mirrorrr-master
09:44 PM Host: appengine.google.com
Usage: appcfg.py [options] update | [file, ...]
appcfg.py: error: Directory does not contain an School.yaml configuration file
So im very confused on why it is asking for a "School.yaml" But i made one anyway, And even though its been made, it still displays this error, So if anyone can help, Please!
Your full project path contains two space characters and needs to be quoted, also, a trailing slash might be required i.e.:
C:\Python27\python.exe appcfg.py update "C:\Users\alastair\Desktop\School Files\Proxy Files\mirrorrr-master\mirrorrr-master\" assuming that's where you have your app.yaml file.
In your case it's thinking you are pointing to "C:\Users\alastair\Desktop\School" file which does not exist and thus showing the error.
When I try to click and open any link or database in phpMyadmin it results in a Token Mismatch error on my hosting server.
Does anyone know what the problem might be?
You need to verify that you have your session.save_path setting in your php.ini file set correctly.
After changing to a valid tmp directory, make sure you restart your webserver.
this fixes same error for me
find session.save_path in your php.ini file, this line may look also like this
;session.save_path = "/opt/lampp/temp/"
remove first semicolon from this line if it there
change it to
session.save_path = "/tmp"
I'm getting errors when I attempt to run my project deployed to app engine. I see issues like:
java.lang.ClassNotFoundException: com.seattleglassware.AuthServletSupport$$anonfun$finishOAuth2Dance$1$$anonfun$apply$33$$anonfun$apply$34$$anonfun$apply$37$$anonfun$apply$40$$anonfun$apply$41$$anonfun$apply$42$$anonfun$apply$45$$anonfun$apply$47$$anonfun$apply$48$$anonfun$apply$49
The class name looks reasonable (well, for certain values of reasonable - this is code generated by the Scala compiler). I see the file in my local web/WEB-INF/classes/com directory and I can decompile it with javap (so I don't think it's corrupt or anything silly like that.) Everything works fine running on a local debug server.
Even more strange, I can pour all the .class files in web/WEB-INF/classes into a jar file like this:
cd to the web/WEB-INF/classes directory
jar cf ../lib/classes.jar .
And now, if I upload the project (pressing the deploy button in Eclipse), I don't see those ClassNotFoundException errors. Delete the jar file, re-upload the project, get the errors again.
I'm wondering if there's some sort of limit on the names of .class files? Or something else happening in the deployment process that's causing this to happen?
EDIT: running from the command line made this much more clear (using maven now):
SEVERE: Invalid character in filename: WEB-INF/classes/com/seattleglassware/AuthServletSupport$$anonfun$finishOAuth2Dance$1$$anonfun$apply$33$$anonfun$apply$34$$anonfun$apply$37$$anonfun$apply$40$$anonfun$apply$41$$anonfun$apply$42$$anonfun$apply$45$$anonfun$apply$47$$anonfun$apply$48$$anonfun$apply$49.class
But it still looks to me like that's a valid filename.
The inclusion of "special" characters in the file name may be the issue here.
There is currently an open issue regarding "special" characters in project file names.
Issue 2211: Special characters are not supported in the filenames in the project
The original issue was reported by a Python App Engine user, however if you look in the comments you'll see that it apparently affects Java users as well.
I have an apache2 server, it has a vast and growing folder structure.
There is a set of instructions I would like to be executed at the beginning of every page in that website.
How do I implement that without pasting those very lines at the beginning of every file in the website?
I don't want to have the code at the beginning of every file.
I have tried changing the auto_prepend_file in php.ini to:
auto_prepend_file = ~/website_preview/say_hello.php
'say_hello' is a hello-world php script, but the script does still not get executed at all.
Wrong php.ini file, correct location is /etc/php5/apache2/php.ini
If all of your pages are in PHP, then I think you were on the right path with setting up auto_prepend_file in php.ini.
Try this:
Check your include_path in php.ini and if needed append a new path to it for your instructions file.
Copy your instructions.php file to the location from the include path.
Edit your auto_prepend_file in php.ini to be just the filename from step 2.
I tested this out and was able to get it working that way but had trouble specifying the path directly in the auto_prepend_file setting.
Also, when I had the auto_prepend_file setting configured improperly I received the following php error:
PHP Fatal error: Unknown: Failed opening required ...
Hope that helps.
I am just getting started with Cakephp shell and running into issues.
My cake core library is under path d:/libs/cake
My app is setup under d:/servers/htdocs/myapp
I wrote a test shell under d:/servers/htdocs/myapp/vendor/shells
class ReportShell extends Shell {
var $uses = array('Appt');
function main() {
echo $this->Appt->find('first');
}
}
When I try to run this code from d:/servers/htdocs/myapp , It gives me an error
Warning: include_once(d:/servers/htdocs/myapp/config/database.php): failed to open stream: No such file or directory in d:/libs/cake\libs\mode
l\connection_manager.php on line 23
Warning: include_once(): Failed opening 'd:/servers/htdocs/myapp/config/database.php' for inclusion (include_path='.;D:\work\xampp\php\PEAR') in d:/libs/cake\libs\model\connection_manager.php on line 23
Fatal error: ConnectionManager::getDataSource - Non-existent data source default in d:/libs/cake\libs\model\connection_manager.php on line 102
Reason is that it is trying to find database.php under 'd:/servers/htdocs/myapp/config/' and the correct path is 'd:/servers/htdocs/myapp/app/config/database.php'
What am I doing wrong here?
thanks
My app is setup under d:/servers/htdocs/myapp
No, the application directory (holding the config folder) is D:\servers\htdocs\myapp\app\.
Reason is that it is trying to find database.php under 'd:/servers/htdocs/myapp/config/' and the correct path is 'd:/servers/htdocs/myapp/app/config/database.php'
You are in the wrong directory, therefore it can't find your database config.
I wrote a test shell under d:/servers/htdocs/myapp/vendor/shells
Move your shell out of the global vendors folder at D:\servers\htdocs\myapp\vendors\shells to the application's vendors folder at D:\servers\htdocs\myapp\app\vendors\shells instead and try again.
(Note: I'm not actually sure where the global vendors folder should be when you have a setup where the cake and application directories are split from each other, but you definitely have to be in your application directory when running commands and not the myapp directory you're using.)
If you add D:\libs\cake\console\ to your PATH environment variable (remembering to close all cmd.exe processes afterwards) then you will simply be able to execute the following:
D:\servers\htdocs\myapp\app> cake report (from within the application directory)
Otherwise you will need to type the full relative or absolute path to the cake console executable and/or provide CakePHP with the absolute path to the application directory (if you are not in it):
D:\servers\htdocs\myapp\app> ..\..\..\..\libs\cake\console\cake report
D:\servers\htdocs\myapp\app> \libs\cake\console\cake report
D:\libs\cake\console> cake -app D:\servers\htdocs\myapp\app report
D:\> libs\cake\console\cake -app D:\servers\htdocs\myapp\app report
etc...
Hopefully you can see why just adding the correct folder to your PATH makes things a lot easier. :)
Try to run it from within the /app directory or with the -app parameter specified:
cake -app d:/servers/htdocs/myapp/app report
Thanks. Here was the issue
My shell script was under /myapp/vendor/shells which was wrong. It should have been under /myapp/app/vendor/shells. After I moved the file, it worked. Thank you
You should always be in your APP path to execute the cake console.
Your Shell File Should be in ..app/Console/Command/
If your file name is TestShell.php type command app> cake test