Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIR path breaks in 5.6 #216

Closed
ghost opened this issue Jul 2, 2018 · 24 comments
Closed

DIR path breaks in 5.6 #216

ghost opened this issue Jul 2, 2018 · 24 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jul 2, 2018

$ valet
Password:
Could not open input file: /cli/valet.php
@ghost ghost changed the title Include path breaks in 5.6 DIR path breaks in 5.6 Jul 2, 2018
@ghost
Copy link
Author

ghost commented Jul 2, 2018

This seems to be resolving to an empty string:

if [[ -L $SOURCE ]]
then
    DIR=$(php -r "echo dirname(realpath('$SOURCE'));")
else
    DIR="$( cd "$( dirname "$SOURCE" )" && pwd )"
fi

# If we are in the global Composer "bin" directory, we need to bump our
# current directory up two, so that we will correctly proxy into the
# Valet CLI script which is written in PHP. Will use PHP to do it.
if [ ! -f "$DIR/cli/valet.php" ]
then
    DIR=$(php -r "echo realpath('$DIR/../laravel/valet');")
fi

@alaa-almaliki
Copy link

alaa-almaliki commented Jul 6, 2018

I had the same thing, wrapping the $SOURCE by curly braces seems to fix the issue.

if [[ -L $SOURCE ]]
then
    DIR=$(php -r "echo dirname(realpath('$SOURCE'));") # change to DIR=$(php -r "echo dirname(realpath('${SOURCE}'));")
else
    DIR="$( cd "$( dirname "$SOURCE" )" && pwd )"
fi

This occurs on php5.6 only which seems it can not read the source like in php7

@michielgerritsen
Copy link
Contributor

In my case this was caused by an segmentation fault in the php -r command. A reboot did fix it for me.

@alaa-almaliki
Copy link

alaa-almaliki commented Jul 12, 2018

This is not very practical specially when you work on various projects and need to frequently switch php versions.

@samgranger
Copy link
Contributor

I'll try to reproduce this, thank you for supplying your solution @alaa-almaliki

@samgranger
Copy link
Contributor

Can you try our new 1.0.19 release to see if it solves this issue?

@alaa-almaliki
Copy link

alaa-almaliki commented Jul 16, 2018

Thanks @samgranger, sorry I was away from home for a couple of days and only came back today, it seems that the issue was because the xdebug enabled on PHPSTORM. The issue happens when you are in a php 7 version, then switch to php 5.6. If you have the xdebug enabled on PHPSTORM then you will get segmentation fault or Bus error if you want to run php -r "echo 1;" and since you use the same method to get the directory of the $SOURCE, this will result in an error through valet but it is not a valet error. I am not sure how to fix the issue other than switching off the xdebug on PHPSTORM then run valet xdebug on and only then you will be able to use xdebug or run valet commands. This error was also mentioned here at stackoverflow https://stackoverflow.com/questions/29700081/composer-install-fails-with-bus-error-10/29701249#29701249

@ghost
Copy link
Author

ghost commented Jul 18, 2018

Just updated to 1.0.19, valet+ is still broken after switching to 5.6.

My laborious and annoying repair procedure is to re-install php 7.1, run valet fix, then switch back again, but there have been times where this doesn't work and I have to traverse to ~/.composer/vendor/weprovide and run valet from there.

@samgranger
Copy link
Contributor

samgranger commented Jul 19, 2018

As mentioned in #229:

Can you check if ~/.composer/vendor/bin is in your systems path? You can check this by running echo $PATH.

If this is not the case, please execute the following command and restart your terminal: export PATH=$PATH:~/.composer/vendor/bin

@ghost
Copy link
Author

ghost commented Jul 19, 2018

Here's my path:

echo $PATH
/usr/local/sbin:/usr/local/sbin/sqlite:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/opt/X11/bin:/Users/user/.composer/vendor/bin

@mischabraam
Copy link
Member

Hi, had the same problem when I had PHPStorm listening to xdebug connections. Stop listening fixed it, see https://stackoverflow.com/questions/29700081/composer-install-fails-with-bus-error-10

@mischabraam
Copy link
Member

Hi @capitaladot, is 1.0.20 I've changed the way to detect the valet binary. I had a problem with PHP 5.6 here and fixed it. Can you if your problems are solved in 1.0.20 please?

@ghost
Copy link
Author

ghost commented Aug 14, 2018 via email

@ghost
Copy link
Author

ghost commented Aug 14, 2018 via email

@regularlabs
Copy link
Contributor

I updated drom 1.0.19 to 1.0.20 and I now get this error:
Could not open input file: /cli/valet.php
I never had this before.

@jomurgel
Copy link

Just like @regularlabs I updated to 1.0.20 and received that same error Could not open input file: /cli/valet.php. Downgraded back to 1.0.19 and everything was fine.

@SpeedyRecovery
Copy link

SpeedyRecovery commented Aug 15, 2018

Same issue as @regularlabs and @jomurgel -- was previously running 1.0.19, pulled valet-plus via the .valet-plus-destroy script by @dannygsmith, then tried to reinstall valet-plus and received the Could not open input file: /cli/valet.php error. Using 1.0.19 instead fixed the issue.

@regularlabs
Copy link
Contributor

Try renaming the file (symbolic link):
/Users/.../.composer/vendor/bin/valet to /Users/.../.composer/vendor/bin/_valet
Or remove it.

@maurisource
Copy link

I installed 1.0.20 and I get the same error under php@7.1

valet install
Could not open input file: /cli/valet.php
echo $PATH

/usr/local/opt/php@7.1/sbin:/usr/local/opt/php@7.1/bin:/usr/local/opt/gettext/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin::/usr/local/opt/gettext/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/local/opt/gettext/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/local/opt/gettext/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/local/opt/gettext/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/local/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:$PATH:/Users/maurisource/.composer/vendor/bin:/Users/maurisource/.composer/vendor/bin:/Users/maurisource/.composer/vendor/bin:/Users/maurisource/.composer/vendor/bin:~/.composer/vendor/bin:/Users/maurisource/.composer/vendor/bin

Here's the Php infos:

which php
/usr/local/opt/php@7.1/bin/php

Is there a solution for this? Or am I missing something?

@mischabraam
Copy link
Member

Thanks, will get on it

@mischabraam mischabraam reopened this Aug 16, 2018
@mischabraam mischabraam self-assigned this Aug 16, 2018
@mischabraam
Copy link
Member

mischabraam commented Aug 16, 2018

Hi, just released 1.0.21 with a double check fix.

@ghost
Copy link
Author

ghost commented Aug 16, 2018

Re-tested on 5.6 in 1.0.21; still good (since 1.0.20)!

@maurisource
Copy link

maurisource commented Aug 16, 2018

Thanks @mischabraam I'm able to run through installation just fine since the double check fix released in 1.0.21

@IngWARP
Copy link

IngWARP commented Nov 26, 2018

I run in to this problem running valet-plus 1.0.23 on macOS 10.14.1 trying php 5.6.38
After disabling opcache in '/usr/local/etc/php/5.6/conf.d/ext-opcache.ini' I was able to run 5.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants