Skip to content

Commit 48acab5

Browse files
chore: auto-install php-pear in SessionStart hook (#116)
Add logic to check if pecl is available and install php-pear if needed. This ensures pecl is available before attempting to install xdebug. --------- Co-authored-by: Claude <[email protected]>
1 parent 233d999 commit 48acab5

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.claude/hooks/SessionStart.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,30 @@ pre-commit install --hook-type commit-msg
3232

3333
echo "Pre-commit hooks installed successfully!"
3434

35+
# Check if pecl is available, install php-pear if not
36+
echo "Checking for pecl..."
37+
if ! command -v pecl &> /dev/null; then
38+
echo "pecl is not installed. Installing php-pear..."
39+
40+
# Try to install php-pear using apt
41+
if command -v apt-get &> /dev/null; then
42+
apt-get update && apt-get install -y php-pear
43+
else
44+
echo "Error: apt package manager is not available. Cannot install php-pear."
45+
exit 1
46+
fi
47+
48+
# Verify installation
49+
if ! command -v pecl &> /dev/null; then
50+
echo "Error: Failed to install php-pear/pecl."
51+
exit 1
52+
fi
53+
54+
echo "php-pear and pecl installed successfully!"
55+
else
56+
echo "pecl is already available."
57+
fi
58+
3559
pecl install xdebug || true
3660

3761
composer install

0 commit comments

Comments
 (0)