Change vagrant php starting version - php

I'm developing laravel app on homestead latest version.
I needed to add ImageMagick, as you know newest homestead is running on php7.0 but imagemagick is compatible so far with php5. So when I was installing it like this
vagrant ssh
sudo apt-get update
sudo apt-get install imagemagick
sudo apt-get install php5-imagick
I also needed to call sudo apt-get install phpapi-20121212 because it's dependancy for php5-imagick
now... everytime when I provision vagrant I have to go to
/etc/nginx/sites-enabled/myproject.app
and change fastcgi_pass unix: from /var/run/php/php7.0-fpm.sock to /var/run/php5-fpm.sock
is there some way or file where I can change this just once and then I don't have to do this process all over again after every provision?

Well i am not sure as i didn't used php5 for homestead or changed but this could help you.
If you look folder Homestead that you cloned from git this url :
git clone https://github.com/laravel/homestead.git Homestead
In this directory you can find directory called scripts.
In script you can find file with name : serve-hhvm.sh you can edit this file in any editor like vim or sublime and change php path here then :
vagrant reload --provision
There is also a file called serve-laravel and this file have all settings related to laravel and path for php7 fpm file sock :
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
I hope this should fix your issue.

Related

Error installing php 71 with homebrew on my mac

I have been developing with Vallet for some time now. Today i wanted to update laravel 5.4 to 5.5. Before doing so i run composer global update. Causing Vallet to stop working.
Fist i tried to do the following:
cd ~/.composer/
sudo chown -R $(whoami) vendor
source: https://laracasts.com/discuss/channels/general-discussion/getting-valet-not-found-error
I did not solve the issue. Then i decided to reinstall Vallet. Hereby i did the following:
I followed this: https://github.com/laravel/valet/issues/321
Stop and uninstall services
sudo brew services stop php71 dnsmasq nginx
brew uninstall php71 dnsmasq nginx
Remove related config files and valet home folder
sudo rm -r /usr/local/etc/php /usr/local/etc/nginx /usr/local/etc/dnsmasq.conf
sudo rm -r ~/.valet /var/root/.valet
Install services i tried this:
brew install php71
$ brew tap homebrew/php
$ brew install php71
brew install homebrew/php/php71
All gave the following error:
MacBook-Pro:~ mblivier$ brew install homebrew/php/php71
==> Installing php71 from homebrew/php Error: The following formula: php71
cannot be installed as a binary package and must be built from source.
Install the Command Line Tools:xcode-select --install
I new in this and don't know how to solve this. Any suggestions how to install php and go further with reinstalling Vallet?
homebrew is installed and working
You need xcode to build php, so first run:
xcode-select --install
to install xcode and later you can brew install php71
This is answer for your comment, I can't post as comment, need to post because is length limited.
There is one of two things going on here, either you didn't install PHP, or PHP is installed and not currently in any of system aware paths. First I would try to find PHP and make sure it exists:
$ find / -name php -type f
You should see something like:
/path/to/your/php/bin/php
If PHP binary does exist, check your path:
$ echo $PATH
If it does not exist, recompile php.
If PHP exists on your system, make sure the path to the /bin/php file is included. You can edit your ~/.bash_profile and add the custom path like this:
PATH=$PATH:/path/to/your/php/bin/
....
export PATH
Then save and reload the file to ensure your current session has access to new path changes:
$ source ~/.bash_profile
With any luck you can now do a php -v and see the version response.

Laravel Installation/Configuration - Command Not Found

Trying to install Laravel on Ubuntu Server 14.04. After installing PHP 7 I enter:
curl -sS https://getcomposer.org/installer | php
I get: Composer successfully installed to: /home/ubuntu/composer.phar
sudo mv composer.phar /usr/local/bin/composer
composer
Works fine
composer global require "laravel/installer"
I get:
nano ~/.bashrc
I include this export PATH="~/.composer/vendor/bin:$PATH" at the very bottom.
sudo service apache2 restart
Restart it
laravel
I get: "laravel: command not found"
Why does it not understand the command laravel?
I'm writing this answer for all the future Google searchers. I had a similar issue and I solved it in the following way:
First run:
sudo apt-get install zip unzip php7.0-zip
Then, edit your ~/.bashrc file and append the following line:
export PATH="$PATH:$HOME/.composer/vendor/bin"
or
export PATH="$PATH:$HOME/.config/composer/vendor/bin"
Which one is yours, depends on the line composer printed out during installation of laravel, followed by /vendor/bin. In my case (and in the case of the question), this was $HOME/.config/composer, so I had to do it the second way:
Don't forget to call
source ~/.bashrc
at the end. Enjoy Laravel!
From your screenshot, I can see that there may be a chance the laravel packages were not installed correctly as you don't have zip and unzip installed on your system.
Run the following command to install these first and then try again to install laravel installer:
sudo apt-get install zip unzip
Regarding the export PATH use $HOME instead of the tilde ~ sign. Hope this will solve your problem. Seems like a path error.
export PATH="$PATH:$HOME/.composer/vendor/bin"

