Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
Netovil is on a distinguished road
 
Posts: 6
Join Date: Sep 2011
Default Problems with fpdf - 09-13-2011, 11:55 PM

Hi all

I'm learning PHP and MySQL by myself, to make some practice, create an account here at 000webhost to have my work at internet, but i have a problem.

I was working with fpdf at PHP to verify how it could work, I could make it work in my pc (Localhost) but when i transfer my files to my site here doesn't work. In the moment I want to create a PDF file from PHP with fpdf recive this error

Quote:
Fatal error: require() [function.require]: Failed opening required '/fpdf/fpdf.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a4494395/public_html/GTA/imprimir_choferes.php on line 2
In a php file create a button where you can create a pdf file if you want (with a button) but after push it in the new window i see that error.

In my pc i have the imprimir_choferes.php file in root and fdpf.php file in a fpdf directory, I transfer that directory to my site so the path is must be the same as in my pc, but isn't working.

Do you know what i have wrong with this?

Thanks for your time and attention.
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
Senior Member
grace1004 is on a distinguished road
 
Posts: 544
Join Date: Dec 2010
Default 09-14-2011, 07:37 AM

To create a pdf file, you need to set the permission of the file (where pdf creating code is included) to 777.
If you cannot solve the problem even if the permission has been set to 777 already, please change your code
as explained below:

According to the error message, imprimir_choferes.php file is not under public_html directory.
It's under GTA directory, while fpdf folder is under public_html directory. In that case,
require() function should be expressed as follows:

require("../fpdf/fpdf.php");

Last edited by grace1004; 09-14-2011 at 07:47 AM.
Reply With Quote
(#3 (permalink))
Old
d3iti's Avatar
Super Moderator
d3iti is on a distinguished road
 
Posts: 4,609
Join Date: Jul 2009
Location: Spain
Default 09-14-2011, 01:52 PM

Hello,

I can confirm that you 000webhost fpdf works. I've tried, but as indicated by grace1004 must be at least in the public_html folder (or subfolders).


Si este mensaje te ha servido de ayuda no dudes en pulsar sobre el botón karma
Reply With Quote
(#4 (permalink))
Old
Junior Member
Netovil is on a distinguished road
 
Posts: 6
Join Date: Sep 2011
Default 09-14-2011, 04:07 PM

Hi, thanks for your help

Is still not working, my path from imprimir_choferes.php is root /public_html /GTA/imprimir_choferes.php, and from fpdf.php is root /public_html /GTA/fpdf/fpdf.php.
At file I had
require("/fpdf/fpdf.php");
Then I change to
require("../fpdf/fpdf.php");
And then to
require("public_html/GTA/fpdf/fpdf.php");
None of that work

I'm pretty sure problem is with path or something like that but can't find it.

Another idea can help me?
Reply With Quote
(#5 (permalink))
Old
d3iti's Avatar
Super Moderator
d3iti is on a distinguished road
 
Posts: 4,609
Join Date: Jul 2009
Location: Spain
Default 09-14-2011, 06:39 PM

Hi,
I saved fpdf.php file in the same folder where was file that call fpdf.php library.

I would try the following path:
/GTA/fpdf/fpdf.php or GTA/fpdf/fpdf.php


Si este mensaje te ha servido de ayuda no dudes en pulsar sobre el botón karma
Reply With Quote
(#6 (permalink))
Old
Junior Member
Netovil is on a distinguished road
 
Posts: 6
Join Date: Sep 2011
Default 09-14-2011, 08:23 PM

I will drive crcazy with this, jajajajajajaja

the file imprimir_choferes.php is requested by another file; this what i have in the another file, do you think this make something wrong? in fact I still don't know what TARGET's function here, that's why I write here only xx

Quote:
<a href='imprimir_choferes.php' target='xx' onclick=\"window.open(this.href, this.target, 'width=900, height=400, menubar=no');return false;\"> IMPRIMIR </a>
I already try what you suggest but still not working.
Another thing I don't understand is this part at error message

Quote:
(include_path='.:/usr/lib/php:/usr/local/lib/php')
Could be the problem that I'm working with Windows and serves is Linux?

Thanks for your support
Reply With Quote
(#7 (permalink))
Old
Senior Member
grace1004 is on a distinguished road
 
Posts: 544
Join Date: Dec 2010
Default 09-14-2011, 11:39 PM

If fpdf folder is under GTA directory, path for fpdf.php file would be:

require("fpdf/fpdf.php") or require("./fpdf/fpdf.php")

I tested a similar file structure in localhost server in my PC,
and it worked fine.

It doesn't matter that imprimir_choferes.php is executed by clicking a link.

include_path='.:/usr/lib/php:/usr/local/lib/php'-- This is the default path used
in case include() or require() function is not specifically defined in the code.
So, no need to care about this error message, as require() function is defined
in your code.

If your localhost server is installed in Windows environment, your code works fine
without setting the permission to 777. However in Linux server, the permission needs
to be 777 if you want to create a pdf file.
Reply With Quote
(#8 (permalink))
Old
Junior Member
Netovil is on a distinguished road
 
Posts: 6
Join Date: Sep 2011
Default 09-14-2011, 11:47 PM

Well, finally after some hours from testing could make it work.

I change the directory fpdf to public_html (instead inside GTA) and, in the file try this require('../fpdf/fpdf.php');.

I never udersantd why inside GTA directory don't work, but well, finally the problem was solved.

Thanks a lot grace1004 and d3iti for your support I really really apreciate it !!!!!!!!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com