Xdebug with XAMPP in Ubuntu 14.04 - php

System Configuration
Ubuntu 14.04
Xampp v 5.6.3
installed php5-dev after xampp on
sudo /opt/lampp/lampp start
now want to install Xdebug wihin xampp and I tried available 3 method but nothing is working out , please see the whole process.
1)Ubuntu software package
sudo apt-get install php5-xdebug
command exceuted successfully but no such file in .usr/lib/php5/...
uninstalled
2)Tailored Installation Instructions
downloaded xdebug.tar.gz after checking with wizard
ice#cold:~/Downloads/xdebug-2.2.6$ /usr/bin/phpize5
/usr/bin/phpize5 Cannot find config.m4.
Make sure that you run '/usr/bin/phpize5' in the top level source directory of the module
also tried with phpize, /opt/lampp/bin/phpize but not working out
3)PECL Installation
before that let me check with pecl help version
PEAR Version: 1.9.4
PHP Version: 5.5.9-1ubuntu4.5
Zend Engine Version: 2.5.0
Running on: Linux ice-cold 3.13.0-39-generic #66-Ubuntu SMP Tue Oct 28 13:30:27 UTC 2014 x86_64
pecl install xdebug
...
...
Build process completed successfully
Installing '/usr/lib/php5/20121212/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.2.6
configuration option "php_ini" is not set to php.ini location
You should add "zend_extension=xdebug.so" to php.ini
executed completely
I can see the file
644 /usr/lib/php5/20121212/xdebug.so
added below line in /opt/lampp/etc/php.ini
[xdebug]
zend_extension="/usr/lib/php5/20121212/xdebug.so"
restart lampp
but still xdebug icon is missing
Please tell me what is wrong

xdebug is located under xampp folder in
/opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so
on ubuntu 14.04 just search for it in /opt/lampp and copy the full path to it and then open php.ini and replace
;zend_extension=opcache.so
with
zend_extension="/path/xdebug.so"
in my case
zend_extension="/opt/lampp/lib/php/extensions/no-debug-non-zts-20131226/xdebug.so"

edited in /opt/lmapp/etc/php.ini assigned the location of xdebug.so to zend_extension
[xdebug]
zend_extension="/usr/lib/php5/20121212/xdebug.so"
Replace with
[xdebug]
zend_extension="xdebug.so"
and restart lampp and Xdebug is installed.
AS I was not doing this before because Xdebug Docs itself warn not to do this
Note: You should ignore any prompts to add "extension=xdebug.so" to php.ini — this will cause problems.

[xdebug]
zend_extension="xdebug.so"
Replace with
[xdebug]
zend_extension="20160603/xdebug.so"

I have installed it by:
sudo apt install php-pear
sudo pecl channel-update pecl.php.net
sudo apt install php7.2-dev
sudo pecl install xdebug
Read the last part of the output, follow, and add the corresponding zend_extension=... line to your php.ini file. Restart php-fpm (or Apache if you have it as an Apache module), and you'll have XDebug!
In my case:
open /opt/lampp/etc/php.ini
configuration option "php_ini" is not set to php.ini location
You should add "zend_extension=/usr/lib/php/20170718/xdebug.so" to php.ini
sudo /opt/lampp/lampp restart

Just type the command sudo pecl install xdebug
OR
Install it with source code
git clone -b xdebug_2_4 --single-branch https://github.com/xdebug/xdebug/
OR
wget https://github.com/xdebug/xdebug/archive/XDEBUG_2_4_0.zip xdebug.zip && unzip xdebug.zip
cd xdebug
sudo chmod +x ./rebuild.sh && ./rebuild.sh
./configure <CONFIG>
make && sudo make install

Related

How to install Xdebug on Ubuntu?

