Skip to content

Commit 0f293aa

Browse files
chore: replace PECL with apt for xdebug installation (#132)
The startup script was failing when trying to install xdebug via PECL with the error "No releases for package 'pecl/xdebug' exist". This was caused by PECL configuration issues or missing build dependencies. Changes: - Removed PECL/php-pear installation logic - Replaced with direct apt installation of php-xdebug - Auto-detects PHP version to install correct package (e.g., php8.4-xdebug) - Added proper verification that xdebug module is loaded - Improved error handling and user feedback This approach is more reliable as it uses pre-built packages from the ondrej/php PPA instead of compiling from source. Co-authored-by: Claude <noreply@anthropic.com>
1 parent 638c6cd commit 0f293aa

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

.claude/hooks/SessionStart.sh

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +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..."
35+
# Install xdebug if not already present
36+
echo "Checking for xdebug..."
37+
if ! php -m | grep -q xdebug; then
38+
echo "xdebug is not installed. Installing xdebug..."
3939

40-
# Try to install php-pear using apt
40+
# Try to install xdebug using apt
4141
if command -v apt-get &> /dev/null; then
42-
apt-get update && apt-get install -y php-pear
42+
# Detect PHP version and install corresponding xdebug package
43+
PHP_VERSION=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')
44+
apt-get install -y php${PHP_VERSION}-xdebug
4345
else
44-
echo "Error: apt package manager is not available. Cannot install php-pear."
46+
echo "Error: apt package manager is not available. Cannot install xdebug."
4547
exit 1
4648
fi
4749

4850
# Verify installation
49-
if ! command -v pecl &> /dev/null; then
50-
echo "Error: Failed to install php-pear/pecl."
51+
if ! php -m | grep -q xdebug; then
52+
echo "Error: Failed to install xdebug."
5153
exit 1
5254
fi
5355

54-
echo "php-pear and pecl installed successfully!"
56+
echo "xdebug installed successfully!"
5557
else
56-
echo "pecl is already available."
58+
echo "xdebug is already available."
5759
fi
5860

59-
pecl install xdebug || true
60-
6161
composer install

0 commit comments

Comments
 (0)