Welcome Guest, Not a member yet? Register   Sign In
OK, here we go again: installing using composer?
#1

(This post was last modified: 09-03-2020, 03:02 AM by blaasvaer.)

I'm starting all over from scratch with CI4 to get my head around it – as it seems trying to do things the way you used to in CI3 is not going to cut it – in ANY way.



And we start off just fine by being kicked in the balls when just trying to install the bugger; using composer.



If I run:

Code:
$ composer create-project codeitniter4/appstarter CI4


I get this:



Code:
Could not open input file: /usr/local/bin/composer.phar


I then try to figure out what could possibly be wrong with composer by doing this:



Code:
$ composer --version


I then get:



Code:
-bash: /usr/local/bin/composer.phar: No such file or directory


I then try this:



Code:
$ which composer


and get this:



Code:
/usr/local/bin/composer


So, what did I miss in the process of just getting started? Oh boy, it's a long way to home.


So, it turned out that the composer symlink in '/usr/bin/local' didn't have the .phar extension which 'something' obviously asks for when running the '$ composer' command.



Adding it made SOME progress.



Now, I'm facing this issue:



Code:
$ composer create-project codeigniter4/appstarter CI4
Creating a "codeigniter4/appstarter" project at "./CI4"
Installing codeigniter4/appstarter (v4.0.4)
  - Installing codeigniter4/appstarter (v4.0.4): Downloading (100%)        
Created project in /usr/local/bin/CI4
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
    - codeigniter4/framework v4.0.4 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - codeigniter4/framework v4.0.3 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - codeigniter4/framework v4.0.2 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - codeigniter4/framework v4.0.1 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - codeigniter4/framework 4.0.0 requires ext-intl * -> the requested PHP extension intl is missing from your system.
    - Installation request for codeigniter4/framework ^4 -> satisfiable by codeigniter4/framework[4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4].


So, I guess I'm having some issue with what 'php' I'm actually using ... I've got MAMP installed, so I could potentially have some issue here.



Let's move on, shall we?

Running this:

Code:
$ php --version

return this:
Code:
PHP 7.3.11 (cli) (built: Jul  5 2020 03:23:39) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

And I can see in my MAMP settings, that the version allegedly running there is 7.4.2 ... so.

The task here is; to make composer, codeigniter 4 and all other crap that needs php to run point to the right version of php, I guess. OK, let's try to do that then, shall we?

So, after a nice session over at stackoverflow.com I ended up doing this, added the following to my .bash_profile (yes, I know I'm supposed to be running zsh, but there's only so much 'crap' one can take on a one time):

PHP Code:
export PATH="/Applications/MAMP/bin/php/php7.4.2/bin:${PATH}"

So, apart from getting another bone thrown to fetch:

Code:
Package phpunit/php-token-stream is abandoned, you should avoid using it. No replacement was suggested.

Thanks for letting me know, by the way, the installation ran smoothly(!).

Now, on to actually do something in CI4. Phew.

To be continued …
Reply
#2

(This post was last modified: 09-03-2020, 04:25 AM by InsiteFX.)

the requested PHP extension intl is missing from your system.

You need to remove the ; (semi-colon) form the extension in the php.ini file.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

Maybe, but I chose to point to the right PHP version instead ...
Reply
#4

(This post was last modified: 09-04-2020, 06:32 AM by captain-sensible.)

i don't know if this is superfluous but the way i use composer on LINUX is to download composer.phar

then I :
Code:
# chmod 777 composer.phar

# mv composer.phar  /usr/local/bin/composer

that means that the use of composer.phar is now used linked to "composer" by quoting just composer
and its now accessible to use as normal user not root

eg

$ composer update --no-dev

Also looking at your post it says Created project in /usr/local/bin/CI4
i haven't read all the posts above through obviously being a slackware user ( i'm a lazy slacker)
but i think you alluded thats not a good place .

As i have shown above by making it permission 777 and in /usr/local...you can invoke composer and "$" normal user. For anything , if i understood your post correctly, by the fact it started stuff in /usr/local i'm guessing you were
running composer as "root" which is not necessary.


The appstarter is a good choice i find then i only get one copy of CI4 all within vendor.
Reply
#5

I'm on Windows 10 Pro x64 and I installed Composer global works like a charm here.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#6

(This post was last modified: 09-05-2020, 09:09 AM by captain-sensible.)

(09-04-2020, 08:23 AM)InsiteFX Wrote: I'm on Windows 10 Pro x64 and I installed Composer global works like a charm here.
there are quirks with Linux; i have no problem  with composer but since we mentioned it and the O.P is obviously on linux here is another quirk :

You are developing a CI4 " appstarter"  website in apache of your Linux box so your path to web is say /var/www/htdocs/CI4.0.4

"you" as in me or anyone like's  appstarter since the directory system is neat and when you want anything such as bootstrap IV  using composer eg : composer require twbs/bootstrap it gets put in "vendor"

here is the problem  /var/www/htdocs  is not  accessible to  a "normal"  user because  its considered part of the Linux system path (just like /opt is for xampp)  you have  a composer.json file in /var/www/htdocs/CI4.0.4 can't run it as normal user and its not a good idea to run as "root"  since strange things can happen and you could mess up your system.  The answer  is to look at who owns "apache" in terms of  permissions  and add yourself  to the group
of who owns "apache" and then
Code:
# chmod 775 /var/www/htdocs/CI4.0.4  -R
 


that will allow you to run composer in  /var/www/htdocs/CI4.0.4  with normal user permissions( and have not found it messes up runing apche for dev so far.
by
Code:
cd /var/www/htdocs/CI4.0.4

$ composer require composer require twbs/bootstrap
$ composer update --no-dev
I did write a piece of web development on slackware linux using CI4 as an example if anyone is interested or would like to highlight erros
Reply




Theme © iAndrew 2016 - Forum software by © MyBB