Skip to content
This repository has been archived by the owner on Feb 11, 2019. It is now read-only.

$environment/share/php Folder Empty on create #28

Open
svpernova09 opened this issue Apr 3, 2014 · 37 comments
Open

$environment/share/php Folder Empty on create #28

svpernova09 opened this issue Apr 3, 2014 · 37 comments
Labels

Comments

@svpernova09
Copy link

virtphp v0.3.0-alpha Running on Mavericks. I have php 5.5.10 installed via homebrew. I get the notice about .pearrc but I've tried it with and without that file existing in ~/. with the same results. I installed virtphp by downloading the release and moving it to /usr/loca/bin/virtphp and chmod 755.

virtphp create svpernovaphp                                                                           
There is an old .pearrc file on your system that may prevent this VirtPHP env from being created. If an error occurs, you may temporarily move the .pearrc file while creating your virtual env.
Checking current environment
Creating directory structure
Creating VirtPHP version file
Creating custom php.ini
Wrapping PHP binary
Downloading pear phar file, this could take a while...
Installing PEAR
Saving pear.conf file.
Installing Composer locally
Installing activate/deactive script
Getting the contents of current environments file.
Write updated list to environments file.
Your virtual php environment (svpernovaphp) has been created!
You can activate your new environment using: ~$ source svpernovaphp/bin/activate

So far so good

┌─(halo@Joes-MacBook-Pro.local)(~) source svpernovaphp/bin/activate
┌─(halo@Joes-MacBook-Pro.local)(~) which php
/Users/halo/svpernovaphp/bin/php

Here is where I run into issues:

┌─(halo@Joes-MacBook-Pro.local)(~) pecl install mongo
Could not open input file: /Users/halo/svpernovaphp/share/php/peclcmd.php

┌─(halo@Joes-MacBook-Pro.local)(~)  pear config-set auto_discover 1
Could not open input file: /Users/halo/svpernovaphp/share/php/pearcmd.php

svpernovaphp/share/php is empty:

┌─(halo@Joes-MacBook-Pro.local)(~) ls svpernovaphp/share/php

svpernovaphp/share/pear contains:

┌─(halo@Joes-MacBook-Pro.local)(~) ls svpernovaphp/share/pear
cache/    cfg/      download/ temp/     tests/    www/

Swapped to /bin/bash as my shell in the event something with my zsh config was the issue but I had the same results.

@jwoodcock
Copy link
Member

Thanks for the detailed report. Can you send what the tree of your /Users/halo/svpernovaphp folder?

  • Jacques

Sent from my mobile

On Apr 3, 2014, at 7:49, Svpernova09 notifications@github.com wrote:

virtphp v0.3.0-alpha Running on Mavericks. I have php 5.5.10 installed via homebrew. I get the notice about .pearrc but I've tried it with and without that file existing in ~/. with the same results. I installed virtphp by downloading the release and moving it to /usr/loca/bin/virtphp and chmod 755.

virtphp create svpernovaphp
There is an old .pearrc file on your system that may prevent this VirtPHP env from being created. If an error occurs, you may temporarily move the .pearrc file while creating your virtual env.
Checking current environment
Creating directory structure
Creating VirtPHP version file
Creating custom php.ini
Wrapping PHP binary
Downloading pear phar file, this could take a while...
Installing PEAR
Saving pear.conf file.
Installing Composer locally
Installing activate/deactive script
Getting the contents of current environments file.
Write updated list to environments file.
Your virtual php environment (svpernovaphp) has been created!
You can activate your new environment using: ~$ source svpernovaphp/bin/activate
So far so good

┌─(halo@Joes-MacBook-Pro.local)() source svpernovaphp/bin/activate
┌─(halo@Joes-MacBook-Pro.local)(
) which php
/Users/halo/svpernovaphp/bin/php
Here is where I run into issues:

┌─(halo@Joes-MacBook-Pro.local)(~) pecl install mongo
Could not open input file: /Users/halo/svpernovaphp/share/php/peclcmd.php