I'm trying to install xdebug on Ubuntu:
sudo apt-get install php-xdebug
and getting following error:
Need to get 806 kB of archives. After this operation, 4.423 kB of
additional disk space will be used. Err:1
http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64
php-xdebug amd64 2.5.5-3+ubuntu17.10.1+deb.sury.org+1 404 Not Found
E: Failed to fetch
http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/x/xdebug/php-xdebug_2.5.5-3+ubuntu17.10.1+deb.sury.org+1_amd64.deb
404 Not Found E: Unable to fetch some archives, maybe run apt-get
update or try with --fix-missing?
How can I solve this problem ?
First, you need to update local packages using the following command:
sudo apt update
# OR
sudo apt-get update
Now you can install xdebug with the following command:
sudo apt install php-xdebug
And configure it as:
sudo nano /etc/php/7.0/mods-available/xdebug.ini
Add the following code into it:
zend_extension=/usr/lib/php/20151012/xdebug.so
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9005 #if you want to change the port you can change
Note: Directory 20151012 is most likely to be different for you. cd into /usr/lib/php and check which directory in this format has the xdebug.so file inside it and use that path.
And then restart the services:
sudo systemctl restart php7.0-fpm
sudo systemctl restart nginx # If you are using nginx server
sudo systemctl restart apache2 # If you are using apache server
I use the following method and it works
retrieve content from php info
$ php -i> info.txt
copy all the text in the info.txt file then enter the xdebug installation wizard
and follow the ranks available there.
will look like this
Download xdebug-2.7.2.tgz
Install the pre-requisites for compiling PHP extensions.
On your Ubuntu system, install them with: apt-get install php-dev autoconf automake
Unpack the downloaded file with tar -xvzf xdebug-2.7.2.tgz
Run: cd xdebug-2.7.2
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: 20170718
Zend Extension Api No: 320170718
If it does not, you are using the wrong phpize. Please follow this FAQ entry and skip the next step.
Run: ./configure
Run: make
Run: cp modules/xdebug.so /usr/lib/php/20170718
Update /etc/php/7.2/cli/php.ini and change the line
zend_extension = /usr/lib/php/20170718/xdebug.so
How to install Xdebug on Ubuntu
If none of the above solutions worked for you, then your last resort might be to use pecl
If you don't have pecl installed already:
sudo apt -y install php7.3-dev php-pear // replace php7.3 with your version
Run pecl to install xdebug:
sudo pecl install xdebug
At the end of the installation, you may see this output:
Build process completed successfully
Installing '/usr/lib/php/20180731/xdebug.so'
install ok: channel://pecl.php.net/xdebug-3.0.2
configuration option "php_ini" is not set to php.ini location
You should add "zend_extension=/usr/lib/php/20180731/xdebug.so" to php.ini
Open your php.ini file, add the zend_exntension line at the very bottom (skip if pecl was able to place it already):
sudo vim /etc/php/7.3/apache2/php.ini // again replace 7.3 with your version
Finally, restart your webserver, or PHP-FPM, depending on what you are using.
I think that you should update the local package index with the latest changes made in the repositories first by typing the following command :
sudo apt update
Or
sudo apt-get update
The APT package index is essentially a database of available packages from the repositories defined in the /etc/apt/sources.list file and in the /etc/apt/sources.list.d directory.
Credits
For anyone finding this answer, please bear in mind that there are significant changes between xdebug 2 and xdebug 3. There is upgrade guide provided by XDebug here: http://xdebug.org/docs/upgrade_guide
Update for php 7.4.8: In the Xdebug configuration file
/etc/php/7.4/mods-available/xdebug.ini
I had to add the line:
xdebug.force_display_errors = 1
As Xdebug wouldn't work instead.
please, disable ppa/php and run sudo apt install php-xdebug

The mbstring extension is missing

I'm new to linux. Installed apache2, mysql-server, php 7.0 and phpmyadmin on my Linux Mint 18.1.
Installation went fine, but localhost/phpmyadmin gives error (see title).
Tried:
uncommenting "extension_dir" in php.ini
uncommenting mbstring.dll extension in php.ini
making link from /var/www/html/phpmyadmin to /usr/share/phpmyadmin
reinstalling php7.0-mbstring
but neither worked.
I've been restarting Apache as well.
If you have Apache and PHP running correctly, you should install the mbstring extension on PHP and restart Apache:
sudo apt-get install php7.0-mbstring
sudo service httpd restart
Restarting Apache is a step that most people forget about. Some distributions will restart Apache by themselves when you install any PHP extension, other don't.

Error Installing Cake PHP [duplicate]

