Installing xdebug in terminal - php

This may be a dumb question but step4 says:
The instructions should look something like:
1) Download xdebug-2.4.0.tgz (I like to use wget -O ~/downlaods/xdebug-2.4.0.tgz http://xdebug.org/files/xdebug-2.4.0.tgz on Ubuntu)
2) Unpack the downloaded file with tar -xvzf xdebug-2.4.0.tgz
3) Run: cd xdebug-2.4.0
4) Run: phpize (See the Xdebug FAQ if you don’t have phpize.)
Currently i've downloaded and unzipped it on my server following these instructions. and then it says cd into the xdebug-2.4.0 folder but what does run mean.. how do i run it? step four and five are confusing.
How do i run debug?
My output:
[~/public_html/xdebug-2.4.0]$ phpize
grep: /usr/local/include/php/main/php.h: No such file or directory
grep: /usr/local/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/local/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
I read that i have to sudo apt-get install php5-dev
but everytime i try i get this error message.
apt-get: command not found

I don't know much about what to do. I'm looking for info.
But to make apt-get work I've found those steps:
sudo su
cd /usr/ports/sysutils/apt/ && make install clean
More info here
Hope that hepls and sorry for the bad english

Related

How to build a php extensions from tgz file using make?

Background
I use a RedHat machine without root access, no access to the yum packet manager and no Docker support. This is the policy unfortunately at my work.
I have configured Apache and PHP using a tar file in a folder. Also done same for MongoDB, now I try to configure the PHP drivers for MongoDB according to these instructions:
https://docs.mongodb.com/drivers/php/
However I get stuck on the first bullet:
sudo pecl install mongodb
Problem
Do I need PECL? Can the extension be downloaded manually, and added to PHP?
I have tried to download the mongodb extension manually from:
https://pecl.php.net/package/mongodb
How to compile it mongodb.so? I tried to run pecl on a machine where I have root access then I saw it downloaded the mongodb-1.10.0.tgz and run make (in output when installing).
When I unpack the tgz file manually, I am not able to run make. How to use the makefile.frag? How to run make?
Here is a link on how to build mongodb.so:
https://www.php.net/manual/en/mongodb.installation.manual.php
git clone https://github.com/mongodb/mongo-php-driver.git
cd mongo-php-driver
git submodule update --init
phpize
./configure
make all
sudo make install
You can also unpack the mongodb-1.10.0.tgz file with:
tar -xvf mongodb-1.10.0.tgz
phpize
make all
sudo make install

Unable to use PHPIZE after update to MacOS Mojave

What i should do when i run PHPIZE and get the error below ? I already installed xcode command line tools.
grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:
Zend Module Api No:
Zend Extension Api No:
Potential better solution - force reinstall the header files. Fixed a ton of problems for me system wide.
Running the following command will reinstall the developer tools header files and should fix the issue.
$ sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
For some reason, I found Xcode command line tools was not installed completely on my Mac, Finally I solved this problem as follow:
1. xcode-select --install
2. cd /Library/Developer/CommandLineTools/Packages/
3. open macOS_SDK_headers_for_macOS_10.14.pkg
Note: After doing step2, if there is no .pkg file in the dir. maybe this solution will not help you.
find the phpize and edit it,
~$ whereis phpize
phpize: /usr/local/bin/phpize
~$ vim /usr/local/bin/phpize
in my phpize script it is like that
prefix='/usr/local/php7' ## where you should edit
datarootdir='/usr/local/php7/php'
exec_prefix="`eval echo ${prefix}`"
phpdir="`eval echo ${exec_prefix}/lib/php`/build"
includedir="`eval echo ${prefix}/include`/php"
...
phpize_get_api_numbers()
{
# extracting API NOs:
PHP_API_VERSION=`grep '#define PHP_API_VERSION' $includedir/main/php.h|$SED 's/#define PHP_API_VERSION//'`
ZEND_MODULE_API_NO=`grep '#define ZEND_MODULE_API_NO' $includedir/Zend/zend_modules.h|$SED 's/#define ZEND_MODULE_API_NO//'`
ZEND_EXTENSION_API_NO=`grep '#define ZEND_EXTENSION_API_NO' $includedir/Zend/zend_extensions.h|$SED 's/#define ZEND_EXTENSION_API_NO//'`
}
if you comfirm that you have the header file but the phpize script configure is wrong ,you can edit the row
prefix='/usr/local/php7'
and php.h is in
$ pwd
/usr/local/php7/include/php/main
$ ls php.*
php.h
if not ,you can compile php by yourself
I had the same issue as described above, only I was trying to install xdebug on macOS Mojave.
I resolved the issue by executing:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

trying to install xdebug: configure file not found