┌─(halo@Joes-MacBook-Pro.local)(~) pear config-set auto_discover 1
Could not open input file: /Users/halo/svpernovaphp/share/php/pearcmd.php
svpernovaphp/share/php is empty:

┌─(halo@Joes-MacBook-Pro.local)(~) ls svpernovaphp/share/php
svpernovaphp/share/pear contains:

┌─(halo@Joes-MacBook-Pro.local)(~) ls svpernovaphp/share/pear
cache/ cfg/ download/ temp/ tests/ www/
Swapped to /bin/bash as my shell in the event something with my zsh config was the issue but I had the same results.


Reply to this email directly or view it on GitHub.

@svpernova09
Copy link
Author

Here is the svpernovaphp folder with all the subfolders expanded:

screen shot 2014-04-03 at 8 13 32

@jwoodcock
Copy link
Member

Looking over this list, something went wrong in the virtPHP env setup and the PHP files were not copied into share/php directory. I’ve tested locally on Mavericks and was able to get the env setup correctly, but then ran into some other issues that I’ll need more time to diagnose.

Can you try destroying this env and running create again.

Also, a heads up, we’re not fully done with OSX support, but this is great for us to see so we can reach full support sooner.

Jacques Woodcock

On Apr 3, 2014, at 8:14 AM, Svpernova09 notifications@github.com wrote:

Here is the svpernovaphp folder with all the subfolders expanded:


Reply to this email directly or view it on GitHub.

@svpernova09
Copy link
Author

Deactivated, destroyed, and created again using the same steps, still having the same issue.

Completely understand this is alpha, totally expect things to be broken. Let me know if I can help.

@jwoodcock
Copy link
Member

If you want to clone the project and then run the commands using the ./bin/virtphp followed by virtPHP commands, you can add debugging to the code to see where it’s failing. What’s failing is happening in the src/VirtPHP/Workers/Creator.php most likely.

Thanks!
Jacques Woodcock
jacques@kitewebconsulting.com
615-293-0328

On Apr 3, 2014, at 10:10 AM, Svpernova09 notifications@github.com wrote:

Deactivated, destroyed, and created again using the same steps, still having the same issue.

Completely understand this is alpha, totally expect things to be broken. Let me know if I can help.


Reply to this email directly or view it on GitHub.

@svpernova09
Copy link
Author

I pulled down the source, but using -vvv for debug does not seem to be outputting anything extra. Am I doing something wrong?

vagrant@precise64:/vagrant$ ./bin/virtphp -vvv create test
Checking current environment
Creating directory structure
Creating VirtPHP version file
Creating custom php.ini
Wrapping PHP binary
Downloading pear phar file, this could take a while...
Installing PEAR
Saving pear.conf file.
Installing Composer locally
Installing activate/deactive script
Creating .virtphp directory in user home folder.
Create the environments.json file.
Getting the contents of current environments file.
Write updated list to environments file.
Your virtual php environment (test) has been created!
You can activate your new environment using: ~$ source test/bin/activate

@jwoodcock
Copy link
Member

Sorry,
You'll have to actually add your own debug output into the script.

  • Jacques

Sent from my mobile

On Apr 3, 2014, at 11:00, Svpernova09 notifications@github.com wrote:

I pulled down the source, but using -vvv for debug does not seem to be outputting anything extra. Am I doing something wrong?

vagrant@precise64:/vagrant$ ./bin/virtphp -vvv create test
Checking current environment
Creating directory structure
Creating VirtPHP version file
Creating custom php.ini
Wrapping PHP binary
Downloading pear phar file, this could take a while...
Installing PEAR
Saving pear.conf file.
Installing Composer locally
Installing activate/deactive script
Creating .virtphp directory in user home folder.
Create the environments.json file.
Getting the contents of current environments file.
Write updated list to environments file.
Your virtual php environment (test) has been created!
You can activate your new environment using: ~$ source test/bin/activate

Reply to this email directly or view it on GitHub.

