I'm making a laravel webapp and I'm trying to access a image in a storage symbolic link /storage/images/face-ph.png.
It works when I do it locally like this:
<img src="/storage/images/face-ph.png>
However when I upload it to Heroku it can't find the path.
Adnan's answer has two issues;
If you use heroku run bash to execute a command, it's only executed in a one-off dyno. So this won't effect the live dyno.
The php artisan storage:link command generates a symlink with an absolute path. So when you'd run this during build, it'd map the absolute path of a temp build directory, instead of the final app's directory on the dyno.
I used a simple relative symlink to link both directories and add it to your git repository:
cd public/ && ln -s ../storage/app/public storage && cd ..
if you are using Heroku for your deployment you can try
heroku run bash
php artisan storage:link
OR
heroku run /app/php/bin/php /app/www/artisan storage:link
you can use an absolute path or relative path to run binaries
Hope this helps
I have to overwrite a file through Dockerfile. In particular on an Ubuntu container with Apache and PHP and I have to overwrite the file php5-cgi.conf.
I tried to use the following command:
COPY php5-cgi.conf /etc/apache2/conf-enabled/php5-cgi.conf
but I had the error: File already exists
I have also tried to use the following command
RUN cp -f php5-cgi.conf /etc/apache2/conf-enabled/
but the file is not copied when the container is running, Is there any advice on this?
Drop the file name from the destination:
COPY php5-cgi.conf /etc/apache2/conf-enabled/
The destination is an absolute path (not filename), or a path relative to the work directory, into which the source will be copied inside the destination container.
I just tested following docker file with no problem.
from debian:jessie
COPY debian_version /etc/debian_version
As PolarisUser stated in comments, you need to put debian_version in the same folder as dockerfile or use absolute path.
Another way would be mounting the file when running the container.
docker run -d -v php5-cgi.conf:/etc/apache2/conf-enabled/php5-cgi.conf --name your_container_name <imagename:tag> <startup command>
docker cp "yourfilename" "containername":/destination
Below is a working example:
docker cp config.json bigdataapp:/app/src/bigdatapp/wwwroot/assets/config/config.json
Good morning all,
I have a little problem with variable $PATH in my .bash_profile file.
I have an OSX system with XAMPP installed.
I have edit my .bash_profile in this way:
export XAMPP_HOME="/Applications/XAMPP/xamppfiles"
export PATH="${XAMPP_HOME}/bin/php-5.4.22:${PATH}"
export PATH="$PATH:/Users/alessandrominoccheri/Sites/site.com/lib/Cake/Console"
export PATH
After I have restart apache and write into console:
source ~/.bash_profile
and type:
which php
But always return me:
/usr/bin/php
How can I change path?
I have changed permission on bin folder but same problem.
I have followed this link but I have the same problem:
Mac OSX PHP and XAMPP path issue
If ${XAMPP_HOME}/bin/php-5.4.22 is the executable, then adding it to your path doesn't help you in being able to call it using php. The $PATH needs to contain directories in which executables are, which will be searched in the order they're defined whenever you mention any executable by name.
You either want to alias your php-5.4.22 to php in your profile, or maybe better, create a symlink for it that overrides your default php. E.g.:
$ ln -s ${XAMPP_HOME}/bin/php-5.4.22 /usr/local/bin/php
I have both ~/.bash_profile & ~/.profile files.
~/.bash_profile contains one line:
export PATH=/Applications/mamp/bin/php5.5.3/bin:$PATH
~/.profile contains three lines:
# MacPorts Installer addition on 2014-02-02_at_20:54:53: adding an appropriate PATH variable for use with MacPorts.
export PATH=/Applications/MAMP/bin/php5.5.3/bin/:/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
As you can see I am trying to get my default PHP PATH to use MAMPs PHP because I have mcrypt installed on it. For some reason when I type whereis PHP I get the native route: /usr/bin/php, and when I echo $PATH I get:
/Applications/mamp/bin/php5.5.3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Somewhere I have another file thats really controlling my PATH and I have no clue where it is. What else could be controlling my PATH route?
NOTE: I have Homebrew, MacPorts, Xcode, and Xcode Command-Line Tools installed.
What you're seeing is coming from the system-wide /etc/paths file. It is the source of the base $PATH environment variable before ~/.profile, ~/.bash_profile and others get involved. If you're in a Terminal window, you can edit it with the following command:
sudo open -t /etc/paths
By default it contains the following paths:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
I wouldn't recommend editing this file, however, because it is system-wide and will affect every user on the system.
If you want complete control over $PATH, so as to affect only your own account you're probably better off just not including $PATH in your .profile's export PATH lines. For example (but not this):
export PATH=/Applications/mamp/bin/php5.5.3/bin:/opt/local/bin:/opt/local/sbin
Are you sure .profile is being loaded? Try a test and add an echo line to it:
echo "test: .profile has loaded"
Now open a new terminal window, do you see your echo? I suspect not as I don't think OSX loads .profile by default, at least today.
If you really want to use .profile you can ask .bash_profile to load it:
if [ -f ~/.profile ]; then
source ~/.profile
fi
Hope this helps.
Edit:
Looks like .profile is loaded, if no .bash_profile or .bash_login exist as suggested in this answer
I've read the global installation documentation for Composer, but it's for *nix systems only:
curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
I would be such happy doing the same on Windows, that's the OS of my development machine. I would be able to run
composer update
From an arbitrary folder where composer.json exists. Interpreter php.exe is already in PATH variable.
Any clue?
Sure. Just put composer.phar somewhere like C:\php\composer.phar, then make a batch file somewhere within the PATH called composer.bat which does the following:
#ECHO OFF
php "%~dp0composer.phar" %*
The "%*" repeats all of the arguments passed to the shell script.
Then you can run around doing composer update all ya want!
Install Composer
On Windows, you can use the Composer Windows Installer.
Go to php.exe located folder.
C:\wamp\bin\php\php5.5.12\
open cmd there, and execute below command.
php -r "readfile('https://getcomposer.org/installer');" | php
composer.phar will be downloaded in same folder.
Create folder named composer in C:// drive (or anywhere you wish, for upcoming steps, remember the path).
move composer.phar file to C://composer folder.
Create composer.bat file in same folder with contents below
#ECHO OFF
php "%~dp0composer.phar" %*
create file named composer without any extensions.
running command type NUL > composer in CMD will help to get it done quickly,
Open that file and place below contents inside it.
#!/bin/sh
dir=$(d=$(dirname "$0"); cd "$d" && pwd)
# see if we are running in cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
# cygwin paths start with /cygdrive/ which will break windows PHP,
# so we need to translate the dir path to windows format. However
# we could be using cygwin PHP which does not require this, so we
# test if the path to PHP starts with /cygdrive/ rather than /usr/bin.
if [[ $(which php) == /cygdrive/* ]]; then
dir=$(cygpath -m $dir);
fi
fi
dir=$(echo $dir | sed 's/ /\ /g')
php "${dir}/composer.phar" $*
Save.
Now set path, So we can access composer from cmd.
Show Desktop.
Right Click My Computer shortcut in the desktop.
Click Properties.
You should see a section of control Panel - Control Panel\System and
Security\System.
Click Advanced System Settings on the Left menu.
Click Environment Variables towards the bottom of the window.
Select PATH in the user variables list.
Append your PHP Path (C:\composer) to your PATH variable, separated
from the already existing string by a semi colon.
Click OK
Restart your machine.
Or, restart explorer only using below command in CMD.
taskkill /f /IM explorer.exe
start explorer.exe
exit
Original Article with screenshots here : http://aslamise.blogspot.com/2015/07/installing-composer-manually-in-windows-7-using-cmd.html
This may be useful to someone:
On Windows 7, if you've installed Composer using curl, it can be found in similar path:
C:\Users\<username>\AppData\Roaming\Composer
Well, now this question is a bit obsolete as there is now an official installer which "will install the latest Composer version and set up your PATH so that you can just call composer from any directory in your command line."
You can get it at : http://getcomposer.org/doc/00-intro.md#installation-windows
A bit more generic if you put the batch in the same folder as composer.phar:
#ECHO OFF
SET SUBDIR=%~dp0
php %SUBDIR%/composer.phar %*
I'd write it as a comment, but code isn't avail there
Start > Computer : Properties > Change Settings > Advanced > Environment Variables > PATH : Edit [add this string (without "") at the end of line ";C:\<path to php folder>\php5.5.3"].. open cmd and type composer
thats it :-)
I use Composer-Setup.exe and it works fine.
Just in case you need to know where is the composer.phar (to use with PhpStorm) :
C:\ProgramData\ComposerSetup\bin\composer.phar
Unfortunately, all the good answers here didn't work for me. So after installing composer on windows 10, I just had to set system variable in environment variables and it worked.
sorry to dig this up, I just want to share my idea, the easy way for me is to rename composer.phar to composer.bat and put it into my PATH.
An alternative variant (see Lusitanian answer) is to register .phar files as executable on your system, exemplary phar.reg file:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.phar]
#="phar_auto_file"
[HKEY_CLASSES_ROOT\phar_auto_file\shell\open\command]
#="\"c:\\PROGRA~1\\php\\php.exe\" \"%1\" %*"
Just replace the path to php.exe to your PHP executable. You can then also extend the %PATHEXT% commandline variable with .PHAR which will allow you to type composer instead of composer.phar as long as composer.phar is inside the %Path%.
I was having the same issue and when I checked the environment in Windows 7 it was pointing to c:\users\myname\appdata\composer\version\bin which didn't exists.
the file was actually located in
C:\ProgramData\ComposerSetup\bin
Fixed the location in environment setting and it worked
you can install it using this command line
echo #php "%~dp0composer.phar" %* > composer.bat
I found that on Control Panel > Environment Variables > Variables for my localuser just inside PATH varible like this:
C:\Users\MY_USER_NAME\AppData\Roaming\Composer\vendor\bin