How to install xdebug in ubuntu 16.04 in netbeans? - php

Whenever I try to run this code
example#testserver:~$ sudo apt-get install php5-xdebug
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5-xdebug
I get this error "E: Unable to locate package php5-xdebug"
Please help
Thanks

If you're running the default apt installation of PHP on Ubuntu 16.04, then it should be PHP7. If I had to guess from php5-xdebug, then I'd say you were using a command intended for Ubuntu 14.04 or older where the default PHP installation was PHP5. You can verify your PHP version with:
php --version
This is what I see:
PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.8-0ubuntu0.16.04.2, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.0, Copyright (c) 2002-2016, by Derick Rethans
At any rate, you should be able to search available packages for your configuration with:
apt search xdebug
From my relatively fresh Ubuntu 16.04 install without any added PPA's, I get one result:
php-xdebug - Xdebug Module for PHP
So you can install this package by name (note the missing "5" from your command):
sudo apt install php-xdebug
You might also have to restart your webserver. If you're running the stock build of Apache for Ubuntu 16.04:
sudo service apache2 restart

Related

How do I change the default PHP base-version on shell?

I have Centos 7 and Virtualmin installed, with the tipycal php-fpm 5.4, 7.0, 7.1 that you can choice between the versions you prefer on every virtualhost via Virtualmin control panel, and everything works well.
But when I access to the server via SSH and check php -v I get this:
PHP 5.4.16 (cli) (built: Oct 30 2018 19:30:51)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
How can I select another php default/base version for the shell system?
When you issue the php command on the shell it uses the default php version on the server which in your case is php-5.4.16
To use another php version, you have to check where the binaries for those php versions are and invoke them with their full path rather than just typing php.
For example, on CentOS, for PHP 7.2 for example, the full path of the php binary is: /opt/rh/rh-php72/root/usr/bin/php
root#virtualmin /root
» /opt/rh/rh-php72/root/usr/bin/php -v
PHP 7.2.24 (cli) (built: Nov 4 2019 10:23:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24, Copyright (c) 1999-2018, by Zend Technologies
Install versions of PHP in centos 7
Setup Yum Repository
First of all, you need to enable Remi and EPEL yum repositories on your system. Use the following command to install EPEL repository on your CentOS and Red Hat 7/6 systems
Use this command to install EPEL yum repository on your system
sudo yum install epel-release
and now execute one of the following commands as per your operating system version to install the Remi repository.
sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Install PHP 7 on CentOS
Your system is prepared for the PHP installation from yum repositories. Use one of the following commands to install PHP 7.4 or PHP 7.3 or PHP 7.2 or PHP 7.1 on your system based on your requirements.
Install PHP 7.4
yum --enablerepo=remi-php74 install php
Install PHP 7.3
yum --enablerepo=remi-php73 install php
Install PHP 7.2
yum --enablerepo=remi-php72 install php
.
Check version PHP install
php -v
.
PHP 7.4.1 (cli) (built: Dec 17 2019 16:35:58) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Install PHP Modules
You may also need to install additional PHP modules based on your application requirements. The below command will install some more useful PHP modules.
For PHP 7.4
yum --enablerepo=remi-php74 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
For PHP 7.3
yum --enablerepo=remi-php73 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt
For PHP 7.2
yum --enablerepo=remi-php72 install php-xml php-soap php-xmlrpc php-mbstring php-json php-gd php-mcrypt

Install php5.6 curl

I installed on Ubuntu 16.10 the co-existing php packages as outlined in https://askubuntu.com/questions/761713/how-can-i-downgrade-from-php-7-to-php-5-6-on-ubuntu-16-04
I've run apt-get update and apt-get upgrade. When I try to install php-curl I get an error message:
randall#randall-VirtualBox3:/$ sudo apt-get install php5.6-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5.6-curl
E: Couldn't find any package by glob 'php5.6-curl'
E: Couldn't find any package by regex 'php5.6-curl'
randall#randall-VirtualBox3:/$ php -v
PHP 5.6.30-12~ubuntu16.10.1+deb.sury.org+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.5.4, Copyright (c) 2002-2017, by Derick Rethans
randall#randall-VirtualBox3:/$
How do I fix?
To install php5.6-curl or anything, when you ran into trouble
first search your system to ensure that you have it in there.
apt-cache search php | grep -i curl
Result
php5-curl - CURL module for php5
Now use:
apt-get install php5-curl -y
NJOY
u can fix by following steps:-
sudo apt-get install curl
sudo apt-get install php5.6-curl

PHP 5 Upgrade On Ubuntu Not Working With Magento

I had an outdated version of PHP on my system, so attempted to upgrade from 5.5.9 to 5.6.
I followed the following steps on my Digital Ocean Ubuntu droplet:
I installed Ondřej Surý's PPA and selected 5.6 as well as other packages related to the main one, like the XML package.
When I do php -v on my server, it says
PHP 5.6.29-1+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
This indicated to me that the update went through.
But when I restart my apache server and check the error logs, it says
Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.20 configured -- resuming normal operations
I believe the latest version of Magento on my server is giving me this error (HTTP 500) because it is using the wrong version of PHP...
How do I fix this? Thank you.
The digital ocean community site here offered a couple of extra commands:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6 php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml
sudo a2dismod php5
sudo a2enmod php5.6
sudo service apache2 restart
Note the a2dismod and a2enmod steps. The post says:
Without the a2dismod/a2ensmod steps, Apache will continue to see your older version of PHP, even if command line is seeing the new version.

Vagrantfile PHP v5.6 specified but v5.5 installed

I have a Vaprobash VagrantFile building a Ubuntu Nginx stack.
In it I specify PHP v5.6:
php_version = "5.6" //Options: 5.5 | 5.6
However, I run
$ vagrant up
when I ssh into the box and do
$ php -v
it shows PHP 5.5.9-1ubuntu4.20 (cli) (built: Oct 3 2016 13:00:37).
Why wasn't 5.6 installed?
I am not sure this repo has been updated for php after the ppa has been migrated (see https://github.com/oerdnj/deb.sury.org/wiki/PPA-migration-to-ppa:ondrej-php)
basically in scripts/php.sh you need to replace ppa by
sudo add-apt-repository ppa:ondrej/php
(make sure to run sudo apt-get update if you're running this command directly from the VM after the initial provisioning) -
and to install php5.6 you need to run
sudo apt-get install -qq libapache2-mod-php5.6
with this change, you now get
vagrant#vaprobash:~$ php -v
PHP 5.6.28-1+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
If you need additional php modules, make sure to replace the installation by specifying 5.6 in your php version such as
sudo apt-get install -qq php5.6-fpm

Attempted to call function "curl_init"

I know this question was answered a lot of times here but I tried many things and I cannot fix it.
I am developing using symfony 3.
First of all I thought I hadn't php-curl so, I decided to install it doing
sudo apt-get install php-curl
It worked! So, I restarted Apache... and tried again.. and the error jumped again. I saw too I should "delete" the ; of a php.ini line but... surprise! There is not any line with:
;extension=php_curl.dll
I thought then maybe I didn't really install php-curl... so I did:
var_dump(extension_loaded('curl'));
And the answer is:
Current PHP version: 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1
EDIT: I followed this:
And now appears
Current PHP version: 5.6.26-1+deb.sury.org~xenial+1
Then I tried to:
sudo apt-get install php5-curl
And is happens:
tureey#tureey:~$ sudo apt-get install php5-curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5-curl
Actually these are my software stats:
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial
And after do:
php -v
PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
I did and upgrade and update but nothing changes... any solution?
Correct package should be php5.6-curl

Categories