@svpernova09
Copy link
Author

So I set up the cloned folder in phpstorm so I could add breakpoints for Xdebug to catch. When I step through virtphp via xdebug, the files get created. When I use the same virtphp executable outside of the folder I cloned to, it won't create the files. This probably doesn't help much.

@jwoodcock
Copy link
Member

It’s something. Could be some gems in there.

Thanks for all!

Jacques Woodcock
jacques@kitewebconsulting.com
615-293-0328

On Apr 3, 2014, at 5:03 PM, Svpernova09 notifications@github.com wrote:

So I set up the cloned folder in phpstorm so I could add breakpoints for Xdebug to catch. When I step through virtphp via xdebug, the files get created. When I use the same virtphp executable outside of the folder I cloned to, it won't create the files. This probably doesn't help much.


Reply to this email directly or view it on GitHub.

@jwoodcock
Copy link
Member

Okay, so I run into a error when trying to install mongo
pecl install mongo

Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.

I found this article on stack overflow and will investigate it further to see if this fixes my issue.
http://stackoverflow.com/questions/9322742/php-autoconf-errors-on-mac-os-x-10-7-3-when-trying-to-install-pecl-extensions

@svpernova09 Where on your system did you setup the environment? I know this is not likely a permissions issue, but have you checked your permissions? Also, what version of the phar do you have installed? I'm testing with 0.3.0 and all of the environment is being created successfully.

@jwoodcock
Copy link
Member

This answer seems promising. Making a note for future reference:
I upgraded XCode and I had the same issue till I added /Developer/usr/bin/ to $PATH. – Eduardo Romero Jul 1 '13 at 17:13

@jwoodcock
Copy link
Member

My issue was solved by doing a
brew install autoconf

The question is how do we check for this in our program so we can respond accordingly?

@jakerella or @ramsey ^

@ramsey
Copy link
Contributor

ramsey commented Apr 12, 2014

I don't understand how this is a responsibility of virtPHP. If the system is missing autoconf, then it's understandable that the user would get this error and be unable to install a PECL extension.

@jwoodcock
Copy link
Member

I understand virtphp shouldn't be responsible for resolving the issue, but should we at least throw a warning?

@svpernova09
Copy link
Author

@jwoodcock I already had autoconf installed via brew. Still having the same results as the original issue on OS X

@jwoodcock
Copy link
Member

@svpernova09 Yeah, this was an issue I was seeing on my mac.

What version of OSX are you on? Also, we can go over it when I get in next Tuesday.

@svpernova09
Copy link
Author

I'm on Mavericks 10.9.2.

@pddevins
Copy link
Contributor

I'm on the same version of Mavericks, and everything seems to go fine with the creation of the environment (the files are created and directory structure is there), however when I attempt to do any kind of pecl or pear installs it just hangs, no errors, no output. I'm going to try to look a little more into it, but I thought I would add my 2 cents after testing svpernova09's initial steps above. Also, I'm using php-build and realized in the process that it requires several dependencies, so I already have the following packages installed through homebrew:

automake autoconf curl pcre re2c mhash libtool icu4c gettext jpeg libxml2 mcrypt gmp libevent

After which, I had to chmod 777 the mutils folder so that I could properly link mcrypt and mhash in homebrew. I don't know if this has anything to do with it, but I thought it worth mentioning.

@jwoodcock
Copy link
Member

Okay, I think I hit on something. The {env}/share/php folder is not empty in the case when on OSX an environment is not created successfully, i.e. the issue @svpernova09 reported. What's actually happening is that folder is being dumped with a bunch of hidden files/folders. I'm going to spend time tonight researching what this means and why this could be happening but wanted to note it here to A) make sure both @svpernova09 and @pddevins see the same thing when they look at hidden files in that folder and B) in case some one else has seen this happen in the wild before.

Something about the PEAR install command is not firing properly is currently my guess as what @ramsey says is that PEAR installs it stuff into the /share/php folder.

