I want use fpdf in my project CI4..
how i can do this step by step?
How include it as thirdparty?!
<?php namespace App\Controllers\Purchase;
namespace App\ThirdParty\fpdf;
use CodeIgniter\Controller;
use FPDF;
?>
and how build the controller to call fpdf methods?!
$pdf = new PDF();
$pdf->AddPage();
thanks
I found a solution to this today.
Assuming your fpdf.php file is in the directory app\ThirdParty
1- make the first line of the file fpdf.php look like this
<?php namespace App\ThirdParty;
2- In your controller add the line
use App\ThirdParty\FPDF;
3- Now you can create your pdf file
$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->SetAutoPageBreak(1,13);
$pdf->AddPage('P','A4');
$this->response->setHeader('Content-Type', 'application/pdf');
$pdf->Output('test.pdf','F');
The file will be stored in the public directory of ci4.
I hope I've helped you.
I resolved this by using the old way (i.e adding fpdf directly in app/Controllers/);
Firstly, make sure you have the latest version of fpdf installed. Mine is 1.82 then unzip in app/Controllers.
require('fpdf.php');//to be done in your controller
$pdf = new \FPDF();
$pdf->AliasNbPages();
$pdf->SetAutoPageBreak(1,13);
$pdf->AddPage('P','A4');
$pdf->SetFont('Arial','B',16);
$pdf->Cell(40,10,'Hello World!');
$this->response->setHeader('Content-Type', 'application/pdf');
$pdf->Output('test.pdf','F');
In case you are using XAMPP for linux kindly update fpdf in /opt/lampp/lib/php.
First include font folder, fpdf.php file and fpdf.css file in the ThirdParty folder.
Open fpdf.php file and include following 2 lines after <?php
namespace App\ThirdParty;
use Exception;
Then rename the fpdf.php file in ThirdParty folder to FPDF.php
Now you can import fpdf using:
use App\ThirdParty\FPDF;
I've installed PEAR using pyrus.phar in C:\PEAR for PHP on IIS7. I've also downloaded the PEAR Mail package when I require_once the file Mail.php, I get HTTP Error 500.0 - Internal Server Error.
Here is my code :
<?php
set_include_path('C:/PEAR/php');
require_once 'Mail.php'; //should give me a blank page but is giving me an error
?>
I checked in Mail.php there is a line require_once 'PEAR.php';
Now where do I get this PEAR.php from?
You need to install the old pear installer, too:
$ pyrus install pear/pear
It provides PEAR.php.
Trying to move from local host to new server. Fresh install worked fine, no problems. When I uploaded my files mydomain.com/admin comes up with a white screen and mydomain.com produces this error:
Fatal error: Call to a member function get() on a non-object in /home4/pawpostc/public_html/index.php on line 103.
So I took a look at index.php line 103:
if ($config->get('config_error_display')) {
echo '<b>' . $error . '</b>: ' . $errstr . ' in <b>' . $errfile . '</b> on line <b>' . $errline . '</b>';
}
Seems like there is a problem with my config files. So I went and had a look at them. I have gone over them a few times but can not find the mistake, probably missing something, so here are the config files.
config.php (in my root www. folder):
<?php
// HTTP
define('HTTP_SERVER', 'http://www.pawpost.com.au/');
define('HTTP_IMAGE', 'http://www.pawpost.com.au/image/');
define('HTTP_ADMIN', 'http://www.pawpost.com.au/admin/');
// HTTPS
define('HTTPS_SERVER', 'http://www.pawpost.com.au/');
define('HTTPS_IMAGE', 'http://www.pawpost.com.au/image/');
// DIR
define('DIR_APPLICATION', '/home4/pawpostc/public_html/catalog/');
define('DIR_SYSTEM', '/home4/pawpostc/public_html/system/');
define('DIR_DATABASE', '/home4/pawpostc/public_html/system/database/');
define('DIR_LANGUAGE', '/home4/pawpostc/public_html/catalog/language/');
define('DIR_TEMPLATE', '/home4/pawpostc/public_html/catalog/view/theme/');
define('DIR_CONFIG', '/home4/pawpostc/public_html/system/config/');
define('DIR_IMAGE', '/home4/pawpostc/public_html/image/');
define('DIR_CACHE', '/home4/pawpostc/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home4/pawpostc/public_html/download/');
define('DIR_LOGS', '/home4/pawpostc/public_html/system/logs/');
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'my user name');
define('DB_PASSWORD', 'my password');
define('DB_DATABASE', 'my database');
define('DB_PREFIX', 'oc_');
?>
admin/config.php:
<?php
// HTTP
define('HTTP_SERVER', 'http://www.pawpost.com.au/admin/');
define('HTTP_CATALOG', 'http://www.pawpost.com.au/');
define('HTTP_IMAGE', 'http://www.pawpost.com.au/image/');
// HTTPS
define('HTTPS_SERVER', 'http://www.pawpost.com.au/admin/');
define('HTTPS_CATALOG', 'http://www.pawpost.com.au/');
define('HTTPS_IMAGE', 'http://www.pawpost.com.au/image/');
// DIR
define('DIR_APPLICATION', '/home4/pawpostc/public_html/admin/');
define('DIR_SYSTEM', '/home4/pawpostc/public_html/system/');
define('DIR_DATABASE', '/home4/pawpostc/public_html/system/database/');
define('DIR_LANGUAGE', '/home4/pawpostc/public_html/admin/language/');
define('DIR_TEMPLATE', '/home4/pawpostc/public_html/admin/view/template/');
define('DIR_CONFIG', '/home4/pawpostc/public_html/system/config/');
define('DIR_IMAGE', '/home4/pawpostc/public_html/image/');
define('DIR_CACHE', '/home4/pawpostc/public_html/system/cache/');
define('DIR_DOWNLOAD', '/home4/pawpostc/public_html/download/');
define('DIR_LOGS', '/home4/pawpostc/public_html/system/logs/');
define('DIR_CATALOG', '/home4/pawpostc/public_html/catalog/');
// DB
define('DB_DRIVER', 'mysql');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'my user name');
define('DB_PASSWORD', 'my password');
define('DB_DATABASE', 'my database');
define('DB_PREFIX', 'oc_');
?>
Any help on this would be appreciated.
I was using opencart and installed vqmod.
All of a sudden I have one of the same errors.
This solved my problem:
in system/library/session.php
replace start session with:
session_save_path(realpath(dirname($_SERVER['DOCUMENT_ROOT']) . '/../tmp'));
The most likely issue is that one or more of your library files are corrupt from uploading. Re upload your system/library/ folder from your local one. Your config files seem fine and the error doesn't reference a config issue. What is line 103 in your index.php file?
please cross check you have set all permissions
i had came across this error and was solved,
that was due to a file permission problem
I was struggling with the same problem after migrating my site to a new VPS environment. I figured it HAD to be something to do with the changed document-root path or permissions of my shop and pulled out a lot of hair trying to get to the core of the problem.
I finally realised that I had incorrect permissions on my PHP session-data store! In my case, the folder at /var/lib/php/session/ was owned by apache (naturally) but I had changed apache to run as a different user so it could no longer write to the session-store.
The error messages in this case are cryptic (to say the least!) and didn't give a clue that the problem might just be lack of write permission!
Oh well, we should know by now that 90% of unix issues are down to perms!
I upload a file at my server (directory: vqmod/....php ).
Just change vqmod file permission. I set 777 and that solved it.
From the error you received, it looks like the $config variable is not getting set.
The $config variable is set on line 35 using the Config class which is located in system/library/config.php
I think if you figure out why the class isn't getting instantiated, you'll be able to fix the issue.
This could be a couple things:
The system/library/config.php file may not have been uploaded to the new server
As mentioned in previous answers, there could be a permissions issue. Check the permissions of system/library/config.php and make sure the correct user has ownership.
Or it could be a completely unrelated issue.
The error is due to permissions set on the cache folder. Setting that to 755 and the files to 555 with set you home and dry.
I had the same issue. I changed vqmod permission to 777. I am not sure this solved the problem, but I checked my website without adding www. before the domain and it worked. The warning was removed if I check http://daytodaystore.com. If I check http://www.daytodaystore.com, the warning is there.
I had this problem when i migrated my server from 2G to 4GH on Godaddy.
Came across this forum and found that the issue is with session.php
Then, i guessed 'tmp' folder was missing. So, i created one just one step above html folder. and gave it a 777 access. Problem was fixed and my website looks great after that.
The code below worked on my old iMac with MAMP. However, it does not work on my new iMac. How do I fix this? Do I need to do something to the php.ini file?
<?php
$dbConnection = mysqli_connect("localhost", "xxxx", "xxxx", "gallery");
$query = "SELECT * FROM images";
$stmt = mysqli_prepare($dbConnection,$query);
mysqli_stmt_execute($stmt);
mysqli_stmt_bind_result($stmt, $id, $categories,$img_name);
while (mysqli_stmt_fetch($stmt)) {
echo $id."<br />";
}
?>
I grappled with this one for most of a day before the following on the (localhost) MAMP home page caught my eye: if you're running a PHP version 5.5.x or earlier, mysqli_connect() should work fine, but if you're using PHP version 5.6.x or later, try mysqli_init() and see if that works for you. It worked for me! It displays under the heading "Examples". Good luck!
You should enable php_mysqli extension in PHP.ini. It's disabled by default.
look for the following line: extension=php_mysqli
The problem: a column name was missing from the bind statement.
I'm using FOSFacebookBundle on symfony2.
I would like to create an object from FacebookSessionPersistence to read facebook User Informations.
But i have the following error:
Fatal error: Class 'BaseFacebook' not found in C:\Users\gp\Desktop\xampp\htdocs\projectOne\p1\vendor\bundles\FOS\FacebookBundle\Facebook\FacebookSessionPersistence.php on line 13
I registered the bundle and the autoloader like in the installation document.
Has anybody an idea what I'm doing wrong?
Thanks
1.) are you sure you have facebook sdk also installed?
[FacebookSDK]
git=git://github.com/facebook/php-sdk.git
target=/facebook
2.) Are you sure you have config set?
fos_facebook:
file: %kernel.root_dir%/../vendor/facebook/src/base_facebook.php
Check your autoload_classmap.php file, it should contain something like this
'BaseFacebook' => $vendorDir . '/facebook/php-sdk/src/base_facebook.php',
'Facebook' => $vendorDir . '/facebook/php-sdk/src/facebook.php',
'FacebookApiException' => $vendorDir . '/facebook/php-sdk/src/base_facebook.php',
if you installed the "facebook/php-sdk" with composer, it should be done automatically.