today I upgraded ubuntu 14.10 to 15.04 and xdebug is not working anymore. I use eclipse Luna Service Release 2.
I've tried reinstalling xdebug through pecl, apt-get, even manual install following http://xdebug.org/wizard.php instructions (pasting my phpinfo() output).
I have xampp, in /opt/lampp directory.
I've tried several locations for "zend_extension" in /opt/lampp/etc/php.ini such as zend_extension=/usr/lib/php5/20131226/xdebug.so and zend_extension =/opt/lampp/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
When I hit debug on eclipse, the browser receives the order, and the parameters ?XDEBUG_SESSION_START=ECLIPSE_DBGP&KEY= are included in the url, but the execution will not stop on any breakpoint.
When I run phpinfo() xdebug is not showing as an installed module.
any hints?
I removed the phpinfo() output for clarification after posting the answer.
Finally I found no solution, so I had to remove all the lamp package, and I reinstalled everything as independent modules following this tutorial: http://www.unixmen.com/how-to-install-lamp-stack-on-ubuntu-15-10/, then I did this to install xdebug:
1.- Install xdebug extension for PHP
$ sudo apt-get install php5-xdebug
2.- Check the location of "xdebug.so" module, which is kept under "/usr/lib/php5/20131226", where the number depends on the PHP version.
3.- The installation creates a configuration file "/etc/php5/mods-available/xdebug.ini" with the following line (otherwise, create one):
zend_extension=xdebug.so
NOTE: in the previous version, you need to specify the full-path filename, e.g., "zend_extension=/usr/lib/php5/20121212/xdebug.so".
Include the following lines into "xdebug.ini" to enable remote debugging from Eclipse PDT:
xdebug.remote_enable = On
xdebug.remote_port = 9000
xdebug.remote_host = 127.0.0.1
Recall that Apache loads PHP configuration files "/etc/php5/apache2/php.ini" and "/etc/php5/apache2/conf.d/*.ini". To enable the above xdebug configuration file, create the following symlink in "/etc/php5/apache2/conf.d":
$ cd /etc/php5/apache2/conf.d
$ sudo ln -s ../../mods-available/xdebug.ini 20-xdebug.ini
$ ls -l
lrwxrwxrwx 1 root root 31 Sep 11 19:42 20-xdebug.ini -> ../../mods-available/xdebug.ini
4.- Check PHP configuration file "/etc/php5/apache2/php.ini" for the following settings:
; Turn on the error display for development system,
; but not for production system.
display_errors = On
; Format error in HTML
html_errors = On
5.- Restart the Apache2:
$ sudo service apache2 restart
And it works like a charm
For now Xdebug (Please only use uptil Xdebug 2.6, because later versions had some issues with debugging); only work up to php 7.2 (i.e. less than 7.3). So if you had any other version installed like php 7.3 or 7.4 then you had to also install php 7.2 along side your current php version (mostly because now by default latest version is installed through apt). and then update in between alternatives.
To set PHP 7.0 as the default, run
update-alternatives --set php /usr/bin/php7.0
To set PHP 7.2 as the default, run
update-alternatives --set php /usr/bin/php7.2
To set PHP 7.3 as the default, run
update-alternatives --set php /usr/bin/php7.3
To set PHP 7.4 as the default, run
update-alternatives --set php /usr/bin/php7.4
Before we can configure Apache to use PHP 7.2, we need to disable the new (or old) version of PHP by typing
a2dismod php7.4
Now enable the newly installed PHP 7.2 version with the following command:
a2enmod php7.2
Restart the Apache web server for the changes to take effect:
sudo systemctl restart apache2
Related
I installed Xdebug on PHP 7.3 using pecl install xdebug
When I add these settings to /etc/php/7.3/apache2/php.ini and reload Apache the page fails and says no data sent to server.
xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
zend_extension="/usr/lib/php/20180731/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.halt_level=E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE
xdebug.scream=1
Not sure why it's not working.
(In the original version of your question, your configuration was commented out, now you've edited that bit out, leaving the next couple of paragraphs kinda out of the loop)
Despite the documentation stating that the has character (#) is no longer recognized as a valid comment character since PHP 7.0:
it seems that php will happily treat those lines as commented nonetheless in configuration files. Everything afer the hash is ignored by the interpreter.
So those configuration lines are completely ineffective.
To verify that your configuration is being loaded, create a simple file like this:
<php
phpinfo();
Loading this file will tell you everything about PHPs configuration. If Xdebug has been successfully loaded, you'll see something like this:
And down below the configuration settings loaded:
These are the most important settings, that actually load and enable the Xdebug extension:
zend_extension="/usr/lib/php/20180731/xdebug.so"
xdebug.remote_enable=1
Important: You need to check that /usr/lib/php/20180731/xdebug.so actually exists, and if not find the actual location of your xdebug module.
The next line assumes that the webserver and the browser are installed on the same machine on the same IP, which might be true for a simple setup:
xdebug.remote_host=127.0.0.1
As an alternative, you can tell Xdebug to connect back to whichever IP has made the orginal request
xdebug.remote_connect_back=On
With the following line you are telling on which port your IDE is listening to. It's 9000 by default, so you'll normally would not need to set it unless you need to listen to a non-standard port (e.g. debugging several projects at the same time, against different interpreters). But normally, you can omit this line safely:
xdebug.remote_port=9000
Once the module is loaded and enabled, you can also configure some Xdebug settings using an environment variable. Specifically xdebug.remote_host, xdebug.remote_port, xdebug.remote_mode and xdebug.remote_handler
E.g:
export XDEBUG_CONFIG="remote_host=192.168.0.3 remote_port=9005"
xdebug is not compatible with php7.3 for releases < 2.7
you may install xdebug beta version which is make-compatible with php7.3:
pecl install xdebug-beta
https://bugs.xdebug.org/view.php?id=1584
Update:
XDEBUG has released a new version, and it has different configurations. The new version is compatible with PHP>=7.4. Check it out:
https://xdebug.org/docs/install
To install xdebug on php7.3 run the following commands:
sudo update-alternatives --set phpize /usr/bin/phpize7.3
sudo update-alternatives --set php /usr/bin/php7.3
sudo update-alternatives --set php-config /usr/bin/php-config7.3
Now download source code and install by running the following commands:
cd /tmp
wget http://xdebug.org/files/xdebug-2.8.0.tgz
tar -xzvf xdebug-2.8.0.tgz
cd xdebug-2.8.0
phpize
./configure
sudo make
sudo make install
I have recently updated my Ubuntu version from 16.04 to 18.0.4 with PHP version upgraded to 7.2. I haven't been able to log on to my Wordpress websites due to the following error:
Your php installation appears to be missing the mysql extension which is required by Wordpress
What I have tried:
sudo apt-get update & sudo apt-get -y install php-mysql
sudo update-alternatives --set php /usr/bin/php7.2
while checking if the last one worked with wp --info, I also got the following warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib/php/20170718/mysqli (/usr/lib/php/20170718/mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/mysqli.so (/usr/lib/php/20170718/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0
These were in fact missing from php.ini. I added both
extension=/usr/lib/php/20170718/mysqli
and
extension=/usr/lib/php/20170718/mysqlnd.
The PHP warning disappeared, but the MySQL extension still seems to be missing.
The php.ini file is located at /etc/php/7.2/cli/php.ini. I restarted apache after each change I made.
Would you have any other solution that might work?
1.First check which version install in your pc by using this command :
php -v
2.for example if you getting 7.2 run like this (based on php version )
sudo apt-get install php7.2-common php7.2-mysql
3.After install MySql restart apache server
sudo service apache2 restart
I am adding my answer here - though the circumstances are slightly different. I upgraded my Debian installation - and in the process php was upgraded from php 5 to php 7.0
It turns out that apache2 was still loading the php5 module and not the php7.0 module.
I needed to run the below:
sudo a2dismod php5
sudo a2enmod php7.0
sudo systemctl restart apache2
Subsequently, my web pages loaded up.
i solved this type of error in my .htaccess using the below code on a shared server that uses cpanel
# END WordPress
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php71” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php71 .php .php7 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit
A combination of the solutions above helped me.
After updating I couldn't reach my sites anymore, so I altered the code like this:
sudo a2dismod php*
sudo a2enmod php8.0
sudo systemctl restart apache2
I finally managed to find the solution to my problem.
This particular project runs on PHP 7.0., so I need to switch to the older version of PHP in order to work on it.
For AWS EC2 ubuntu Nginx Server
1.First check which version install in your pc by using this command :
php -version or which php
2.for example if you getting 7.4.33 run like this (based on php version )
apt install php7.4-mysql
3.After install MySql restart apache server
sudo systemctl restart apache2
I have the following packages installed on Ubuntu 16.04:
apache2 2.4.18-2ubuntu3.1
php-gettext 1.0.11-2build1
gettext 0.19.7-2ubuntu3
php7.0 7.0.15-0ubuntu0.16.04.4
The only mention of gettext when I call phpinfo() is in the module authors section ("GetText = Alex Plotnick"), so I would assume that support has been compiled in correctly.
It seems that gettext isn't loaded properly into PHP, because the following code:
<?php
if ( false === function_exists('gettext') ) {
echo "You do not have the gettext library installed with PHP.";
exit(1);
}
Does indeed print "You do not have the gettext library installed with PHP."
Apart from documentation, the only php-gettext files I have installed are:
/usr/share/php/php-gettext/gettext.inc
/usr/share/php/php-gettext/streams.php
/usr/share/php/php-gettext/gettext.php
I haven't really touched any php or apache config (apart from try and install icingaweb2)
Can anyone see what my issue could be?
Update
More debugging...
me#phoenix:~$ ls /etc/php/7.0/apache2/conf.d/
10-mysqlnd.ini 20-dom.ini 20-intl.ini 20-mbstring.ini 20-pdo_mysql.ini 20-wddx.ini 20-xmlwriter.ini
15-xml.ini 20-imagick.ini 20-ldap.ini 20-mysqli.ini 20-simplexml.ini 20-xmlreader.ini 20-xsl.ini
me#phoenix:~$ sudo a2dismod php5
ERROR: Module php5 does not exist!
me#phoenix:~$ sudo find / -name gettext.so
/usr/lib/php/20151012/gettext.so
/usr/lib/x86_64-linux-gnu/perl5/5.22/auto/Locale/gettext/gettext.so
It should work out of the box after installation. Have you restarted Apache? Try first sudo apache2ctl restart or sudo service apache2 restart on the terminal console. If both should not work on your system, try sudo /etc/init.d/apache2 restart.
Check if there does exist a file /etc/php/7.0/apache2/conf.d/20-gettext.ini (or similar path on your system) containing the line
extension=gettext.so
There must not be a semicolon prepended, otherwise it is commented out. Some installations may also configue that line within the basic php configuration file /etc/php/php/7.0/php.ini, however the debian derivate's way is to use extra files in the conf.d folder.
You can enable PHP modules (e.g. gettext) on the command line
sudo phpenmod -v 7.0 gettext
If this does not work, edit the configuration manually.
Finally restart your Apache service as described above.
Check also if Apache is running the expected PHP version 7.0 with the following line in your PHP page
echo phpversion();
You can enable / disable Apache2 modules from multiple installed PHP versions on the command line
sudo a2dismod php5
sudo a2enmod php7.0
sudo apache2ctl restart
I am using https://github.com/wilmoore/php-version to switch between php versions on my local machine, installed within ~/php/versions. Currently setting up separate VMs with different versions of php installed is not an option.
When I switch php version through the command line using the linked tool, I see it listed as php 7. This also works when using php -v. I have restarted terminal and the machine and it still says php 7.
I have updated composer.json to require php 7.0.2 and greater. Yet when I use phpinfo() in my laravel application, it always states the default PHP Version 5.5.9-1ubuntu4.14.
Where is laravel pointing to the php distribution in my Ubuntu 14.04.3 machine and where can I change this path?
EDIT: I am using Apache. I can see in the phpinfo() output that it is reading the ini file from /etc/php5/apache2/php.ini. I have looked in this file but cannot see where to point to the php distribution.
first make sure that php7.*.conf and php7.*.load files are exist in /etc/apache2/mods-available directory.
then use sudo a2enmod php7.* to enable the mod
use sudo a2dismod php5.* to disable the mod
after running the two commands restart your apache2 server
using sudo systemctl restart apache2
The Apache loads the php5_module library in /etc/apache2/mods-available/php5.load.
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
If you know the loactions of your alternative libraries you can change them in this file.
After editing you need to restart your apache. sudo service apache2 restart or sudo systemctl restart apache2.service
Had the same issue on ubuntu16.
ls -l /etc/apache2/mods-available/php7* ,
showed 2 versions -
/etc/apache2/mods-available/php7.0.conf
/etc/apache2/mods-available/php7.2.conf
Deleted the /etc/apache2/mods-available/php7.0.conf, restarted apache2, and phpinfo() via apache2 showed php7.2
I cant make netbeans 6.9 work with xdebug. Strangely I tried telnet
nerkn#nerkn-laptop:~/www/nerkl$ telnet localhost 9000
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
nerkn#nerkn-laptop:~/www/nerkl$ telnet bogaz 9000
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
also I cant find debugclient.
xdebug is working: I got logging and pretty error reporting.
What can I do?
I just want a basic step by step trace.
xdebug is working: I got logging and pretty error reporting.
You need to enable remote debugging.
Try this in xdebug.ini:
[xdebug]
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_host = localhost
xdebug.remote_port = 9000
The solution that worked for me; solved the debugging issue of netbeans it did not solved telnet "Connection refused" issue.
My solution:
In php.ini file (i.e. located in /etc/php/7.2/apache2/php.ini); comment the option in [xdebug] section (usually the last section at the end of the file)
;xdebug.remote_autostart=on
then restart the apache service
sudo systemctl restart apache2.service
try restarting the netbeans if this option was enabled and you disabled it.
#troelskn it not the xdebug.ini file; it is php.ini file.
Caution: If for now Xdebug only work with php 7.2. (Please only use uptil Xdebug 2.6, because later versions had some issues with debugging).
So if you had any other version installed like php 7.3 or 7.4 then oyu had to also install php 7.2 along side your current php version (mostly because now by default latest version is installed through apt). and then update in between alternatives.
To set PHP 7.0 as the default, run
update-alternatives --set php /usr/bin/php7.0
To set PHP 7.2 as the default, run
update-alternatives --set php /usr/bin/php7.2
To set PHP 7.3 as the default, run
update-alternatives --set php /usr/bin/php7.3
To set PHP 7.4 as the default, run
update-alternatives --set php /usr/bin/php7.4
Before we can configure Apache to use PHP 7.2, we need to disable the new (or old) version of PHP by typing
a2dismod php7.4
Now enable the newly installed PHP 7.2 version with the following command:
a2enmod php7.2
Restart the Apache web server for the changes to take effect:
sudo systemctl restart apache2