First off: I'm very familiar with Composer and also Symfony and some other MVC frameworks.
I tried the following installation documentation, but I'm stuck on how to properly install a laravel project as "apache:apache" under "/var/www/html" on a CentOS 6 virtual machine.
I ran the composer global require "laravel/installer" command, and it says to put "~/.composer/vendor/bin" in your PATH. So I presume this command (laravel install) is done as a normal user (not root), and the folder will exist in your home directory when run.
I added to my path by editing my /etc/profile to include this. But when I try to run laravel new laraveltest in the /var/www/html folder (owned by apache), I get:
[abunk#Alvin-CentOS6 html]$ laravel new laraveltest
Crafting application...
PHP Warning: file_put_contents(/var/www/html/laravel_572e877d514bacbb7381860b8307a067.zip): failed to open stream: Permission denied in /tmp/.composer/vendor/laravel/installer/src/NewCommand.php on line 122
PHP Warning: ZipArchive::extractTo(): Permission denied in /tmp/.composer/vendor/laravel/installer/src/NewCommand.php on line 140
PHP Warning: ZipArchive::close(): Invalid or uninitialized Zip object in /tmp/.composer/vendor/laravel/installer/src/NewCommand.php on line 142
Composer could not find a composer.json file in /var/www/html
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Application ready! Build something amazing.
So then I copied the folder /home/abunk/.composer to /tmp/.composer; and then I ran su -s /bin/sh apache -c "laravel new laraveltest" from the /var/www/html folder (this should run as apache).
But instead I get this:
[abunk#Alvin-CentOS6 html]$ su -s /bin/sh apache -c "laravel new laraveltest"
Password:
Crafting application...
PHP Warning: proc_open(/dev/tty): failed to open stream: No such device or address in /tmp/.composer/vendor/symfony/process/Process.php on line 290
[Symfony\Component\Process\Exception\RuntimeException]
Unable to launch a new process.
new [--dev] [--] []
So my question is (or maybe this is really a bug): How do install as the apache user? Any recommendations?
I could do this as root user, but I think it's a bad idea to run Composer as root user.
Related
What i have tried:
1) Install php7.2
2) Install Composer
3) run command composer global require "laravel/installer"
But when i run laravel new blog the output error is the following:
The provided cwd does not exist.
The provided cwd does not exist means that the Current Working Directory does not exist which means that laravel new command was unable to create the directory 'blog' because you do not have the permission to do so.
What you can do is to change the permissions for that directory, so the command is able to create the working directory
I successfully installed Composer and Laravel in my shared hosting.
Then when I want to create a new Laravel project
laravel new myproject
It gives me
Crafting application...
Could not open input file: composer.phar
Application ready! Build something amazing.
Based on internet research, I edited my .bash_profile and added
alias composer="php ~/composer.phar"
then I run
source .bash_profile
Now I can type composer in the command prompt successfully.
But I still receive the same error when I run laravel new myproject
I don't have access to move the composer.phar to /usr/local/bin
I have been strugling to create an application with laravel installer from terminal.
I have globally installed composer and laravel..
however i constantly get this error:
If you check at the bottom of the screenshot you can see -bash: new: command not found however laravel command is being executed perfectly. My osx version is 10.10.2. Macbook pro.
Any help will be appreciated.
Another question (bit out of the topic)
Is git inbuild in mac osx?
Cuz i hadn't installed it but it shows all of its commands.
Regards,
=======================
I created alias for composer and laravel in .bash_profile and .bashrc and it worked however now I'm getting this error :
Prajwols-MacBook-Pro:htdocs prajwol$ laravel new test
Crafting application...
Warning: ZipArchive::extractTo(): Invalid or unitialized Zip object in /Users/prajwol/.composer/vendor/laravel/installer/src/NewCommand.php on line 99
Warning: ZipArchive::close(): Invalid or unitialized Zip object in /Users/prajwol/.composer/vendor/laravel/installer/src/NewCommand.php on line 101
Application ready! Build something amazing.
Result : An empty folder is created called test in destination folder.
The command needs a project name: laravel new <NAME>. Like laravel new blog. This will create a new laravel project in a new blog directory in the current path.
$ brew tap homebrew/homebrew-php
$ brew install php72
Install composer
$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
$ php composer-setup.php --install-dir=/usr/local/bin --filename=composer
Install Laravel
$ composer global require "laravel/installer"
$ composer global -vvv require "laravel/installer"
now run command
composer
I am new in Ubuntu and try to migrate a laravel app to ubuntu.
Please take a look at below steps done.
1.Copied my laravel project and upload database.
2.Started my Xampp server and pointed my laravel app in browser, it showing error like.
Warning: require(/opt/lampp/htdocs/timegear/bootstrap/../vendor/autoload.php): failed to open stream: Permission denied in /opt/lampp/htdocs/timegear/bootstrap/autoload.php on line 17
Fatal error: require(): Failed opening required '/opt/lampp/htdocs/timegear/bootstrap/../vendor/autoload.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/timegear/bootstrap/autoload.php on line 17
When trying to update the composer with terminal throwing error like Mcrypt extension is required.
Please give me a solution for it.
Thanks and Regards.
You are missing the Mcrypt extension, to install:
sudo apt-get install php5-mcrypt
Then:
sudo updatedb && locate mcrypt.ini
Should show it located at /etc/php5/mods-available
locate mcrypt.so
Then edit mcrypt.ini with
chang thextension=mcrypt.so to extension=/usr/lib/php5/20121212/mcrypt.so (or whatever is the location of your mcrypt.so.
Next, create the symbol links
ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini
ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini
and finally, restart apache
service apache2 restart
Hope this helps.
Install the mcrypt PHP extension.
I have successfully installed Composer in the root directory (that was the default choice) on my Linux/Apache server using their installation guide. It's all been very simple so far, except for one php.ini tweak I've had to make (detect_unicode = Off) but now I'm stuck.
I'm trying to install Ratchet using Composer, with the use of this guide:
http://socketo.me/docs/install
It says I need to "create a file called composer.json in your project folder". So I created that file (with the contents they gave on their page) using the cPanel file manager, in my application's root directory. However, when I run Composer using:
php composer.phar install
PuTTy gives the following error message:
Composer could not find a composer.json file in /root
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
But this doesn't seem to make sense, why would I place the JSON file in the server's root if the documentation says to place it in the project folder? What am I missing?
I just found on other topic that you can use :
php composer.phar --working-dir=/home/user/folder/ update
It looks like you're executing php composer.phar install in /root path.