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
Related
I am trying to update laravel using composer update on ubuntu 06.04 but everytime i run composer update this warning always comes up.
PHP Warning: PHP Startup: Unable to load dynamic library 'mcrypt.so' (tried: /usr/lib/php/20170718/mcrypt.so (/usr/lib/php/20170718/mcrypt.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/mcrypt.so.so (/usr/lib/php/20170718/mcrypt.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Does anyone knows how to deal it?
I am using php7.2
I faced similar issue when I installed Php7.2 on Ubuntu 18. Though I had installed mcrypt using PECL still I get the error mentioned in the question.
I did following to fix it
sudo apt-get install php-pear php7.2-dev
then uninstalled
pecl uninstall mcrypt
Now reinstall mcrypt
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install libmcrypt-dev
sudo pecl install mcrypt-1.0.1
When you are shown the prompt
libmcrypt prefix? [autodetect] :
Press [Enter] to autodetect.
After success installing mcrypt using pecl, you should add mcrypt.so extension to php.ini.
The output will look like this:
...
Build process completed successfully
Installing '/usr/lib/php/20170718/mcrypt.so' ----> this is our path to mcrypt extension lib
install ok: channel://pecl.php.net/mcrypt-1.0.1
configuration option "php_ini" is not set to php.ini location
You should add "extension=mcrypt.so" to php.ini
Now restart Apache
sudo service apache2 restart
Grab installing path and add to cli and apache2 php.ini configuration.
sudo bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/cli/conf.d/mcrypt.ini"
sudo bash -c "echo extension=/usr/lib/php/20170718/mcrypt.so > /etc/php/7.2/apache2/conf.d/mcrypt.ini"
First, open up a terminal window and install the necessary dependencies with the commands:
sudo apt-get -y install gcc make autoconf libc-dev pkg-config
sudo apt-get -y install php7.2-dev
sudo apt-get -y install libmcrypt-dev
Once the dependencies have been installed, you can install mcrypt with the command:
sudo pecl install mcrypt-1.0.1
And there you go. Mcrypt is now installed. Go back to the process of installing whatever server software that depends upon this extension and you should be good to go.
For (>= PHP 7.3) you can use the following command:
sudo pecl install mcrypt-1.0.2
I faced this problem when I upgraded my PHP to 7.3
I found mcrypt.so was still present in /etc/php/7.3 that should not be as it is deprecated in php 7.3 so just deleting mcrypt.so from /etc/php/7.3 solved issue.
I used following commands:
cd /etc/php/7.3
sudo rm -rf mcrypt.so
sudo service apache2 restart
İts is worked for me.
export LC_ALL="C"
export LANG="C
sudo pecl install mcrypt-1.0.1
Also, if you're using php 7.2 & are getting this error and you know do not want/need mcrypt, but do not know how to exclude it.... You need edit your php.ini file and either comment this out by using a semi-colon in front of it:
; extension=mcrypt.so
or just delete that line entirely.
This is the extension that I am trying to install: https://github.com/EVODelavega/phpkafka
The messages passed to the queue should be in JSON format.
Currently, I am getting installation errors:
1. The instructions ask me to install librdkafka.
2. The installation link for the above step is this. I am unable to install using the 1st and 4th method. This is the error:
checking for librdkafka/rdkafka.h" in default path... not found
configure: error: Please reinstall the rdkafka distribution
Quick Install Steps:
Step 1 Install PHP pecl and pear commands:
sudo apt install php-pear
Step 2 Install librdkafka
sudo apt-get install -y librdkafka-dev
Step 3 Install PECL-package
sudo pecl install rdkafka
Step4 Enable PHP-extension in PHP config. Add to php.ini
sudo nano /etc/php/7.4/cli/php.ini
extension=rdkafka.so
Step 4 Restart apache server
sudo service apache2 restart
because you need another package librdkafka,you should install librdkafka first
$ git clone https://github.com/edenhill/librdkafka.git
$ cd librdkafka
$ ./configure
$ make && make install
this way can resolve your problem
For Linux Debian Stretch (9.13) actual flow is:
Install PHP pecl and pear commands:
sudo apt install php-pear
FYI: Depends on your installed PHP version you may need to use concrete version package. For example: php7.2-pear.
Add backports repository. Current ext-rdkafka depends on librdkafka version 0.11.0 or greater. So follow official instructions, but use stretch-backports.
Install librdkafka-dev package from backports:
sudo apt -t stretch-backports install librdkafka-dev
Update apt:
sudo apt update
Install PECL-package:
sudo pecl install rdkafka
Enable PHP-extension in PHP config. Add to php.ini:
extension=rdkafka.so
FYI: You need to restart php-fpm service to apply new config params.
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
I'm trying to install rubedo cms, and get an error in the php application:
Zend\I18n\Validator component requires the intl PHP extension
These are the steps I've taken to install the extension
sudo port install php5-intl
sudo cp /opt/local/lib/php54/extensions/no-debug-non-zts-20100525/intl.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
sudo pico /private/etc/php.ini
add
extension=intl.so
then
sudo apachectl restart
I found the problem.
I needed the right version of intl. I'm running php 5.3, which I think is the reason that when I ran:
sudo port install php53-intl
it worked.
Significantly, the parent folder also was named the same in the src and destination in the copy.
So my final process was:
sudo port install php53-intl
sudo cp /opt/local/lib/php54/extensions/no-debug-non-zts-20090626/intl.so /usr/lib/php/extensions/no-debug-non-zts-20090626/
sudo pico /private/etc/php.ini
add
extension=intl.so
then
sudo apachectl restart
Use Brew.
e.g. brew install php56-intl
That's it! :-)
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