Skip to content

Consider escalating priviledge to sudo automatically when copying .so file or editing ini file #481

@dilawar

Description

@dilawar

std::fs::copy(&ext_path, &ext_dir).with_context(|| {

The problem

If you are outside docker and/or don't have permissions to write into PHP's config directory.

  • cargo php install will fail if normal user don't have permissions to copy file or write to .ini file.
  • sudo cargo php install is likely to fail with cargo not found error since cargo is typically installed in user's ~/.cargo/bin directory.
  • sudo ~/.cargo/bin/cargo php install is likely to rebuild and change the owner to root of many intermediate files to make normal cargo b to fail.

Solution: before copying file or editing INI file, check if it requires admin privilege and use sudo2 or elevate crate to escalate privilege.

Metadata

Metadata

Assignees

Labels

cargo-phpRelated to `cargo-php`enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions