I have deployed a Symfony2 application to shared hosting server from local machine. I used a git pull followed by composer install and then i chmoded the app/cache and app/logs permissions to 777.
Each time I run the application I get the following error:
[2016-02-06 18:55:43] request.CRITICAL:
Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalErrorException:
"Compile Error: require(): Failed opening required 'vendor/autoload.php'
(include_path='.:/opt/alt/php55/usr/share/pear:/opt/alt/php55/usr/share/php')" at
/home/tdarlic/public_html/magniblu/users/src/AppBundle/Controller/DefaultController.php line 5 {"exception":"[object]
(Symfony\Component\Debug\Exception\FatalErrorException(code: 0): Compile
Error: require(): Failed opening required 'vendor/autoload.php'
(include_path='.:/opt/alt/php55/usr/share/pear:/opt/alt/php55/usr/share/php') at /home/tdarlic/public_html/magniblu/users/src/AppBundle/Controller/DefaultControll
er.php:5)"} []
I managed to fix this by entering full path to autoload.php:
require '/home/tdarlic/public_html/magniblu/users/vendor/autoload.php';
I tried with
../../../vendor/autoload.php
and with
../../vendor/autoload.php
require __DIR__.'../../vendor.autoload.php';
and still cannot figure out how to keep the autoload file link loading correctly on development machine and on the server.
Any ideas how to solve this?
Similar issue can be found on:
Why my autoload.php of composer doesn't work?
Related
Downloaded a git repo for a chat application using the below link
Git Repo for Chat Application
Then changed the env file to .env file and also uncommented default database block as shown below.
database.default.hostname = localhost
database.default.database = chat
database.default.username = root
database.default.password =
database.default.DBDriver = MySQLi
Then opened terminal and executed this command php spark migrate
But while executing this error pops up
PS C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial> php spark migrate
PHP Warning: require(C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php): failed to
open stream: No such file or directory in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
Warning: require(C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php): failed to open
stream: No such file or directory in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
PHP Fatal error: require(): Failed opening required 'C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php'
(include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\Codeigniter-4-Chat-
Tutorial\app\Config/../../vendor/codeigniter4/framework/system/bootstrap.php'
(include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial\spark on line 44
PS C:\xampp\htdocs\Codeigniter-4-Chat-Tutorial>
How to resolve this? Any help appreciated.
It looks to me that you didn't run the composer update command after starting the project. So in this case your vendor folder is probably missing a lot of files.
Go to the root of your project in the terminal and run:
$ composer update
And you should be fine.
I have created a Laravel project using PhpStorm but when I open index.php in the browser it shows some errors.
It opens http://localhost:63342/METU/public/index.php but it should be http://localhost:63342/index.php.
Warning: require(C:\Users\ilhan\PhpstormProjects\METU\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\Users\ilhan\PhpstormProjects\METU\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\Users\ilhan\PhpstormProjects\METU\bootstrap/../vendor/autoload.php' (include_path='.;C:\php\pear') in C:\Users\ilhan\PhpstormProjects\METU\bootstrap\autoload.php on line 17
What is wrong with my project?
That error generally occurs when you haven't run composer install on a new laravel project. The autoload file it references will be created when you run that command.
As for the URL issue, you want to make sure your localhost is mapped to the /public folder of your laravel project, not mapped to the root of it.
I used composer to get the laravelcollective/html dependency. But later on I did not need this and I accidentally deleted the folder myself without asking composer to do it for me. Now, whenever I try to run a local server or issue the update command with composer I get the following error:
[RuntimeException]
Error Output: PHP Warning: require(/media/adeel/643459A034597650/Projects/Laravel/vendor/laravelcollective/html/src/helpers.php): failed to open stream: No such file or directo
ry in /media/adeel/643459A034597650/Projects/Laravel/vendor/composer/autoload_real.php on line 55
PHP Fatal error: require(): Failed opening required '/media/adeel/643459A034597650/Projects/Laravel/vendor/laravelcollective/html/src/helpers.php' (include_path='.:/usr/share/p
hp:/usr/share/pear') in /media/adeel/643459A034597650/Projects/Laravel/vendor/composer/autoload_real.php on line 55
Even though the /laravelcollective directory does not exist anymore I still get this error. I have tried removing the whole vendor folder from my Laravel project and then issued a composer update command but I get this error:
[RuntimeException]
Error Output: PHP Warning: require(/media/adeel/643459A034597650/Projects/Laravel/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /media/
adeel/643459A034597650/Projects/Laravel/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/media/adeel/643459A034597650/Projects/Laravel/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share
/pear') in /media/adeel/643459A034597650/Projects/Laravel/bootstrap/autoload.php on line 17
It seems the problem was fixed by issuing the install command instead of update. I also removed the composer.lock file from its directory, but I don't think that made a difference.
I installed the pear/http_request2 version 2.2.1 using Composer in my project but when I am trying to make my first request I am getting this Warning and Fatal error:
Warning: require_once(Net/URL2.php): failed to open stream: No such
file or directory in
/Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/http_request2/HTTP/Request2.php
on line 24
Fatal error: require_once(): Failed opening required 'Net/URL2.php'
(include_path='/Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/pear_exception:.:/Applications/XAMPP/xamppfiles/lib/php')
in
/Applications/XAMPP/xamppfiles/htdocs/jet/vendor/pear/http_request2/HTTP/Request2.php
on line 24
I appreciate any help on how to fix it, thanks in advance.
David.
This should work:
composer require pear/http_request2:2.2.1
By default pear/net_url2 should be installed which has the required URL2.php file (./vendor/pear/net_url2/Net/URL2.php).
Then make sure you're including vendor/autoload.php file in your scripts to load automatically the include paths (see: vendor/composer/include_paths.php file).
Here is a simple PHP command to test this out:
php -r 'require_once "vendor/autoload.php"; require_once "Net/URL2.php";'
Note: The above command should run without any errors.
Related: Errors in the autoloaded HTTP/Request2 code, how to troubleshoot composer?
You need HTTP_Request2 from git master, because it has not been released/tagged yet at the time of writing.
I am currently trying to install a preproduction branch on my dedicated serveur.
I installed a Symfony version in the /web/preprod directoty of my symfony production project. I managed to link correctly the front controller and the routes, and now I am calling an action in the preprod branch.
I am getting this error message :
Warning:
require_once(/var/www/vhosts/ns21206.ovh.net/citydom/web/preprod/app/cache/prod_new/jms_diextra/proxies/CityDom-APIBundle-Controller-GangController.php):
failed to open stream: No such file or directory in
/var/www/vhosts/ns21206.ovh.net/citydom/web/preprod/app/cache/prod/jms_diextra/controller_injectors/CityDomAPIBundleControllerGangController.php
on line 13
Fatal error: require_once(): Failed opening required '/var/www/vhosts/ns21206.ovh.net/citydom/web/preprod/app/cache/prod_new/jms_diextra/proxies/CityDom-APIBundle-Controller-GangController.php'
(include_path='.:/usr/share/pear:/usr/share/php') in
/var/www/vhosts/ns21206.ovh.net/citydom/web/preprod/app/cache/prod/jms_diextra/controller_injectors/CityDomAPIBundleControllerGangController.php
on line 13
The preprod cache folders are on permission 777.
Not all action aren't working, but this one doesn't.
See Setting up Permissions in this section. Go with the setfacl command.