I need help with creating a symfony project in ubuntu/eclipse i get a lot of warnings. i Use:
ubuntu: 15.04
eclipse: 4.5.0 mars
symfony feature: 1.1.0.20150705
I use Symfony Feature to create projects using a built in wizard.
Project details:
PHP version: 5.6
Symfony version: v2.7.3
Override composer.jason values: i use defaults
i get errors with app/bootstrap.php.cache
Maybe there is a good tutorial that might help me, but 'till now i haven't found one...
Maybe elipse isn't good for symfony project.
Here are some error messages:
!ENTRY com.dubture.composer.core 4 4 2015-08-06 20:49:38.196
!MESSAGE PHP Warning: require_once(/var/www/test3/app/bootstrap.php.cache): failed to open stream: No such file or directory in /var/www/test3/app/console on line 10
PHP Fatal error: require_once(): Failed opening required '/var/www/test3/app/bootstrap.php.cache' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/test3/app/console on line 10
and second
!ENTRY com.dubture.composer.core 4 4 2015-08-06 20:50:29.267
!MESSAGE Installing symfony/framework-standard-edition (v2.7.2)
- Installing symfony/framework-standard-edition (v2.7.2)
Loading from cache
Created project in test1
> SymfonyStandard\Composer::hookRootPackageInstall
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for sensiolabs/security-checker v2.0.5 -> satisfiable by sensiolabs/security-checker[v2.0.5].
- sensiolabs/security-checker v2.0.5 requires ext-curl * -> the requested PHP extension curl is missing from your system.
Problem 2
- sensiolabs/security-checker v2.0.5 requires ext-curl * -> the requested PHP extension curl is missing from your system.
- sensio/distribution-bundle v4.0.0 requires sensiolabs/security-checker ~2.0 -> satisfiable by sensiolabs/security-checker[v2.0.5].
- Installation request for sensio/distribution-bundle v4.0.0 -> satisfiable by sensio/distribution-bundle[v4.0.0].
thats a piece of the whole log file, those are the messages i get in gui.
Composer installation failed with an error (see second set of error messages) because it could not install all dependencies.
It says in the error message:
the requested PHP extension curl is missing from your system.
You need to install this extension for PHP to get all required files to get your project up and running.
When Symfony2 starts up, it need some of bootstrap cookies which will be removed, eventually. From my experience, 'bootstrap.php.cache' file existed for ACME bundle example pages, and It is not essential file.
The solution is simple.
You just need to create 'bootstrap.php.cache' file in /var/www/test3/app/ folder. The content of 'bootstrap.php.cache' can be blank.
touch bootstrap.php.cache
Hope this works well for you. Good luck!
It's possible that, you don't have right permission for read in these file, check this sudo chmod 755 in these file. If you haven't that file, create it how suggests YONGSOO KIM
The solution is simple. You just need to create bootstrap.php.cache
file in /var/www/test3/app/ folder. The content of bootstrap.php.cache
can be blank.
You can fix problem with versions of package sensiolabs/security-checker or generate bootstrap cache file like answer here https://stackoverflow.com/a/6884027/4356973
Related
I'm building a website with PHP framework "Slim" as my templating framework, and it recommends using composer as the package manager. SO... I'm now using composer for the first time, developing locally on 64 bit Ubuntu 16.04 and composer is not installing anything into my project.
I've followed the installation instructions on the Slim Framework & Composer websites to a tee.
Basically this is the order of what I've done:
Installed composer into /var/www/html directory [1.]
Created Slim project using Slim-Skeleton as a base
php composer.phar create-project slim/slim-skeleton slimLittleTest
Note: the php composer.phar create-project slim/slim-skeleton command automatically creates a composer.json file, I will put the contents of that file down farther in my question.
Change into that directory and run php composer.phar install
Nothing is installed!
If I try to run php -S localhost:8080 -t public public/index.php as you're now supposed to able to (from the Slim framework website homepage tutorial) I get the following error:
[Tue Sep 5 18:55:04 2017] PHP Fatal error: require(): Failed opening required '/var/www/html/slimLittleTest/public/../vendor/autoload.php' (include_path='.:/usr/share/php') in /var/www/html/slimLittleTest/public/index.php on line 12
[Tue Sep 5 18:55:05 2017] PHP Warning:
require(/var/www/html/slimLittleTest/public/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/slimLittleTest/public/index.php on line 12
This error of course makes sense because nothing got installed! There is no vendor/autoload.php because Composer hasn't installed anything. (By default Composer installs dependencies into the vendor folder in the root of your project)
SEPTEMBER 7th QUESTION UPDATE
From some comments down below, I've been alerted to the fact that something must have gone wrong on the command composer create-project, that my solution of just re-requiring all packages shouldn't be necessary. Upon further inspection, I did get some errors upon running command php composer.phar create-project slim/slim-skeleton projectName. Below is exactly what got output from the console after running that command:
php composer.phar create-project slim/slim-skeleton tester
Installing slim/slim-skeleton (3.1.2)
- Installing slim/slim-skeleton (3.1.2): Loading from cache
Created project in tester
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpunit/phpunit 5.7.9 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 5.7.8 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 5.7.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
[.......]
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-curl.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-imagick.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mbstring.ini
- /etc/php/7.0/cli/conf.d/20-mcrypt.ini
- /etc/php/7.0/cli/conf.d/20-mysqli.ini
- /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Would either that .ini extensions issue or Problem 1 php unit requires ext-dom issue be the main source of my problem?
I got lucky and stumbled upon an answer that worked in my situation.
I just had to run php composer.phar require [package_name], for each package name, and if it wasn't in composer.json yet that dependency would get installed. So what I needed to do was delete the composer.json file, then go back and require each package from it. Nothing else worked, such as php composer.phar update, or php composer.phar install.
So I ran php composer.phar require slim/php, php composer.phar require php, etc. from the command line and everything installed correctly.
This is potentially a failure of the getting started documentation from SlimFramework.com, It's not necessarily "wrong" because maybe it works in some/most situations, but they should at least address the potential for the problem I ran into, and a solution or way to avoid it.
EVEN BETTER SOLUTION
Turns out that the main error I was getting here is that I was missing ext-dom. Thank you to this badass #Anar Bayramov's answer on another StackOverflow question I know that I can get the missing ext-dom by simply downloading php7.0-xml.
sudo apt-get update
sudo apt-get install php7.0-xml
And BOOM! Now when I run php composer.phar create-project slim/slim-skeleton projectName all vendor packages are installed successfully and it works like a charm. Problem solved.
I've dug through a few of the other answers here and nothing seems to fit the bill. I'm probably going to leave some information out initially so just let me know what else you might need and thanks!
Currently running ubuntu 7, using composer and laravel both of which seem to be installed properly:
When I type 'php artisan serve' and 'php artisan serve --port:8000' into terminal I get this error:
PHP Warning:
require(/home/user/Projects/thingy/bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
/home/user/Projects/thingy/bootstrap/autoload.php on line 17 PHP
Fatal error: require(): Failed opening required
'/home/user/Projects/thingy/bootstrap/../vendor/autoload.php'
(include_path='.:/usr/share/php') in
/home/user/Projects/thingy/bootstrap/autoload.php on line 17
When I attempt to run 'php -S localhost:8000 -t public/' just as an attempt I get the following error upon refresh:
PHP 7.0.18-0ubuntu0.17.04.1 Development Server started at Thu Jul 6
09:15:36 2017 Listening on http://localhost:8000 Document root is
/home/user/Projects/thingy/public Press Ctrl-C to quit. [Thu Jul 6
09:15:40 2017] PHP Warning:
require(/home/user/Projects/thingy/bootstrap/../vendor/autoload.php):
failed to open stream: No such file or directory in
/home/user/Projects/thingy/bootstrap/autoload.php on line 17 [Thu
Jul 6 09:15:40 2017] PHP Fatal error: require(): Failed opening
required
'/home/user/Projects/thingy/bootstrap/../vendor/autoload.php'
(include_path='.:/usr/share/php') in
/home/user/Projects/thingy/bootstrap/autoload.php on line 17 [Thu
Jul 6 09:15:40 2017] 127.0.0.1:57214 [500]: / - require(): Failed
opening required
'/home/user/Projects/thingy/bootstrap/../vendor/autoload.php'
(include_path='.:/usr/share/php') in
/home/user/Projects/thingy/bootstrap/autoload.php on line 17
I checked to see if maybe a server was already running using the 'ps -ef | grep php' command in terminal and I don't see any servers running at all.
I have run 'composer install' and I get the following error:
Cannot create cache directory
/home/user/.composer/cache/repo/https---packagist.org/, or directory
is not writable. Proceeding without cache Cannot create cache
directory /home/user/.composer/cache/files/, or directory is not
writable. Proceeding without cache Cannot create cache directory
/home/user/.composer/cache/repo/https---packagist.org/, or directory
is not writable. Proceeding without cache Loading composer
repositories with package information Installing dependencies
(including require-dev) from lock file Your requirements could not be
resolved to an installable set of packages.
Problem 1
- Installation request for laravel/framework v5.4.28 -> satisfiable by laravel/framework[v5.4.28].
- laravel/framework v5.4.28 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
Problem 2
- Installation request for phpunit/php-code-coverage 4.0.8 -> satisfiable by phpunit/php-code-coverage[4.0.8].
- phpunit/php-code-coverage 4.0.8 requires ext-dom * -> the requested PHP extension dom is missing from your system. Problem 3
- Installation request for phpunit/phpunit 5.7.21 -> satisfiable by phpunit/phpunit[5.7.21].
- phpunit/phpunit 5.7.21 requires ext-dom * -> the requested PHP extension dom is missing from your system. Problem 4
- laravel/framework v5.4.28 requires ext-mbstring * -> the requested PHP extension mbstring is missing from your system.
- laravel/tinker v1.0.1 requires illuminate/console ~5.1 -> satisfiable by laravel/framework[v5.4.28].
- Installation request for laravel/tinker v1.0.1 -> satisfiable by laravel/tinker[v1.0.1].
To enable extensions, verify that they are enabled in your .ini
files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-pdo_pgsql.ini
- /etc/php/7.0/cli/conf.d/20-pgsql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
- /etc/php/7.0/cli/conf.d/20-zip.ini You can also run php --ini inside terminal to see which files are used by PHP in CLI mode.
When running 'composer dump-autoload' I get the following:
Cannot create cache directory
/home/user/.composer/cache/repo/https---packagist.org/, or directory
is not writable. Proceeding without cache Cannot create cache
directory /home/user/.composer/cache/files/, or directory is not
writable. Proceeding without cache Cannot create cache directory
/home/user/.composer/cache/repo/https---packagist.org/, or directory
is not writable. Proceeding without cache Generating optimized
autoload files
After following the advice of Nishan Karunarathna and Alex I now get the following error when I run 'php artisan serve':
PHP Fatal error: Uncaught Error: Class
'Illuminate\Foundation\Application' not found in
/home/joshua/Projects/thingy/bootstrap/app.php:14 Stack trace:
0 /home/joshua/Projects/thingy/artisan(18): require_once()
1 {main} thrown in /home/joshua/Projects/thingy/bootstrap/app.php on line 14
Thanks for any help you give!
You have sort out the errors when encountered when doing composer install.
Install required PHP extensions
sudo apt-get install php7.0-mbstring
sudo apt-get install php7.0-xml
Then restart your nginx and try to run composer install again.
I think you should:
1) Install additional php extensions. Run into your terminal something like:
$ sudo apt-get install php7.0-opcache php7.0-calendar php7.0-ctype php7.0-gettext ...
2) Then give permissions to cache dir of composer:
$ sudo chmod -R u+w /home/joshua/.composer or if this directory is absent your should create its before $ sudo mkdir /home/joshua/.composer
3) Run $ composer install
But I'd like to pay your attention on:
1) Check your home directory on write permissions. If you don't have them, the most part of programs can't work correctly
2) Probably you have needed php extensions but they are not loaded. In this case check your .ini files and enable extensions.
Ok so I managed to answer my own question (actually a friend answered it for me.)
Apparently after you install laravel and composer it can, on occasion, lose the file path:
I had to open my .bashrc file in my hidden files on the /home/user/ level and add the command 'export PATH=~/.composer/vendor/bin:$PATH'
I think the other users here did contribute to fixing my problem as laravel and composer didn't seem to be installed correctly despite the files being in the proper place.
I'm running a vagrant box w/ a simple lamp stack. I've installed phpunit globally via composer :
composer global require "phpunit/phpunit=4.1.*"
When I run phpunit I get the following error:
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/share/php/PHPUnit/Autoload.php on line 46
HP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='/home/vagrant/.composer/vendor/phpunit/php-text-template:/home/vagrant/.composer/vendor/phpunit/phpunit-mock-objects:/home/vagrant/.composer/vendor/phpunit/php-timer:/home/vagrant/.composer/vendor/phpunit/php-token-stream:/home/vagrant/.composer/vendor/phpunit/php-file-iterator:/home/vagrant/.composer/vendor/phpunit/php-code-coverage:/home/vagrant/.composer/vendor/phpunit/phpunit:/home/vagrant/.composer/vendor/symfony/yaml:.:/usr/share/php:/usr/share/pear') in /usr/share/php/PHPUnit/Autoload.php on line 46
My research seems to imply that it's a problem with CodeCoverage not installing, but I'm having problems trying to get that installed. I've tried to install via composer and can't get it working.
Via Composer, I've tried adding to the global:
composer global require "phpunit/php-code-coverage": "3.0.*#dev"
and I get this output:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package phpunit/php-code-coverage could not be found in any version, there may be a typo in the package name.
Problem 2
- phpunit/phpunit 4.1.3 requires phpunit/php-code-coverage ~2.0 -> no matching package found.
- phpunit/phpunit 4.1.3 requires phpunit/php-code-coverage ~2.0 -> no matching package found.
- Installation request for phpunit/phpunit == 4.1.3.0 -> satisfiable by phpunit/phpunit[4.1.3].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
No clue what I'm doing wrong!
you need to reinstall code-coverage 2.0 first
composer global require "phpunit/php-code-coverage":"2.0.*#dev"
then you install phpunit
composer global require "phpunit/phpunit=4.1.*"
I got a web app that works on my local computer, but not on my server. I get this error on server. I checked the code that the error mentions about, and there's nothing wrong with it.
Do you have any idea what causes this?
Thank you very much in advance.
Here's my error message:
Fatal error: Interface 'Illuminate\Exception\ExceptionDisplayerInterface' not found in /var/www/test-app.domain.com/public_html/vendor/laravel/framework/src/Illuminate/Exception/SymfonyDisplayer.php on line 6
Here's SymphonyDisplayer.php's line 6:
class SymfonyDisplayer implements ExceptionDisplayerInterface {
It says that there's no ExceptionDisplayerInterface. However, it's right next to this file, in the same directory. ExceptionDisplayerInterface.php is in Exception folder with SymphonyDisplayer.php
Here's my composer install output:
>>composer install
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- jeremeamia/SuperClosure 1.0.1 requires nikic/php-parser ~0.9 -> no matching package found.
- jeremeamia/SuperClosure 1.0.1 requires nikic/php-parser ~0.9 -> no matching package found.
- Installation request for jeremeamia/superclosure 1.0.1 -> satisfiable by jeremeamia/SuperClosure[1.0.1].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Here's a new error after executing composer update:
Fatal error: Interface 'Whoops\Handler\HandlerInterface' not found in /var/www/test-app.domain.com/public_html/vendor/filp/whoops/src/Whoops/Handler/Handler.php on line 17
Here's some more outputs while trying to figure out the problem:
>>composer diagnose
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: OK
Checking composer.json: OK
Checking disk free space: OK
Checking composer version: OK
>>composer self-update
You are already using composer version 0d4c2bb7d7a864a9b3e876908e743310cdeaa5e6.
Phew. I fixed it.
Here's how I did it, if anyone else sees this type of error message:
rm -rf vendor && composer update -v
I guess my vendor directory went nuts while I was doing some stuff with SFTP yesterday.
Thanks everyone.
I'm trying to create thumbnails with Avalanche-imagine bundle. I'm using OS X 10.7 Lion and MAMP PRO as Apache server.
When I call the filter in the twig file, I get a 500 error.
Here I put the path manually to check it:
<img src='{{'store/images/Pictures/P1000665.JPG' | apply_filter('my_thumb')}}'>
And I get this message:
GET
http://taller:8888/web/app_dev.php/media/cache/my_thumb/store/images/Pictures/P1000665.JPG 500
(Internal Server Error)
line 35, it's strange because my thumbnails are used far behind
I installed the bundle following this instructions: https://github.com/avalanche123/AvalancheImagineBundle
I have to say that I had several problems installing it because composer.phar gave me an error message:
"Problem 1
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- symfony/icu v1.2.0 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
- Installation request for symfony/icu 1.2.* -> satisfiable by symfony/icu[v1.2.0]."
I solved it adding this line in the composer.json requirements:
"symfony/icu": "1.0.*",
Once installed, I could install the AvalancheImageBundle with the composer.
Then I changed AppKernel as they said in the instruction with this line:
new Avalanche\Bundle\ImagineBundle\AvalancheImagineBundle(),
but I didn't change the autoload file, as I had to do when I installed FOSUserBundle. Do I have to add anything there?
I tried with this, but it didn't solved my problem:
$loader->add('imagine', __DIR__.'/../vendor/imagine/imagine/lib');
$loader->add('Avalanche123', __DIR__.'/../vendor'):
Additional info:
My proyect is in: Symfony2/proyecto/taller/here_are_web_app_vendor_and_src
My apache server aim to: Symfony2/proyecto/taller using the sortcut taller instead of localhost my url is like this:
http://taller:8888/web/app_dev.php/
My pictures are in the url: Symfony2/proyecto/taller/web/store/images/Pictures/test.jpg
witch url should I give to the filter? I think it is store/images/Pictures/test.jpg
The problem could be in the dependences of the bundle, because I put that line the composer.json?
Maybe should I write something in the autoload file? Any reference to vendor/imagine miss?
Also I tried to install liipImagine bundle, but I couldn't because it said that I had installed imagine 0.3.0 and I needed imagine 0.4.0. How can I uninstall imagine and install the new version to run liipimaginebudle?
appKernel:
As you can see, no references to imagine (I guess its integer in Avalanchebundle)
autoload:
(no references to avalanche?)
Here is where my pictures are located and you can see how Avalanche created the media folder:
This is my vendor file:
I don't know where is the problem, this is why I put so many information.
I solved the problem using LiipImagineBundle.
To install it first I deleted Avalanche reference in composer.json and everything else I wrote in appKernel.php, etc.
Then I did composer.phar update and it deleted also imagine/imagine 0.3.0 vendor library. Finally I installed LiipImagine via composer normally that installed a newer version of imagine/imagine, 0.4.0.