Using the CakePHP docs, I am trying to install 3.0-beta2 using composer but I got this error:
cakephp/cakephp 3.0.x-dev requires ext-intl * -> the requested PHP extension intl is missing from your system
However, I know for sure that intl is installed (it shows on phpinfo). I'm using PHP 5.4.33/Apache 2.4.10.1
I faced the same problem today. You need to enable the intl PHP extension in your PHP configuration (.ini).
Solution Xampp (Windows)
Open /xampp/php/php.ini
Change ;extension=php_intl.dll to extension=php_intl.dll (remove the semicolon)
Copy all the /xampp/php/ic*.dll files to /xampp/apache/bin
Restart apache in the Xampp control panel
Solution Linux (thanks to Annamalai Somasundaram)
Install the php5-intl extension sudo apt-get install php5-intl
1.1. Alternatively use sudo yum install php5-intl if you are on CentOS or Fedora.
Restart apache sudo service apache2 restart
Solution Mac/OSX (homebrew) (thanks to deizel)
Install the php5-intl extension brew install php56-intl
If you get No available formula for php56-intl follow these instructions.
Restart apache sudo apachectl restart
Eventually you can run composer install to check if it's working. It will give an error if it's not.
I faced the same issue in ubuntu 12.04
Installed: sudo apt-get install php5-intl
Restarted the Apache: sudo service apache2 restart
OS X Homebrew (May 2015):
The intl extension has been removed from the main php5x formulas, so you no longer compile with the --enable-intl flag.
If you can't find the new package:
$ brew install php56-intl
Error: No available formula for php56-intl
Follow these instructions: https://github.com/Homebrew/homebrew-php/issues/1701
$ brew install php56-intl
==> Installing php56-intl from homebrew/homebrew-php
When using MAMP
1 Go to terminal
vim ~/.bash_profile
i
export PATH=/Applications/MAMP/bin/php/php5.6.2/bin:$PATH
Change php5.6.2 to the php version you use with MAMP
Hit ESC,
Type :wq,
hit Enter
source ~/.bash_profile
which php
2 Install Mac Ports
https://www.macports.org/install.php
sudo port install php5-intl OR sudo port install php53-intl
cp /opt/local/lib/php/extensions/no-debug-non-zts-20090626/intl.so /Applications/MAMP/bin/php5.3/lib/php/extensions/no-debug-non-zts-20090626/
{take a good look at the folder names that u use the right ones}
3 Add extension
Now, add the extension to your php.ini file:
extension=intl.so
Usefull Link:
https://gist.github.com/irazasyed/5987693
The error message clearly states what the problem is. You need the intl extension installed.
Step 1: install PHP intl you comfortable version
$sudo apt-get install php-intl
step 2:
For XAMPP Server intl extension is already installed, you need to enable this extension to uncomment below the line in your php.ini file. Php.ini file is located at c:\xampp\php\php.ini or where you have installed XAMPP.
Before uncomment:
;extension=php_intl.dll ;extension=php_mbstring.dll
After uncommenting:
extension=php_intl.dll extension=php_mbstring.dll
Short answer: activate intl extension in php_cli.ini. Thanks to #ndm for his input.
If you are using latest version Ubuntu 16.04 or later just do
sudo apt-get install php-intl
Then restart your apache
sudo service apache2 restart
In my case I was not actually trying to run cakephp locally, I was just trying to get it to auto update locally using composer (because I am playing with writing plugins that you install with composer). Since I don't actually even run it locally I could simply ignore requirements by adding the --ignore-platform-reqs flag.
php composer.phar update --ignore-platform-reqs
In my case, my running php version is 7.1.x on mac OSX .
I installed intl command using brew install php71-intl.
Placing extension=intl.so inside php.ini was no effect at all. Finally i looked for extension installed directory and there i saw intl.so and placed that path (extension=/usr/local/Cellar/php71-intl/7.1.11_20/intl.so) to my php.ini file and it solved my problem.
In my case (xampp PHP 8.0)
Find ;extension=intl in /xampp/php/php.ini
Remove ; and Restart Apache
MAKE this
In XAMPP, intl extension is included but you have to uncomment extension=php_intl.dll in php.ini and restart the server through the XAMPP Control Panel.
In WAMP, the intl extension is “activated” by default but not working. To make it work you have to go to php folder (by default) C:\wamp\bin\php\php{version}, copy all the files that looks like icu*.dll and paste them into the apache bin directory C:\wamp\bin\apache\apache{version}\bin. Then restart all services and it should be OK.
if you use XAMPP do this
1. turn off XAMPP
2. Modifed the php.ini is located in c/:xampp/php/php.ini
3. intl extension is included but you have to uncomment extension=php_intl.dll in php.ini and restart the server through the XAMPP Control Panel.
For Ubuntu terminal:
Please follow the steps:
Step-1:
cd ~
Step -2: Run the following commands
sudo apt-get install php5-intl
Step -3: You then need to restart Apache
sudo service apache2 restart
For Windows(XAMPP) :
Find the Php.ini file:
/xampp/php/php.ini
Update the php.ini file with remove (;) semi colon like mentioned below:
;extension=php_intl.dll to extension=php_intl.dll
and save the php.ini file.
After that you need to
Restart the xampp using xampp control.
Intl Means :Internationalization extension which enables programmers to perform UCA-conformant collation and number,currency,date,time formatting in PHP scripts.
To enable PHP Intl with PECL can be used.
pecl install intl
On a plain RHEL/CentOS/Fedora, PHP Intl can be install using yum
yum install php-intl
On Ubuntu, PHP Intl can be install using apt-get
apt-get install php5-intl
Restart Apache service for the changes to take effect.
That's it
For those who get Package not found error try sudo apt-get install php7-intl then run composer install in your project directory.
I had the same problem in windows
The error was that I had installed several versions of PHP and the Environment Variables were routing to wrong Path of php see image example
I'm using Mac OS High Sierra and none of these worked for me. But after searching a lot I found one that worked!
This may seem trivial, but in fact about 2 months ago some clever guys made changes in brew repository, so doing just: brew install php71-intl will show you error with message that such recipe doesn’t exists.
Fortunately, there is. There is temporary fix in another brew repo, so all you have to do is:
brew tap kyslik/homebrew-php
brew install kyslik/php/php71-intl
SOURCE: http://blastar.biz/2018/04/14/how-to-enable-php-intl-extension-for-php-7-1-using-xampp-on-macos-high-sierra/
I use Linux Ubuntu 20, you can try this:
Check php installed modules:
php -m | grep intl
If there are no result(s) from this command, you should just go ahead and install the module:
sudo apt-get install php7.4-intl
you will need to change *php7.4 to your desired php version.
you should restart apache when you're done:
sudo service apache2 restart

