asdf-community / asdf-community/asdf-php

[Docs] Clarify usage of `echo` for adding extensions

Open
#156 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Shell
Stars
256
Forks
117
PR merge metrics
No merged PRs in 30d

Description

Hey!

I noticed that the current documentation [here](https://github.com/asdf-community/asdf-php#note) suggests using the `echo {message} > {file}` command to add new extensions to PHP. There's a potential risk associated with it. Using the `>` operator will overwrite the entire file!

I recently lost all the configurations in my `php.ini` file when trying to add a new extension. While I understand that this was my fault, I believe we can improve the documentation to prevent such accidents in the future.

# Proposed Improvement:

I suggest updating the documentation to use the `>>` operator instead of `>`
Here's the revised command:
```bash
pecl install redis
pecl install imagick

echo "extension=redis.so
extension=imagick.so" >> $(asdf where php)/conf.d/php.ini
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Open the documentation linked at the repository's #note section and compare its shell command with the proposed revision. Update the extension-installation example so it does not overwrite the existing php.ini configuration, then review the rendered documentation to confirm the command and warning are clear.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, shell
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.