Install FPDI on Ubuntu 16.04 - php

I just ran apt-get install libfpdi-php as well as installed composer and ran composer require setasign/fpdi-fpdf. all three operations seemed to complete swimmingly well however is still get the error when calling require_once('fpdi.php'); in my PHP script (which is line 3, after calling require_once ('fpdf.php');:
PHP Warning: require_once(fpdi.php): failed to open stream: No such file or directory in /fpdfwriteon.php on line 3
PHP Fatal error: require_once(): Failed opening required 'fpdi.php' (include_path='.:/usr/share/php') in /fpdfwriteon.php on line 3
I've searched my entire disk for "fpdi" and nothing returns. Am I missing a step? Did I do something wrong with composer?
thanks.
EDIT: I have a link to fpdf.php in /usr/share/php/ from when I installed fpdf but there is no indication of fpdi anywhere

Refer this link : https://www.devmanuals.net/install/ubuntu/ubuntu-16-04-LTS-Xenial-Xerus/how-to-install-libfpdi-php.html
You can verify the installation by running the following command.
user#demo:/$ dpkg -L libfpdi-php
/.
/usr
/usr/share
/usr/share/php
/usr/share/php/fpdi
/usr/share/php/fpdi/fpdi.php
/usr/share/php/fpdi/fpdi2tcpdf_bridge.php
/usr/share/php/fpdi/fpdi_pdf_parser.php
/usr/share/php/fpdi/pdf_context.php
/usr/share/php/fpdi/pdf_parser.php
/usr/share/php/fpdi/filters
/usr/share/php/fpdi/filters/FilterASCII85.php
/usr/share/php/fpdi/filters/FilterASCII85_FPDI.php
/usr/share/php/fpdi/filters/FilterLZW.php
/usr/share/php/fpdi/filters/FilterLZW_FPDI.php
/usr/share/doc
/usr/share/doc/libfpdi-php
/usr/share/doc/libfpdi-php/copyright
/usr/share/doc/libfpdi-php/changelog.Debian.gz
When you calling fpdi.php, just give full path in include function.
include('/usr/share/php/fpdf.php');
include('/usr/share/php/fpdi/fpdi.php');

Related

CodeIgniter -> php spark serve Not Working

I have just created a new project with CodeIgniter.
I tried to run this command to run the server:
php spark serve
But it is giving me this error:
PHP Warning: require(/mnt/e/dev/learning/php/codeigniter/001/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php): failed to open stream: No such file or directory in /mnt/e/dev/learning/php/codeigniter/001/spark on line 44
PHP Fatal error: require(): Failed opening required '/mnt/e/dev/learning/php/codeigniter/001/app/Config/../../vendor/codeigniter4/framework/system/bootstrap.php' (include_path='.:/usr/share/php') in /mnt/e/dev/learning/php/codeigniter/001/spark on line 44
How can I run this command
PHP version 7.2 or newer is required, with the intl extension and mbstring extension installed.
The following PHP extensions should be enabled on your server: php-json, php-mysqlnd, php-xml
And then follow below steps to install and run CI 4 project:
composer create-project codeigniter4/appstarter project-root
composer clearcache
composer update
Config Setting:baseUrl in app/Config/App.php and DB info in app/Config/Database.php
php spark serve
Note: clear composer cache before updating composer. For detail info follow CI documentation
In my case I tried to upgrade my CI setup, and all files I didn't adapt I thought I could easily copy them to retrieve the latest file. Like: cp vendor/codeigniter4/framework/app/Config/Constants.php ./app/Config/
However, I did the same for the app/Config/Paths.php file, but that resulted in your error message as well.
Bottom-line: don't try to replace the Paths.php file from upstream. And the $systemDirectory variable in Paths.php should look like this:
public $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';

Laravel does not create folder vendor

After installing Composer it worked well, Laravel created all folders and it started correctly with:
php artisan serve
Now, when I try:
laravel new mypro
It does not create the vendor folder. And when I try:
php artisan serve
It says:
php artisan serve
PHP Warning: require(/mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php') in /mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/autoload.php on line 17
After I copy folder vendor it says:
php artisan serve
PHP Fatal error: Class 'Illuminate\Notifications\NotificationServiceProvider' not found in /mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog3/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Illuminate\Notifications\NotificationServiceProvider' not found
I encountered the same problem. It occurred because the composer was not able to install the dependencies specified in composer.json file. try running
composer install
If this does not solve the problem, make sure the following PHP modules are installed php-mbstring php-dom
To install this extensions run the following in terminal
sudo apt-get install php-mbstring php-dom
once the installation is complete
try running the command again in your project root folder
composer install
So, if the above doesn't work, you can as well try this command
composer update --no-scripts
More solutions on this thread.
Laravel 5 Failed opening required bootstrap/../vendor/autoload.php
Instead of copying vendor folder please run a command
composer install
in your laravel's project directory
After trying multiple solutions from different sources, the only thing that worked for me was upgrading the PHP version.
Try to install it manually sudo apt-get install php5.6-mbstring

Composer - failed opening required for phpseclib

I am trying to run a PHP file in a Vagrant VM which also uses composer for the build.
I am getting the following errors:
PHP Warning: require(/var/www/CLIENT/vendor/composer/../phpseclib/phpseclib/phpseclib/bootstrap.php): failed to open stream: No such file or directory in /var/www/ispe/vendor/composer/autoload_real.php on line 66
Warning: require(/var/www/CLIENT/vendor/composer/../phpseclib/phpseclib/phpseclib/bootstrap.php): failed to open stream: No such file or directory in /var/www/CLIENT/vendor/composer/autoload_real.php on line 66
PHP Fatal error: require(): Failed opening required '/var/www/CLIENT/vendor/composer/../phpseclib/phpseclib/phpseclib/bootstrap.php' (include_path='.:/usr/share/php') in /var/www/CLIENT/vendor/composer/autoload_real.php on line 66
Fatal error: require(): Failed opening required '/var/www/CLIENT/vendor/composer/../phpseclib/phpseclib/phpseclib/bootstrap.php' (include_path='.:/usr/share/php') in /var/www/CLIENT/vendor/composer/autoload_real.php on line 66
Now as far as I can tell, phpseclib shouldn't be required for this particular functionality, or anything else (though I haven't 100% confirmed the anything else bit yet).
Even so, I decided to add it to my composer.json ("phpseclib/phpseclib": "2.0.4") to get rid of the errors, with no luck.
I'm fairly new to Composer, so I am wondering precisely what I might be doing wrong here or what needs to be setup.
I can confirm that the directory /var/www/CLIENT/vendor/composer/../phpseclib/phpseclib/phpseclib/ exists, however there is no file bootstrap.php inside the directory.
Instead I see the following:
Crypt File Math Net System
EDIT: I also want to clarify that the file autoload.php is inside the vendor directory and that the PHP version of the VM is 7.0.
I strongly believe that the cache is the problem, It cannot be 100% sure but try destroying your Vagrant instance, or
You could follow the following steps:
Delete the vendor folder
Delete composer.lock
Run the command composer clearcache (or clear-cache)
Run composer install
Oneliner for easy copy/pasting:
rm -rf vendor composer.lock && composer clearcache && composer install

failed to install imagine class with require(vendor/autoload.php error on centos6.5/php5.4

I know many users have asked same question before but it wasn't helpful for me...
I have a VPS (centOS6.5/directadmin/php5.4/SSH terminal)
I try install imagine (https://imagine.readthedocs.org) class in my server via getcomposer.org
These are my all steps:
First I install getcomposer:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
then:
cd /usr/local/bin/
And
echo '{"require": {"imagine/imagine": "~0.6.2"}}'->composer.json
After That I run it:
composer update
OK! everything seems installed!
Now in my website root, I want to test it:
<?php
require 'vendor/autoload.php'; // line 2
$imagine = new Imagine\Gd\Imagine(); // line 3
?>
But I get this error:
Warning: require(vendor/autoload.php): failed to open stream: No such
file or directory in
/home/admin/domains/example.com/public_html/info.php on line 2
Fatal error: require(): Failed opening required 'vendor/autoload.php'
(include_path='.:/usr/local/php54/lib/php') in
/home/admin/domains/example.com/public_html/info.php on line 2
//EDIT
The real locate of autoload.php in my server:
/usr/local/bin/vendor/autoload.php
Also There "imagine" directory in vendor directory!
/usr/local/bin is where your binary files live. You should move composer.phar to this location (and rename it to composer) and then use composer in your command line.
The composer.json file is part of your package, it specifies the packages it depends on in this file. You then can install all required packages for the current package by using composer install/composer update. This will make a vendor directory with all third party code and a preconfigured autoloader in vendor/autoload.php.
Finaly after install imagine class, I moved the composer to root of my website and now it works normally

pyrus.phar installed but can't find PEAR2/Autoloader.php in Ubuntu 14.04

I am installing Net_RouterOS on Ubuntu 14.04. I was able to install everything fine in OSX 10.7.5, but on the Ubuntu machine, I have not been able to configure pyrus.phar correctly to install and run Net_RouterOS.
What I am having trouble with, is where to locate the pyrus.phar file, and what the setting should be in the pearconfig.xml file (which is located at /home/xxxx/.pear). It seems that there are problems with either permissions or possible the location of the files.
When I include this at the top of my php file:
use PEAR2\Net\RouterOS;
require_once 'PEAR2/Autoload.php';
I get:
Warning: require_once(PEAR2/Autoload.php): failed to open stream: No such file or directory in /var/www/html/wifi_creator.php on line 3
Fatal error: require_once(): Failed opening required 'PEAR2/Autoload.php' (include_path='/usr/bin/php:/usr/share/php:/home/xxxx/.pear') in /var/www/html/wifi_creator.php on line 3
Any help would be great! Thank you
Figured it out. I did a search with this command:
find / -iname Autoload.php
And it took a while but finally I got back /usr/share/php/PEAR/php/PEAR2/Autoload.php
So in my php.ini file I added /usr/share/php/PEAR/php to the include_path
whew :)

Categories