How can enable imap in php.ini

I was trying to install vtiger in my server for installing vtiger we need to enable imap
I tried to enable imap using php.ini by removing ; from extension=php_imap.dll but this does not work. Installing page still showing that imap is not enabled. Can i enable this using any php function. Any help will be greatly appreciated
On Ubuntu and debian a better way is to enable it this way:
sudo apt install php-imap
sudo phpenmod imap
sudo service apache2 restart
On CentOS7+
sudo yum install php-imap
On Ubuntu (<= 14.04) and debian (<= Weezy)
sudo apt-get install php5-imap
sudo php5enmod imap
sudo service apache2 restart
If you are using LAMP server,
First install IMAP using the command on terminal
$ sudo apt-get install php5-imap
Then add this extension=imap.so code to your php.ini file
Restart your server,
$ sudo /etc/init.d/apache2 restart
It will work
sudo apt-get purge php5
sudo apt-get install php5=5.5.9+dfsg-1ubuntu4
sudo apt-get install php5-imap php5-curl
add in php.ini
extension=imap.so
extension=curl.so
reload and restart apache2. clear all your browser history. And Check than.
it may be help.
For PHP7 on LAMP (in Ubuntu)
sudo apt-get install php7.0-imap
sudo service apache2 restart
on centos7 php7
yum install php-imap
Step 1
Open This PC and go to this path mentioned below
Yourdrive:\xampp\php(type : configuration Settings)
Step 2
Open This file in any editor and find ;extension=imap
Step 3
Remove ;(Comment) and save the file and close it.
Step 4
Restart Apache and Mysql from your xampp.
Step 5
Now you'll able to install Laravel-imap Library
Open cmd (Command Prompt) in your project directory and run this command
composer require webklex/laravel-imap

Installing xdebug php profiler on unix

I want to start profiling some PHP code and I have that using xdebug and webgrind seems to be the way to go.
I downloaded xdebug and got these instructions..
Unpack the downloaded file with tar -xvzf xdebug-2.2.3.tgz
Run: cd xdebug-2.2.3
Now, this may be a stupid question, but where exactly should I upload xdebug to so it can be unpacked? Does it matter? I assume it shouldn't be web-accessible?
It is assumed you have Apache2 + PHP5 working already.
sudo apt-get install php5-dev php-pear
Now install xdebug thru PECL.
sudo pecl install xdebug
Now we need to find where xdebug.so went (the compiled module)
martin#martin-dev:/$ find / -name 'xdebug.so' 2> /dev/null
/usr/lib/php5/20060613/xdebug.so
Then edit php.ini:
sudo gedit /etc/php/apache2/php.ini
Add the following line:
zend_extension="/usr/lib/php5/20060613/xdebug.so"
Then restart apache for changes to take effect
sudo /etc/init.d/apache2 restart
and see
http://xdebug.org/docs/install
http://www.anil2u.info/2013/03/install-xdebug-in-ubuntu/
http://2bits.com/articles/setting-up-xdebug-dbgp-for-php-on-debian-ubuntu.html
http://www.michaelbender.net/?p=64

Categories