I am following these instructions to download xdebug: http://xdebug.org/wizard.php. The output of the wizard was this:
Summary
Xdebug installed: no
Server API: Apache 2.0 Handler
Windows: no
Zend Server: no
PHP Version: 5.4.17
Zend API nr: 220100525
PHP API nr: 20100525
Debug Build: no
Thread Safe Build: no
Configuration File Path: /bitnami/mampstack-osx-x64/output/php/lib
Configuration File: /Applications/mampstack-5.4.17-2/php/etc/php.ini
Extensions directory: /Applications/mampstack-5.4.17-2/php/lib/php/extensions
giving these instructions
Download xdebug-2.2.3.tgz
Unpack the downloaded file with tar -xvzf xdebug-2.2.3.tgz
Run: cd xdebug-2.2.3 Run: phpize (See the FAQ if you don't have phpize.
Run: ./configure
Everything works properly up to step #4. In step #4 I get
MyMacBookAir$ ./configure
-bash: ./configure: No such file or directory
If I look in xdebug-2.2.3 I see that there is no file called configure -- but I do see a file called configure.in. Did I get .tgz that is missing the configure file? Or am I not understanding some part of the instructions properly?
Actually it could be a problem with phpize command
If it complains for autoconf ("Cannot find autoconf") then try next
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-latest.tar.gz
tar xzf autoconf-latest.tar.gz
cd autoconf-*
./configure --prefix=/usr/local
make
sudo make install
#akh2103 I assume you have your problem fixed by now but I leave this answer here for anybody else has this issue.
I've just suffered from the same problem. For me I was installing it on a linked directory
eg ~/Downloads was actually on /media/1234/Data/Downloads
For some reason when I transferred all my downloads onto my other HDD the other day the permissions have been haywire.
After I moved the initial xdebug file to my ~/.Desktop and unpacked it there I ran
chmod -R 0755 x-debug/
and then ran phpize
Then I could see the configure file that didn't appear when I tried to do it on my other HDD.
I hope this helps anybody else who suffered from this problem.
John

phpize reports "Cannot find config.m4"

I am trying to run the 'phpize' command on MacOSx Mountain Lion, but this is what I get:
Cannot find config.m4.
Make sure that you run '/opt/local/bin/phpize' in the top level source directory of the module
How do I resolve this error ?
The phpize command is meant to be run at the top level of an extension source dir (this source dir should contain a file name config.m4).
See http://php.net/manual/en/install.pecl.phpize.php for more information.
In plain English, it means you're running the command from the wrong directory. You need to be in the directory that contains the source for the extension you're trying to install.
For example, if you're trying to install mcrypt, like I was when I came across this stack overflow page, you need to be in php-5.6.24/ext/mcrypt and then run the command.
My problem was that I was trying to execute the command just to see if I had it installed.
Trying to execute the command alone gives you that error, only use it inside the directory (most likely you downloaded) that contains the extension that you're trying to install.
Here some instructions to install Xdebug for php7.2 for example.
Take special care in step 3 and 4, first you change dir to the unpacked downloaded extension and then you run phpize.
http://qiita.com/MasatoYoshioka#github/items/e542f39a6f1a3bc1f71e
In terminal
ls config.m4
ls config*
config.w32 config0.m4
cp config0.m4 config.m4
cd /usr/local/src/php-5.3.29/ext/zlib
phpize
./configure
make clean && make && make install
nano php.ini
add extension=zlib.so
got inside the xdebug folder than try to run the phpize
Sometimes, using the pecl installer is not an option. This could be because you're behind a firewall, or it could be because the extension you want to install is not available as a PECL compatible package, such as unreleased extensions from git. If you need to build such an extension, you can use the lower-level build tools to perform the build manually.
The phpize command is used to prepare the build environment for a PHP extension. In the following sample, the sources for an extension are in a directory named extname:
$ cd extname
$ phpize
$ ./configure
$ make
# make install
first run ./configure it will create config.m4 file, rest the steps are same

How to install php-gtk in the Acer Aspire One?

I have an application that works pretty well in Ubuntu, Windows and the Xandros that come with the Asus EeePC.
Now we are moving to the Acer Aspire One but I'm having a lot of trouble making php-gtk to compile under the Fedora-like (Linpus Linux Lite) Linux that come with it.
I managed to get all components needed for Phoronix test suite installed on Fedora but still have one issue.
# phoronix-test-suite gui
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
/usr/bin/phoronix-test-suite: line 28: [: /usr/share/phoronix-test-suite: unary operator expected
You need two packages that aren't in Fedora, php-gtk, but php-gtk also has it's dependency - pecl-cairo
php-gtk needs to be downloaded from svn because tar.gz version is really old and doesn't work with php 5.3
Here is how I got all components built.
su -c "yum install php-cli php-devel make gcc gtk2-devel svn"
svn co http://svn.php.net/repository/pecl/cairo/trunk pecl-cairo
cd pecl-cairo/
phpize
./configure
make
su -c "make install"
cd ..
svn co http://svn.php.net/repository/gtk/php-gtk/trunk php-gtk
cd php-gtk
./buildconf
./configure
make
su -c "make install"
cd ..
wget http://www.phoronix-test-suite.com/download.php?file=phoronix-test-suite-2.8.1
tar xvzf phoronix-test-suite-2.8.1.tar.gz
cd phoronix-test-suite
su -c "./install-sh"
So please take where I left to get Phoronix test suite running on Fedora.
Hi Guys well I finally got this thing to work the basic workflow was this:
#!/bin/bash
sudo yum install yum-utils
#We don't want to update the main gtk2 by mistake so we download them
#manually and install with no-deps[1](and forced because gtk version
#version of AA1 and the gtk2-devel aren't compatible).
sudo yumdownloader --disablerepo=updates gtk2-devel glib2-devel
sudo rpm --force --nodeps -i gtk2*rpm glib2*rpm
#We install the rest of the libraries needed.
sudo yum --disablerepo=updates install atk-devel pango-devel libglade2-devel
sudo yum install php-cli php-devel make gcc
#We Download and compile php-gtk
wget http://gtk.php.net/do_download.php?download_file=php-gtk-2.0.1.tar.gz
tar -xvzf php-gtk-2.0.1.tar.gz
cd php-gtk-2.0.1
./buildconf
./configure
make
sudo make install
If you want to add more libraries like gtk-extra please type ./configure -help before making it to see the different options available.
After installing you'll need to add php_gtk2.so to the Dynamic Extensions of /etc/php.ini
extension=php_gtk2.so
Sources:
[1]: Dependency problems on Acer Aspire One Linux
If you could give us more to go on than just trouble making it compile; we might be better able to help you with your issues.

Categories