To get hidden files/folders to show in Finder in OSX, reference this article:
http://coolestguidesontheplanet.com/show-hidden-library-and-user-library-folder-in-osx/

Screenshot of the hidden files/folders:
screen shot 2014-05-22 at 9 08 16 pm

@jwoodcock
Copy link
Member

Okay, here's what I found. First, there's a bug in the pear call on line 568 which use to be:

 . 'share' . DIRECTORY_SEPARATOR . 'install-pear-nozlib.phar '

needs to be this

. $this->getEnvPath() . DIRECTORY_SEPARATOR . 'share' . DIRECTORY_SEPARATOR . 'install-pear-nozlib.phar '

After fixing that, I added a pipe to dump the outputs of the call into a local file. This file showed these errors with PEAR

[PEAR] Archive_Tar: upgrade to a newer version (1.3.11 is not newer than 1.3.11)
[PEAR] Console_Getopt: upgrade to a newer version (1.3.1 is not newer than 1.3.1)
[PEAR] PEAR: upgrade to a newer version (1.9.4 is not newer than 1.9.4)
[PEAR] Structures_Graph: upgrade to a newer version (1.0.4 is not newer than 1.0.4)
[PEAR] XML_Util: upgrade to a newer version (1.2.1 is not newer than 1.2.1)

I'm done looking for the night, but initial research shows that OSX uses out of date packages, surprise I know. I'll look into seeing what we have to do.

@jwoodcock
Copy link
Member

After a lot of testing, we've isolated the issue down to when OSX has a pear already installed, it prevents the virtPHP script install command to complete successfully. Not 100% sure why, but we're getting closer to knowing.

@jakerella
Copy link
Member

Weird... but well done (so far)

@jwoodcock
Copy link
Member

All, it's confirmed to be the .pearrc file on OSX. If this is in your ~/ folder it trips out the .phar install.

@ramsey
Copy link
Contributor

ramsey commented May 27, 2014

I'm seeing the same problem myself. I'm not sure why this occurs on OSX but not on Linux. I think some of the problem is a result of installing PEAR into the virtPHP environment using the system PHP and system PEAR settings, since we haven't yet activated the virtual environment, and this may be causing collisions with existing system settings. However, if this is the case, we should be seeing the same issue on Linux.

@ramsey
Copy link
Contributor

ramsey commented Jun 6, 2014

Did PR #41 fix this issue? Please grab release v0.5.0-alpha and see if you're still having this problem.

@svpernova09
Copy link
Author

Upgraded to v0.5.0-alpha and I moved ~/.pearrc to ~/.pearrc-no and still have the same issues.

screen shot 2014-06-06 at 15 52 55

@jwoodcock
Copy link
Member

Can you try leaving .pearrc where it was? And do a printout of the inside of share/php? ls -ila

@ramsey ramsey added the bug label Jun 6, 2014
@svpernova09
Copy link
Author

Recreated myenv with .pearrc restored to ~/.pearrc

screen shot 2014-06-06 at 16 03 02

@jwoodcock
Copy link
Member

Running some local tests.

@pddevins
Copy link
Contributor

pddevins commented Jun 7, 2014

I'm still having this same issue. .pearrc remains in ~. My dir structure looks like @svpernova09's above.

@jwoodcock
Copy link
Member

Well fuck. Back to the drawing board.

@ramsey
Copy link
Contributor

ramsey commented Jul 28, 2014

In some recent tests, it doesn't matter whether I have a ~/.pearrc file or not, I'm still running into this issue.

I'm using Mac OS X 10.9.4 with their default PHP 5.4.24.

@jwoodcock
Copy link
Member

All, we just released v0.5.1-alpha. This will log the results from when the pear installation fails to ~/.virtphp/log/pear_log.txt.

If you can try and create a new environment and post the log results, it will help identify the issue.

@philsturgeon
Copy link
Contributor

So, I was having this issue and with advice from @jwoodcock I fixed it.

I had some php stuff installed with Homebrew and I think it was causing some sort of conflict.

