Symfony Process error when running composer Laravel 8 - php

suddenly in my project with laravel 8 I ran composer to uninstall a dependency that I want to reinstall for a sense nothing more than order and start from scratch and I started to throw this error that has to do with Symfony Process:
PHP Fatal error: Uncaught TypeError: fclose (): Argument # 1 ($ stream) must be of type resource, bool given in phar: // C: /ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/process/ Pipes / WindowsPipes.php: 71
What can be the mistake? I read something like that has to do with the update of the symfony Process but I don't know why. The only thing I did was install Laravel / Passport for the use of token in the user login.

Whilst running PHP 8 on Windows I too had this error. I tried to clear out the temp directory manually per Composer loading from cache - when that didn't work. I also found that composer's symfony usage had locked a temp file in an odd way.
I needed to clear the temp file, and I used filelocker to unlock it, easily enough. Once I had unlocked and deleted the file, I was able to run composer as expected again.
Here is a related stack overflow question about the temp file location: Composer install: error on temporary file (%USERPROFILE%\AppData\Local\Temp works for me)
They have names like 'sf_proc_00.err'. I found them easily by sorting the temp files by date, and only trying to remove the ones modified today.
A reboot, or identifying the symfony process tying up the temp file would also work. According to file locked - it was an instance of mingw git for me.

Related

curl error 28 for composer update/install laravel

i searched several sites, several topics in stackoverflow tried several ways to solve it
reinstalled composer
reinstalled xampp
changed IPv6 to IPv4 -> temporary resolved it
tried on another pc -> same network
i took my github token saved it in composer.json and got another error
used vpn as suggested
i cloned laravel in github but when i need update its composer "autoload", i still get same error on randomized subjects sometimes laravel/symfony and so on..
i tried changing php.ini according to Fileinfo not working in Xampp v3.2.1 [duplicate] : first of all there was no ";extension=php_fileinfo.dll" instead i found extension=fileinfo which itself wasnt commented
for its timeout i changed extention_max from 120 to 360 // my ram is 16
im in an online php boot-camp no one else have same error and no one couldnt help me when i asked for help
i am ready to provide more info , maybe i tried a good way in a wrong manner
appreciate.
- Downloading laravel/sail (v1.16.2)
Failed to download symfony/http-foundation from dist: curl error 28 while downloading https://api.github.com/repos/symfony/http-foundation/zipball/90f5d9726942db69490fe467a3acb5e7154fd555: Operation timed out after 10008 milliseconds with 0 out of 0 bytes received
Now trying to download from source
- Syncing symfony/http-foundation (v6.1.5) into cache
Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+Mom+2022-10-06+2353 to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+Mom+2022-10-06+2353
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "C:/Users/whowe/AppData/Roaming/Composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden):
new tries:
as suggested by mr. NicoHaase i reviewed IPv6 Section
the result was as below:
Downloading laravel/laravel (v9.3.8)
Failed to download laravel/laravel from dist: curl error 28 while downloading api.github.com/repos/laravel/laravel/zipball/…:
Operation timed out after 10005 milliseconds with 0 out of 0 bytes
received Now trying to download from source
(i can take screenshot of every step i made)
all limits lifted my problem sloved by itself
but i think the lost answer was about the proxy (31/10/2022)
Use proxy!
if you are in linux:
export http_proxy='your_proxy'
export https_proxy='your_proxy'
then use composer command
If using socks5:
export http_proxy=socks5://ip:port https_proxy=socks5://ip:port
then use composer command.
I guess you're iranian as same as I am

Symfony messenger can't consume messages

Few weeks ago I set up a Message system with Symfony Messenger and it worked great.
Today I wanted to create new object through message, so I went to my server and type the command to consume message
First I had this result
$ bin/console messenger:consume-messages amqp_notifications
/usr/bin/env: ‘php\r’: No such file or directory
It never happened before with my files, and I never changed the line ending or encoding of my file sin PHPstorm.
I tried to use $ php bin/console messenger:consume-messages amqp_notifications
but then I had this error.
Attempted to load class "AMQPConnection" from the global namespace.
Did you forget a "use" statement?
Pretty weird, because I have have the php-amqp ext installed as you can see on the screenshot of my phpinfo
I didn't change anything in my Message class or Handler.
Also, I tried to call new AMQPConnection() on a random action, just to try, and I didn't get the error.
I'm completely lost with this error this time, as everything is installed.
I use PHP 7.3.1 and symfony Messenger 4.2.2
It seems your second issue was already solved by ccKep on his comment.
The first one is that the specific shebang line #!/usr/bin/env php executes the first php found in the $PATH. So if you already have uninstalled it, which seems the case, or it has a symbolic link to another php version, you can get a wrong result.
Tries to check what is inside the $PATH and replace the PHP path for the correct one. You might get the place running which php.

Multiple issues during Sylius installation

im trying to install Sylius with composer for an e commerce project however i just cant get it done..i follow the docs but i always get an other error when i fix one.
already fixed some errors eg. incl extension exception, paypal bundle renaming issues on git and memory size problem.
Now where im stuck:
When i fill the parameters with the interactive script
if i give any password for the database i get this:
Doctrine\DBAL\Driver\PDOException
Acces denied for user 'root'#localhost
if i dont give password then i get this:
Doctrine\DBAL\Driver\PDOException
SQLSTATE[HY000]Unknown database databasename_dev (it appends _dev prefix)
then in both cases it ends up with this: RunTimeException
An error occured when executing the ""cache:clear --no-warmup"" command
and the proccess is terminated with this exception..
i tried if i could continue with the $ cd acme
$ php app/console sylius:install commands but:
if i gave a password then get acces denied Doctrine\DBAL\Exception\ConnectionException
if didnt then Doctrine\DBAL\Driver\PDOException
SQLSTATE[HY000]Unknown database databasename_dev
i created the database manually which seems to solve the problem however get this: General error: 1007 cant create database databasename_dev; database exists
(i dont think this solution is the right one)
but after this it doesnt terminate yet and creates the database schema and then after some installation it terminates with this:
RuntimeException
The source file "C:\Users\user\acme\app/../web/bundles/cmfcreate/vendor/create/themes/midgard-tags/tags.css" does not exists
i checked the page if it may useable but got twig exception that currency not found and many components are missing from the page..
What's your workspace?
If you work on Windows with WAMP I'll give you some things to check :
set the database port to : 3306
create a new user for the database, juste for your sylius project
when you run create-project commande, in databaseport write : localhost
I hope it helps you.

How to successfully migrate a Zend Framework 1 application from CloudControl Luigi to Pinky stack?

