CodeIgniter -> php spark serve Not Working - php

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';

Related

Install FPDI on Ubuntu 16.04

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');

cant launch laravel site

Ive tried setting up a laravel instance many times now on Ubuntu 16.04 system. I have php5.6 and apache2 installed. Installed composer following the instructions on there site and than ran (composer global require "laravel/installer") to install laravel.
I've added (export PATH="~/.composer/vendor/bin:$PATH") to .bashrc and then create new laravel project with laravel new project. to test if it was working I cd into project and ran (php artisan serve) but keep coming up with
PHP Warning: require(/home/dave/project/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/dave/project/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/home/dave/project/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php') in /home/dave/project/bootstrap/autoload.php on line 17
Can anyone help get me going.

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

Can't Setup Laravel Project Using Composer

I try to setup a laravel project using composer with this command
composer create-project laravel/laravel blog "5.1.*"
But i got following error:
Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Warning: require(/home/iwan/blog/bootstrap/../vendor/aut
oload.php): failed to open stream: No such file or directory in /home/iwan/
blog/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/home/iwan/blog/boots
trap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pea
r') in /home/iwan/blog/bootstrap/autoload.php on line 17
Does anybody know how to fix this ?
Thank you
Actually, the project is created but the dependencies are not installed so open your terminal/command prompt and run following commands:
cd blog
composer install
Also, if you want then, you may install the Laravel installer so you can create a new project using something like the following:
laravel new Blog
This is a little bit faster. So to install the installer you need to run the following command from the command prompt/terminal:
composer global require "laravel/installer=~1.1"
Once you install the installer you may then run laravel new someproject from the terminel to create a new project with all the dependencies (According to Documentation).
Note: Check this and this as well if needed.

Laravel issue with Patchwork UTF8

I have just pulled a remote Laravel project from Github and ran composer install to create the vendor folder.
However, this returns an error in the terminal:
[RuntimeException]
Could not scan for classes inside "/Applications/MAMP/htdocs/imperialnet/ve
ndor/patchwork/utf8/src/Normalizer.php" which does not appear to be a file
nor a folder
And this error in the error log:
PHP Fatal error: require(): Failed opening required '/Applications/MAMP/htdocs/app/vendor/symfony/var-dumper/Resources/functions/dump.php' (include_path='/Applications/MAMP/htdocs/app/vendor/phpseclib/phpseclib/phpseclib:.:/Applications/MAMP/bin/php/php5.6.2/lib/php') in /Applications/MAMP/htdocs/app/vendor/composer/autoload_real.php on line 58
Looking in Vendor > patchwork > utf8 there is no SRC folder? What is going with composer or ?
I had the same problem. Deleting the vendor folder and the composer.lock file and then running composer install solved the issue.
You may write in console: composer update --dev

Categories