when i run the following command in cygwin terminal
$ php -r "readfile('https://getcomposer.org/installer');" | php
!/usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The json extension is missing.
Install it or recompile php without --disable-json
The phar extension is missing.
Install it or recompile php without --disable-phar
The ctype extension is missing.
Install it or recompile php without --disable-ctype
above error facing , how to solve it, more i have already install xampp, composer_setup.exe , but i want to run composer with cygwin terminal. how to run it ?
A bit too late, but you can try to:
Copy composer.phar to cygwin/usr/bin
Create a new composer.bat file with:
#ECHO OFF
php "%~dp0composer.phar" %*
Then restart cygwin and retry
Additionaly, this can help:
Cygwin/Gitbash + composer = unknown command
Related
been struggling to figure out why my install of php 7.3 is not being recognized.
I ran the following command in the terminal:
curl -s https://php-osx.liip.ch/install.sh | bash -s 7.3
I get a success message, but then when I try to verify the version, it says PHP 7.1.
I have updated my .bash_profile with the following:
export PATH=/usr/local/php5/bin:$PATH
Even after updating the path, I still get PHP 7.1 when I run php -v.
Any help would be greatly appreciated.
Try to replace "php5" with "php7" or "php" from your PATH
Remember to open new bash session (or source your profile source .bash_profile) after you changed PATH value from your .bash_profile
I am a new programmer and I need your help.
I'm pretty much new to Atom editor, but setup some nice packages like Atom Beautify. After using it in a html / php file I'm getting the error "Could not find 'php-cs-fixer' . The program may not be installed. The strange thing is, I did install the package php-cs-fixer but nothing happens.
My system is Windows.
Anyone got an idea how I can fix this?
You must have installed "php" usually when installing the Wamp or Xampp servers are installed by default.
Download the file "php-cs-fixer.phar" https://github.com/FriendsOfPHP/PHP-CS-Fixer
In the CMD execute this command: php where.exe
You get a path, that path copy in: Open Atom Packages / Atom Beautify / Settings / Executables / PHP
In the same folder where the php.exe is located copy the file "php-cs-fixer.phar"
Redo the previous process with the CMD and the Atom in PHP-CS-Fixer "
Just run this command in terminal, then it will work perfectly:
$ composer global require friendsofphp/php-cs-fixer
Everything will be fixed!
I am not sure about in Windows, but on Mac and Linux, I do the following. You may be able to do this with Git Bash in Windows.
Install php-cs-fixer with Homebrew (via PHP-CS-Fixer Instructions)
brew install php-cs-fixer
Confirm php-cs-fixer was installed
which php-cs-fixer
its because you need to install php cs fixer, the atom extension is trying to use it but its not currently installed on your system, install it here:
https://github.com/FriendsOfPHP/PHP-CS-Fixer
I suggest you install manually the php-cs-fixer using the following steps:
You can use yum, apt, and other methods of installing a software or a .exe for windows
Get the path to the installed binary, for example for me i checked using whereis php-cs-fixer and I got /usr/bin/php-cs-fixer
Go to Packages > Atom Beautify > Settings > Executables > PHP-CS-FIXER then in the Binary/Script Path give the path of the php-cs-fixer above (/usr/bin/php-cs-fixer)
Enjoy beautify.
The issue for me was originally installing with composer. Composer does not put a .phar file into the /bin folder.
Download the .phar file (https://github.com/FriendsOfPHP/PHP-CS-Fixer#locally) and place it somewhere explicitly, then put that location in settings->executables->PHP-CS-Fixer path
The manual way did work for me and this how I went about it;
I download php-cs-fixer manually.
$ wget https://cs.symfony.com/download/php-cs-fixer-v3.phar -O php-cs-fixer
or with curl
$ curl -L https://cs.symfony.com/download/php-cs-fixer-v3.phar -o php-cs-fixer
Then I fixed the rights and moved it to the right directory.
$ sudo chmod a+x php-cs-fixer
$ sudo mv php-cs-fixer /usr/local/bin/php-cs-fixer
Finally, I ran php-cs-fixer and it worked.
full link
make an empty folder somewhere. example: C:\Programs\php-cs-fixer
run composer require friendsofphp/php-cs-fixer
open atom and go to
settings -> packages -> atom beautify -> settings -> executables ->
php cs fixer input the path there:
C:\Programs\php-cs-fixer\vendor\bin\php-cs-fixer.bat
optionally:
add C:\Programs\php-cs-fixer\vendor\bin to windows env path so you
can use it from cli
I can't run composer install because my php's version on my OS is not enough updated (5.5.36). So i tried to install composer globally with my MAMP's php(5.6.10)
1) I create alias for my MAMP's php
nano ~/.bash_profile
alias phpmamp='/Applications/MAMP/bin/php/php5.6.10/bin/php'
2) Run this line to install composer
curl -sS https://getcomposer.org/installer | phpmamp
3) Run this line to move composer
sudo mv composer.phar /usr/local/bin/composer
Composer is installed (run composer on terminal works)
This is a the tutorial.
But when i want to run composer install, composer uses my OS php.
Any idea ?
Those lines worked for me. I override the OS PHP path to my MAMP PHP path.
PHP_VERSION=`ls /Applications/MAMP/bin/php/ | sort -n | tail -1`
$ export PATH=/Applications/MAMP/bin/php/${PHP_VERSION}/bin:$PATH
$ source ~/.bash_profile
You can check the version by running :
$ which php
The complete solution
Thanks to #Andrew Patton
This is an old question, but it came up in web search for a similar issue I was having, and the latest version of MAMP Pro (mine is 6.6.2) has a GUI solution:
In Languages > PHP, under 'Default version', you should see a checkbox for "Also activate shortcut for Composer".
What this did for me is add an alias of composer=/Applications/MAMP/bin/php/composer (in my zshell ~/.profile file on macOS Monterey). Maybe yours works similarly.
Of course, when switching PHP versions, it wouldn't also switch composer versions (which is necessary when switching between PHP 5 and 7.2.5+), so I have to use the OS install for one version and MAMP's for another. A little tricky, but if you don't have this problem, then the alias will be fine.
I'm bit of a newb in macOS and I'm struggling to install composer on my macOS system. Whenever I try to execute
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
in my terminal from here, I'm getting this
error.
I tried to ask google, but there was no success for me.
If you can help me with this I would be very grateful. Also sorry for my english, I'm not a native speaker.
Download the composer phar from directly https://getcomposer.org/download/1.2.1/composer.phar and now just run php composer.phar in order to run Composer.
If you want it globally ,follow the link https://getcomposer.org/doc/00-intro.md#globally
mv composer.phar /usr/local/bin/composer
Note: If the above fails due to permissions, you may need to run it
again with sudo.
Note: On some versions of OSX the /usr directory does not exist by
default. If you receive the error "/usr/local/bin/composer: No such
file or directory" then you must create the directory manually before
proceeding: mkdir -p /usr/local/bin.
Now just run composer in order to run Composer instead of php composer.phar.
I am trying to run a php file on a ubuntu linux server but get a 'command not found' error when i run "php file_name.php"
Searching online, i found an article that suggested I run "sudo aptitude install php5-cli" which I did and restarted apache afterwards but I still get this error.
How do I fix this?
Try this once,
Go to terminal.
whereis php
It will show where is php installed.
Export that path to environment variable using following command
export PATH=$PATH;/path/to/php's/bin directory
Then execute required file..
As follows,
php file_to_execute.php
first make sure that you've installed following packs:
php5
php5-cli
php-pear
like this:
sudo apt-get install php5 php5-cli php-pear
then make sure to configure php safely befor using it.
also make your php file executable ( chmod 700 )
Try the following step :
Open your cmd/console or press ctr+alt+t.
php5 /your/path/to/php_file_name.