The easy part...
Usually when migrating a ZF1 application from built-in auto-loading to composer based auto-loading (which is strongly recommended for deploying on CloudControls Pinky stack) you just need to take some simple steps:
Create a composer.json file and require Zend Framework (e.g. latest release from version 1.12) with:
{
"require" : {
"zendframework/zendframework1" : "1.12.*"
}
}
Install composer dependencies via CLI with:
composer install
Update your .gitignore file and add:
vendor/*
Recursively delete current ZF folder from your library path (e.g. ./library):
rm -r library/Zend
Include composer autoloader in your index.php before any usage of Zend_ classes by adding:
$loader = include 'vendor/autoload.php';
Remove every now obsolete ZF related require or require_once statements from your index.php - e.g. this is not needed anymore:
require_once 'Zend/Application.php';
Once you are done with the above changes you commit and push via git as normal and then you deploy the new version on CloudControl via CLI (where APP_NAME and DEP_NAME here refer to your app and deployment names):
cctrlapp APP_NAME/DEP_NAME deploy
You will notice that cctrlapp prints out some information about resolving composer dependencies and finally initiates the deployment of the new version. To check whether it is done you can run:
cctrlapp APP_NAME/DEP_NAME log deploy
Ok, deployment log looks fine – nice – let's open the browser!
What the f***! Internal server error? Why?? Everything worked well with the local LA(M)P stack!!!
The tricky part...
Fortunately CloudControl gives us access to the error logs as well ...
cctrlapp APP_NAME/DEP_NAME log error
Shouldn't be too hard to find out what's wrong here.
But ... err ...
8/1/14 5:23 AM error [error] [client ] FastCGI: incomplete headers (0 bytes) received from server "/app/php/box/php-fpm"
8/1/14 5:23 AM error [error] [client ] (104)Connection reset by peer: FastCGI: comm with server "/app/php/box/php-fpm" aborted: read failed
As the above error messages are not helpful at all we first need to track down this very bug. And this can indeed be tricky! We can google a bit. We can try something. We can then redeploy. We can google a bit more. We can try another thing. We can then redeploy again. We can google another time. We can try out every other thing. We can ... but do we want?
Luckily the Pinky stack offers another way to speed things up (which Luigi does not all). While it still incorporates cumbersome manual debugging at least we can save some time – go to your CLI and execute:
cctrlapp APP_NAME/DEP_NAME run bash
CloudControl now instantiates a new container for us and gives us SSH based shell access to it. As the documentation says everything should be as it is inside our deployment boxes:
The distributed nature of the cloudControl platform means it's not
possible to SSH into the actual server. Instead, we offer the run
command, that allows you to launch a new container and connect to that
via SSH.
The container is identical to the web or worker containers but starts
an SSH daemon instead of one of the Procfile commands. It's based on
the same stack image and deployment image and does also provides the
Add-on credentials.
Let's see if we can find out more (from inside the container):
cd code/public
php index.php
Hmm ... nothing reported here ... and ... nothing reported at the logs?! What the hell?!!
So, there seems to be a difference between the web and the run containers – and there is!
To find this out I started by editing the index.php right away:
vi index.php
And after a while I finally got to reproduce at least another error:
8/1/14 8:55 AM error [error] [client ] FastCGI: server "/app/php/box/php-fpm" stderr: PHP message: PHP Fatal error: require_once(): Failed opening required '' (include_path='/srv/www/code/vendor/zendframework/zendframework1/library:/srv/www/code/library:.:/usr/share/php') in /srv/www/code/vendor/zendframework/zendframework1/library/Zend/ ...
8/1/14 8:55 AM error [error] [client ] FastCGI: server "/app/php/box/php-fpm" stderr: PHP message: PHP Warning: require_once(/srv/www/code/vendor/zendframework/zendframework1/library): failed to open stream: No such file or directory in /srv/www/code/vendor/zendframework/zendframework1/library/Zend/ ...
Looks like some file is missing – maybe related to auto-loading – shouldn't be too hard to fix it.
But wait, what's that: Failed opening required ''? Sure you fail to require nothing you stupid code you!!
Well ... when looking at the respective ZF library files you won't find anything wrong there. The include paths seem to be correct as well – and yes, the files are present – composer managed both things correctly.
It's a PHP bug!
To be more precise it is a bug with PECL APC which affects Pinky's current versions of PHP 5.4.30 / APC 3.1.13 - see:
https://bugs.php.net/bug.php?id=62398
And that's exactly the difference between the run and the web containers as php.ini option apc.stat is set to 0 (off) for the web containers and 1 (on) for the run container.
tl;dr
Clone the CloudControl Pinky PHP buildpack from GitHub:
git clone https://github.com/cloudControl/buildpack-php.git
Copy all files from this repository and add them to your project root folder at:
.buildpack/php
Edit .buildpack/php/conf/php.ini and set:
apc.stat = 1
Commit, push, deploy and enjoy!
Notes:
Keep in mind that this is just a workaround as APC stat does not need to be activated in such an environment (where the stack is recreated on deploy) and it slows down execution. See the PHP docs:
On a production server where the script files rarely change, a
significant performance boost can be achieved by disabled stats.
Thanks:
Finally I'd like to thank Dimitris and Mateusz from CloudControl for general advises – though I need to find out on my own what was going on here. Furthermore I want to thank #BullfrogBlues and #Thierry_Marianne here at Stack Overflow who tried to answer another questioners thread dating back to November last year, which finally pointed me to look for APC related issues.

How can I use the newly revamped Dropbox-PHP API?

I would like to use the Dropbox-PHP API that has recently come under development again. It is located here: http://code.google.com/p/dropbox-php/
I did cloned it with hg clone https://dropbox-php.googlecode.com/hg/ dropbox-php and I get this file structure:
Dropbox/API.php
Dropbox/autoload.php
Dropbox/Exception/Forbidden.php
Dropbox/Exception/NotFound.php
Dropbox/Exception/OverQuota.php
Dropbox/Exception/RequestToken.php
Dropbox/Exception.php
Dropbox/OAuth/PEAR.php
Dropbox/OAuth/PHP.php
Dropbox/OAuth/Zend.php
Dropbox/OAuth.php
examples/accountinfo.php
examples/createaccount.php
examples/download_image.php
examples/getmetadata.php
examples/oauth_workflow.php
examples/uploading.php
But I get this error when trying to run accountinfo.php (or example):
Warning: include(Dropbox/autoload.php) [function.include]: failed to open stream
No such file or directory in dropbox-api/examples/accountinfo.php on line 7
Right, so then I move the Dropbox folder inside of where all the example files are and still get an error message:
Fatal error: Uncaught exception 'Dropbox_Exception' with message 'The OAuth class
could not be found! Did you install and enable the oauth extension?' in
examples/Dropbox/OAuth/PHP.php:36 Stack trace: #0 examples/accountinfo.php(9):
Dropbox_OAuth_PHP->__construct('', '') #1 {main} thrown in
examples/Dropbox/OAuth/PHP.php on line 36
So I'm obviously not doing something right but I have no idea what.
Also saw on the site where it has instructions on installing:
pear channel-discover pear.dropbox-php.com
pear install dropbox-php/Dropbox-alpha
I ran those two commands and it still won't work. I don't usually have any problems coding in PHP but the lack of documentation is a little frustrating.
Update
As noted in the accepted answer below my main problem was not having oAuth installed on the system. I'm running OS X 10.6 - if someone can provide some clear and easy instructions on how to build / install this to work with XAMPP / PHP 5.3 I will accept your answer. I've tried the articles online about using homebrew and such but these are flaky and do not seem to work for me. Guessing I will have to build / install it from scratch.
The Dropbox folder needs to be inside one of the folders in your include_path.
Edit:
Also oauth needs to be "installed" on the system and included in php.ini (when you do phpinfo() oAuth should show up as a module). then things should work.

Categories