@@ -113,6 +113,22 @@ install_c_client() {
113113 fi
114114}
115115
116+ # Function to switch to system default PHP (remove symlinks)
117+ switch_to_system () {
118+ print_info " Reverting to system default PHP..."
119+
120+ # List of binaries to unlink (must match create_symlinks)
121+ local binaries=(php php-cgi php-config phpize php-fpm phpdbg)
122+
123+ for bin in " ${binaries[@]} " ; do
124+ rm -f " ${HOME} /bin/${bin} "
125+ done
126+
127+ print_success " Symlinks removed. You are now using the system default PHP."
128+ print_info " Verifying version..."
129+ php -v
130+ }
131+
116132# Function to self-update phpv
117133self_update () {
118134 print_info " Checking for updates..."
@@ -332,6 +348,10 @@ while [[ $# -gt 0 ]]; do
332348 action=" self_update"
333349 shift
334350 ;;
351+ system)
352+ action=" system"
353+ shift
354+ ;;
335355 -* )
336356 print_error " Unknown magic spell: $1 "
337357 exit 1
@@ -356,6 +376,7 @@ if [ -z "$action" ]; then
356376 print_info " $0 -i <version> --nocheck : Skip tests during build"
357377 print_info " $0 -e <extension> <version> : Install PHP extension (e.g., 'imagick 81')"
358378 print_info " $0 <version> : Switch to PHP version"
379+ print_info " $0 system : Revert to system default PHP"
359380 print_info " $0 -u, --self-update : Update phpv to the latest version"
360381 print_info " $0 -v : Show version"
361382 exit 1
@@ -374,6 +395,9 @@ install_extension)
374395self_update)
375396 self_update
376397 ;;
398+ system)
399+ switch_to_system
400+ ;;
377401switch)
378402 switch_php_version " $version "
379403 ;;
0 commit comments