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

Install command implementation #21

Merged
merged 21 commits into from
Aug 13, 2024

Conversation

asgrim
Copy link
Collaborator

@asgrim asgrim commented Jul 22, 2024

Fixes #4 - finally adds bin/pie install <package> command.

I'll leave this PR open at least a couple of weeks, as I know some folks will be on vacation or unable to quickly gather feedback. Since this now completes the very basic functionality of PIE (i.e. downloading and installing a PHP extension), any/all feedback is welcome at this point!

If there are showstoppers or things severely broken/not working, then I'll investigate, or I may defer certain feedback to tickets to be addressed separately.

update: I'll merge this on or after 12th August if there is no showstoppers

Are you an end user who would like to try this out?

Please note that this is just an initial implementation, and you should definitely not run this anywhere near a production system just yet.

If you understand, and you'd still like to help test this...

Primarily the best way to provide feedback here as an end user of PIE is to check the install command works on your machine! You can do that by following these steps (please adjust for your platform differences of course!)

  • Ensure you are using PHP 8.3 (this is because my test extension asgrim/example-pie-extension is intentionally only compatible with PHP 8.3)
  • git clone -b install-command-implementation https://github.com/asgrim/pie.git
  • composer install
  • bin/pie install asgrim/example-pie-extension
  • Let me know if you encounter any errors or something unexpected!

You should see something like:

$ bin/pie install asgrim/example-pie-extension
This command needs elevated privileges, and may prompt you for your password.
You are running PHP 8.3.9
Target PHP installation: 8.3.9 nts, on Linux/OSX/etc x86_64 (from /usr/bin/php8.3)
Found package: asgrim/example-pie-extension:1.0.1 which provides ext-example_pie_extension
phpize complete.
Configure complete.
Build complete: /tmp/pie_downloader_669e733fcc5f73.59699730/asgrim-example-pie-extension-769f906/modules/example_pie_extension.so
[sudo] password for youruser: 
Install complete: /usr/lib/php/20230831/example_pie_extension.so
You must now add "extension=example_pie_extension" to your php.ini

Or on Windows:

>C:\php-8.3.6\php.exe bin/pie install asgrim/example-pie-extension
This command needs elevated privileges, and may prompt you for your password.
You are running PHP 8.3.6
Target PHP installation: 8.3.6 ts, vs16, on Windows x86_64 (from C:\php-8.3.6\php.exe)
Found package: asgrim/example-pie-extension:1.0.1 which provides ext-example_pie_extension
Nothing to do on Windows.
Copied DLL to: C:\php-8.3.6\ext\php_example_pie_extension.dll
Copied PDB to: C:\php-8.3.6\ext\php_example_pie_extension.pdb
You must now add "extension=example_pie_extension" to your php.ini

Want to try xdebug?

If you're on a non-Windows system, you could try xdbug 3.4.0alpha1, for example:

