Reputation: 1543
I've created a new Linode server and installed a LAMP stack. Now I'm trying to install a PHP extra library, for Stripe. Rather than installing the libraries manually, I'm attempting to install them using composer, which was suggested.
I did install composer on my Ubuntu 16.0.4 system. And PHP is running; I can go to a test .php file and see it work.
In the provided instructions it says to add the following to composer.json:
{
"require": {
"stripe/stripe-php": "4.*"
}
}
Presumably after that I execute
composer install
and it will use composer.json to install the specified libraries.
What I'm not clear about is where should the location of composer.json be when I do this?
From what I've read in my Google searches, all I've found so far is that it should be in "the project root."
I'm not sure what that means.
I've set up Apache. And I have an enabled site. And I know the root of that site. But I don't think I am supposed to install the PHP library there in the html root of my virtual server, am I? Isn't there some general place on the server I would install extra PHP libraries so they are generally available? Perhaps some PHP-related directory?
Any suggestions? Thanks.
Upvotes: 0
Views: 1173
Reputation: 314
The project root in this case is the first layer of your code structure. Normally you would structure your code so that you have application code which you don't want the public to access such as classes at this level. You then have a public directory where you put your html/php, css, images and index.php.
This way the webserver root (www.mywebsite.com) points at index.php and the user cannot traverse up to see the classes.
Upvotes: 3