Wednesday, September 6, 2023

How to Configure Xdebug in Mac with XAMPP

 To install with single command:

pecl install xdebug

Or Follow the instructions below:

https://xdebug.org/wizard

Installation Wizard

Summary

  • Xdebug installed: no
  • Server API: Apache 2.0 Handler
  • Windows: no
  • Zend Server: no
  • PHP Version: 8.2.4
  • Zend API nr: 420220829
  • PHP API nr: 20220829
  • Debug Build: no
  • Thread Safe Build: no
  • OPcache Loaded: no
  • Configuration File Path: /Applications/XAMPP/xamppfiles/etc
  • Configuration File: /Applications/XAMPP/xamppfiles/etc/php.ini
  • Extensions directory: /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20220829

Instructions

 





  1. Download xdebug-3.2.2.tgz
  2. Install the pre-requisites for compiling PHP extensions.
    On your Mac, we only support installations with 'homebrew', and brew install php && brew install autoconf should pull in the right packages.
  3. Unpack the downloaded file with tar -xvzf xdebug-3.2.2.tgz
  4. Run: cd xdebug-3.2.2
  5. Run: phpize (See the FAQ if you don't have phpize).

    As part of its output it should show:

    Configuring for:
    ...
    Zend Module Api No:      20220829
    Zend Extension Api No:   420220829

    If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.

  6. Run: ./configure
  7. Run: make
  8. Run: cp modules/xdebug.so /Applications/XAMPP/xamppfiles/lib/php/extensions/no-debug-non-zts-20220829
  9. Update /Applications/XAMPP/xamppfiles/etc/php.ini and add the line:
    zend_extension = xdebug
  10. Restart the Apache Webserver

Enabling Features

Now Xdebug is installed, you can enable its features. Please refer to the dedicated sections in the documentation about information on how to enable and configure these Xdebug features. Where these sections refer to php.ini or similar, please remember to use /Applications/XAMPP/xamppfiles/etc/php.ini:

  • Development Helpers — help you get better error messages and obtain better information from PHP's built-in functions.
  • Step Debugging — allows you to interactively walk through your code to debug control flow and examine data structures.
  • Profiling — allows you to find bottlenecks in your script and visualize those with an external tool.

Tuesday, September 5, 2023

Mac OS PHP and XAMPP path setup

Open file dependency profile of Mac:

sudo vi ~/.zshrc or ~/.bash_profile

Now enter the following linese and save the file from your editor vi or nano:

export XAMPP_HOME=/Applications/XAMPP
export PATH=${XAMPP_HOME}/bin:${PATH}
export PATH

Now refresh the terminal and check path using the following command staying in the same terminal without closing:

exec $SHELL -l;
which php

Saturday, September 2, 2023

Set HTTP to HTTPS redirect in CWP


RewriteCond %{HTTPS} off
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Friday, August 25, 2023

How to clear cache from Mailwizz

 /usr/bin/php -q /home/cm/public_html/apps/console/console.php clear-cache --verbose=1

Sunday, August 13, 2023

Sunday, August 6, 2023

Repeat Rows At Excel Bottom using VBA

 Sub repeatBotRows()


Dim botRows As Range, botCount As Long

Dim firstPgBk As Long, LasRow As Long

Dim totPages As Long, n As Long, m As Long


Application.ScreenUpdating = False

Application.DisplayAlerts = False

Application.Calculation = xlCalculationManual


Set botRows = Range("2:7")

Sheets("Sheet1").Copy after:=Sheets("Sheets1")

ActiveSheet.Name = "printOrig"

With ActiveSheet.PageSetup

.PrintTitleRows = "$1:$1"

End With

firstPgBk = ActiveSheet.HPageBreaks(1).Location.Row - 1

botCount = botRows.Rows.Count

LasRow = Cells.Find("*", [a1], , , xlByRows, xlPrevious).Row

totPages = Application.Ceiling(LasRow / (firstPgBk - botCount - 1), 1)

Range(Rows(firstPgBk - botCount + 1), Rows(firstPgBk)).Select

Selection.EntireRow.Insert Shift:=xlDown

botRows.Copy Range("A" & firstPgBk - botCount + 1)


n = 2

m = 0

Do

Range(Rows(firstPgBk * n - botCount - m), Rows(firstPgBk * n - m - 1)).Select

Selection.EntireRow.Insert Shift:=xlDown

botRows.Copy Range("A" & firstPgBk * n - botCount - m)

n = n + 1

m = m + 1

Loop Until n > totPages

Application.Calculation = xlCalculationAutomatic

' ActiveSheet.PrintOut

' ActiveSheet.Delete

ActiveSheet.Buttons.Delete

Application.DisplayAlerts = True

End Sub


Repeat excel rows at bottom

 Sub MyFooter()

Dim xTxt As String

Dim xAddress As String

Dim xRg As Range

Dim xCell As Range

On Error Resume Next

xAddress = ActiveWindow.RangeSelection.Address

Set xRg  = Application.InputBox("Select the row you will insert repeatedly at the bottom:", "Kutools for Excel", xAddress, , , , , 8)

If xRg Is Nothing Then Exit Sub

For Each xCell In xRg

xTxt = xTxt & xCell.Value & " "

Next

ActiveSheet.PageSetup.LeftFooter = xTxt

End Sub

Extract Domain from email in Excel or Google sheet

  =TEXTAFTER( A2 , "@") or, =MID(A1, FIND("@", A1) + 1, LEN(A1) - FIND("@", A1))