$ bin/pie --with-php-config=/path/to/php/bin/php-config install xdebug/xdebug:@alpha
This command needs elevated privileges, and may prompt you for your password.
You are running PHP 8.3.9
Target PHP installation: 8.3.9 ts, on Linux/OSX/etc x86_64 (from /path/to/php/bin/php)
Found package: xdebug/xdebug:3.4.0alpha1 which provides ext-xdebug
phpize complete.
Configure complete with options: --with-php-config=/path/to/php/bin/php-config
Build complete: /tmp/pie_downloader_669e770b3def23.09041628/xdebug-xdebug-b8a7e3e/modules/xdebug.so
[sudo] password for youruser: 
Install complete: /path/to/php/lib/php/extensions/debug-zts-20230831/xdebug.so
You must now add "zend_extension=xdebug" to your php.ini
$ echo "zend_extension=xdebug" > /path/to/php/lib/php.ini
$ cat /path/to/php/lib/php.ini
zend_extension=xdebug
$ /path/to/php/bin/php -v
PHP 8.3.9 (cli) (built: Jul 11 2024 14:36:51) (ZTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.3.9, Copyright (c) Zend Technologies
    with Xdebug v3.4.0alpha1, Copyright (c) 2002-2024, by Derick Rethans

Are you an extension maintainer who would like to try this out?

It's not strictly necessary to support this just yet, but if you're keen, and please note, things may change before we finally release PIE... so you do this at your own risk. Note: at the moment, you will need to make a new release - see ThePHPF/pie-design#17

More details, for example for help on composer.json, can be read in https://github.com/ThePHPF/pie-design?tab=readme-ov-file#extension-maintainer-register-a-pie-package

@asgrim asgrim added the enhancement New feature or request label Jul 22, 2024
@asgrim asgrim self-assigned this Jul 22, 2024
@davisenra
Copy link

davisenra commented Jul 22, 2024

I'm a end user, just tested on a MacBook Pro M3 @ Sonoma 14.5 (23F79). Everything worked flawlessly. Entire process ran for 7 seconds.

❯ bin/pie install asgrim/example-pie-extension
This command needs elevated privileges, and may prompt you for your password.
You are running PHP 8.3.8
Target PHP installation: 8.3.8 nts, on Linux/OSX/etc arm64 (from /opt/homebrew/Cellar/php/8.3.8/bin/php)
Found package: asgrim/example-pie-extension:1.0.1 which provides ext-example_pie_extension
phpize complete.
Configure complete.
Build complete: /var/folders/hv/zc7w349n64b0dqzhdp_2vs0c0000gn/T/pie_downloader_669e87919e0d32.23807097/asgrim-example-pie-extension-769f906/modules/example_pie_extension.so
Password:
Install complete: /opt/homebrew/lib/php/pecl/20230831/example_pie_extension.so
You must now add "extension=example_pie_extension" to your php.ini

I'd like to thank everyone involved in this project. Pear installation is broken as of PHP 8.3.9 because of some error related to libxml2, I think it'll be fixed in 8.3.10. Can't wait to finally sunset pear/pecl.

Edit: xdebug also works

❯ bin/pie install xdebug/xdebug:@alpha
This command needs elevated privileges, and may prompt you for your password.
You are running PHP 8.3.8
Target PHP installation: 8.3.8 nts, on Linux/OSX/etc arm64 (from /opt/homebrew/Cellar/php/8.3.8/bin/php)
Found package: xdebug/xdebug:3.4.0alpha1 which provides ext-xdebug
phpize complete.
Configure complete.
Build complete: /var/folders/hv/zc7w349n64b0dqzhdp_2vs0c0000gn/T/pie_downloader_669e8f8091a648.02025179/xdebug-xdebug-b8a7e3e/modules/xdebug.so
Password:
Install complete: /opt/homebrew/lib/php/pecl/20230831/xdebug.so
You must now add "zend_extension=xdebug" to your php.ini

❯ php --version
PHP 8.3.8 (cli) (built: Jun  4 2024 14:53:17) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.8, Copyright (c) Zend Technologies
    with Xdebug v3.4.0alpha1, Copyright (c) 2002-2024, by Derick Rethans
    with Zend OPcache v8.3.8, Copyright (c), by Zend Technologies

Edit 2: Also working on my Arch Linux laptop :)

@asgrim
Copy link
Collaborator Author

asgrim commented Jul 22, 2024

I'm a end user, just tested on a MacBook Pro M3 @ Sonoma 14.5 (23F79). Everything worked flawlessly. Entire process ran for 7 seconds.

Thanks for the feedback and kind words @davisenra !

@asgrim asgrim marked this pull request as ready for review August 13, 2024 12:33
@asgrim asgrim merged commit 4082b39 into php:main Aug 13, 2024
14 checks passed
@asgrim asgrim deleted the install-command-implementation branch August 13, 2024 12:34
@asgrim asgrim added this to the 0.1.0 - initial release milestone Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Install command & related components
2 participants