How to fix:

$ brew list

Look for any versions of PHP and any PHP extensions. I also have phpmd and php-code-sniffer but they dont seem to matter.

Removing php55 seemed to be problematic:

$ brew uninstall php55
Error: php55 has multiple installed versions
Use `brew remove --force php55` to remove all versions.
$ brew uninstall php55 --force

Maybe that was also part of the problem, dunno.

After removing other stuff, I'm now creating environments ok.

@philsturgeon
Copy link
Contributor

Ok so more debug info. I had it working then because I had phpbrew turned off. It now seems that trying to use phpbrew (for me) is a path to errors. PHPBrew on = break, off = worky.

$ virtphp create foo        
Checking current environment
Creating directory structure
Creating virtPHP version file
Creating custom php.ini
Wrapping PHP binary
Downloading pear phar file, this could take a while...
Installing PEAR
Saving pear.conf file.
Installing Composer locally
ERROR: Could not install Composer.
This directory does not contain a valid virtPHP environment!
System reverted

$ which php
/Users/phil/.phpbrew/php/php-5.5.17/bin/php

$ phpbrew off
phpbrew is turned off.

$ which php
/usr/bin/php

$ virtphp create bar                                  
Checking current environment
Creating directory structure
Creating virtPHP version file
Creating custom php.ini
Wrapping PHP binary
Downloading pear phar file, this could take a while...
Installing PEAR
Saving pear.conf file.
Installing Composer locally
Installing activate/deactive script
Your virtual php environment (bar) has been created!
You can activate your new environment using: ~$ source /Users/phil/.virtphp/envs/bar/bin/activate

Getting the contents of current environments file.
Writing updated list to environments file.

Any ideas?

@pddevins
Copy link
Contributor

pddevins commented Oct 1, 2014

@philsturgeon Which version of phpbrew are you running? Also, (queue dumb question) are you using the latest 0.5.1-alpha build of virtphp?

I just followed your debug example and got the following :

λ vp create foo                                                                                              [ v5.6.0 ]
Checking current environment
Creating directory structure
Creating virtPHP version file
Creating custom php.ini
Wrapping PHP binary
Downloading pear phar file, this could take a while...
Installing PEAR
Saving pear.conf file.
Installing Composer locally
Installing activate/deactive script
Your virtual php environment (foo) has been created!
You can activate your new environment using: ~$ source /Users/simplchimp/.virtphp/envs/foo/bin/activate

Getting the contents of current environments file.
Writing updated list to environments file.

λ which php                                                                                                  [ v5.6.0 ]
/Users/simplchimp/.phpbrew/php/php-5.6.0/bin/php

λ source .virtphp/envs/foo/bin/activate                                                         [ v5.6.0 ]

(foo)
λ which php                                                                                                  [ v5.6.0 ]
/Users/simplchimp/.virtphp/envs/foo/bin/php

(foo)
λ vp --version                                                                                               [ v5.6.0 ]
virtPHP version v0.5.1-alpha 2014-08-13 16:05:47

(foo)
λ phpbrew --version                                                                                          [ v5.6.0 ]
phpbrew - 1.13.2
cliframework core: 1.5.12

I was having the creation process halt at the same step that you are, and basically did a complete overhaul of PHP on my machine. Removed all of the homebrewed versions of anything php (php55 php54 php55-intl php-... you get the point) that existed in homebrew. Then proceeded to reinstall phpbrew and a few versions of php using phpbrew only. Ran the virtphp command through an Xdebug config I have for stepping through 'creates' and 'clones' and everything worked out swimmingly. Don't know if any of that helped, but it was where I found my issues.

@philsturgeon
Copy link
Contributor

I have discovered the issues affecting me and sent a few PRs to improve the situation.

This was because my phpbrew-installed version of PHP didn't have openssl, and therefore could not download composer. With #55 this will be more obvious, and people should post fewer issues here with vague "it doesnt install" problems. :)

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

No branches or pull requests

6 participants