How do I uninstall a PHP module?

I bumped into this bit of instructions while installing an addon for a PHP framework:
Make sure you don't have the PHP module installed. This is a Debian/Ubuntu example:
sudo apt-get purge php5-geoip
I am working on Windows PC with a Virtual Machine running Laravel Homsetead. I am using Git Bash command window. When I enter the above command I get:
bash: sudo: command not found
If I remember correctly, sudo is an Apple-related command so I tried dropping it like this:
apt-get purge php5-geoip
but I get
bash: apt-get: command not found
What command do I need to use to purge php5-geoip?
EDIT: echo $PATH gives out:
$ echo $PATH
/c/Users/Arthur/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/
bin:/c/Users/Arthur/bin:/c/ProgramData/Oracle/Java/javapath:/c/Windows/system32:
/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/
c/Program Files (x86)/Intel/OpenCL SDK/2.0/bin/x86:/c/Program Files (x86)/Intel/
OpenCL SDK/2.0/bin/x64:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c
/Program Files/MATLAB/MATLAB Production Server/R2015a/runtime/win64:/c/Program F
iles/MATLAB/MATLAB Production Server/R2015a/bin:/c/Program Files/MATLAB/MATLAB P
roduction Server/R2015a/polyspace/bin:/c/Program Files (x86)/Skype/Phone:/c/PHP:
/c/ProgramData/ComposerSetup/bin:/c/Users/Arthur/AppData/Roaming/Composer/vendor
/bin:/c/HashiCorp/Vagrant/bin:/c/Program Files/nodejs:/c/Users/Arthur/AppData/Ro
aming/npm:/usr/bin/vendor_perl:/usr/bin/core_perl

PHP code is rendered as text

I'm using Ubuntu 16.04 and I want to run php files.
I installed Php 7 on it using:
sudo mkdir -p /var/www/html
sudo chown -R $USER:$USER /var/www/html
sudo apt install php
sudo apt install apache2
I created a php file (e.g. test.php) in /var/www/html. I can access it in the browser (e.g. http://localhost/test.php). Instead of executing the <?php ... ?> code, it is displayed as plain text:
I tried to turn short_open_tag to On. So I edited the /etc/php/7.0/fpm/php.ini and enabled it.
Then I ran sudo service php7.0-fpm restart. This didn't make any change in the browser. The php code is still displayed as plain text.
How can I fix this?
You didn't install apache properly, doing an apt-get on apache2 does not install everything.
what #newman stated is correct you can follow that guide, or here is a digitalocean link that is usuable for production server (since you would do this on a droplet). Note this is full stack LAMP, which I would assume you would get to eventually when you want to dab with mysql
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04

Laravel composer absolute path error in VB

I run local virtual box development server with ubuntu 12.04. To access files I use virtual box shared folders which are mounted into ubuntu at /media/Sites. This dir I use as DocumentRoot for apache.
When I try to run composer create-project laravel/laravel --prefer-dist I get error:
[InvalidArgumentException]
$from (/media/Sites/test.dev/laravel/vendor/bin/boris) and $to () must be absolute paths.
I assume problem is because dir /media/Sites is outside of ubuntu in windows 8.1. I also tried to create new laravel project in some linux dir and it worked without any error.
What would be the best fix for this?
Thanks in advance
Be sure you have all of the requirements installed:
$ apt-get install git php5 php5-curl php5-cli php5-mcrypt php5-json
then
$ wget https://github.com/laravel/laravel/archive/master.zip
$ unzip master.zip project
$ cd project
$ composer install --verbose
to see a stack trace of the error, then post it here for more help.
there is some bug in the boris package, were it tries to create a symlink to another directory. the solution to this is to manually create the missing file vendor/bin/boris with this content:
../d11wtq/boris/bin/boris
then run composer update again and it should work. (in our case we had also some additional problem with unaccessible files created by composer - the files exist in host but are not accessible in guest - vagrant reload helps in this case)
Had the same happen to me. Solved it by installing php5-readline.
sudo apt-get install php5-readline

Categories