I've sucessfully installed the blackfire agent, cli tool and probe and it works fine. I've disabled the xdebug module while profiling with bf.
Now I want to use xdebug as I did before, but xdebug does not work, it just won't enter a debugging session. No breakpoint and not even xdebug_break work. A quote from the producers website says:
Known incompatibilities
Please note that PHP compiled with debug are not supported and that
the Probe may conflict with XDebug or XHProf; disable those extensions
when enabling the Probe.
Is there a way to disable the blackfire agent WITHOUT uninstalling the whole blackfire tool chain ? Moving the file /etc/php5/conf.d/90-blackfire.ini to a backup location didn't work.
Update
What works is uninstalling the php agent sudo apt-get remove blackfire-php. But I'm pretty sure there must be a better solution.
You can simply edit the file /etc/php5/conf.d/90-blackfire.ini and comment the following line extension=blackfire.so. Don't forget to restart apache2 or php-fpm
You can run the next command to turn off PHP extensions/modules:
$ sudo phpdismod blackfire
The opposite of this command is:
$ sudo phpenmod blackfire
To apply all changes you must restart your service. Example:
$ sudo service php7.4-fpm restart
Related
I'm trying to run my Symfony website with XDebug, and PHP sockets at the same time.
To run the website:
bin/console server:start
To run the sockets
bin/console sockets:start
My sockets will not start unless XDebug is disabled.
However, I would like XDebug to be enabled for my website.
A solution is to disable XDebug system-wide in php.ini, but I would like to know if it is possible to do so at runtime, so I could unload XDebug before starting sockets when I run sockets:start.
Thank you!
To fix, before PHP 7 people would suggest to comment out the extension from php.ini file. However, in PHP 7 they are no longer in there.
Instead, we use the phpdismod command.
$ sudo phpdismod -s cli xdebug
The -s flag tells it to disable Xdebug for the CLI SAPI (/etc/php/7.0/cli) and not FPM.
And just like that, the warning message should be gone. No need to restart PHP
just assign two different ports for the debugger in the xdebug.ini (the CLI has it's own) -
because it sounds alike, as if it would get stuck due not being able to bind the port.
... this additional port then needs to be set up in the IDE, too.
I'm setting up an Amazon Linux environment, and after installing some modules:
sudo yum install php-xml
sudo yum install php-gd
for example... and installing Imagick, and restarting (sudo service httpd restart) it does not seem to be installing for PHP-Apache. I'm using the official PHP7.2 in Amazon Linux 2 and oddly enough, for example xml_parser_create() does work in the php -a console, but when I put it in a php file, it causes exception when going to the php file, blank screen. Oddly enough it's not even getting the function not defined error to the /var/log/httpd logs.
phpinfo() also does not show Imagick or gd although installed.
I have checked php ini files for disabled_functions and didn't find anything else that would otherwise be an obvious breakage in the default install... is there a new way I'm supposed to enable PHP modules for the Apache php install?
As others may have noted elsewhere there is another module I think it was service php-fpm restart? that is necessary on RHL
I am using php7.0. I have installed curl in my system.
I have this file:
/etc/php/7.0/cli/conf.d/20-curl.ini
I also have this file:
/etc/php/7.0/mods-available/curl.ini
Also, when I run this php -i | grep curl I get:
/etc/php/7.0/cli/conf.d/20-curl.ini,
curl
cat 20-curl.ini gives :
; configuration for php curl module
; priority=20
extension=curl.so
I even restarted my apache many times using sudo service apache2 restart
However, when I do var_dump(curl_init()) it says Call to undefined function curl_init().
I looked at various solution on stackOverflow, but can't find a solution that solves my problem. I am looking for the solution for hours. Can't understand how to make it work. I even tried sudo apt-get upgrade and upgraded my server.
I found in some solutions to uncomment ;extension=php-curl.dll but that is also not working. I am really stuck now. Need Help.
you modified php.ini for the cli executable, not the one used by apache.
you should have a etc/php7.0/apache2/php.ini file this is the one to update
The Solution is here: (I found the error in apache error log)
Although I shifted to php 7, I did not configure my apache to use php7 . So I did following:
sudo apt install php libapache2-mod-php
sudo a2dismod php5
sudo a2enmod php7.0
sudo service apache2 restart
So I recently change to ubuntu and I am trying to setup my environment again and I manage to install LAMP and phpmyadmin and phpstorm.
But what I can't mange to do is to run the php script from phpStorm when I try to run the program the page gives me a "502 Bad gateway" error and when I go back on phpStorm it tells me that php-cgi was not found.
I have tried to fix the problem but couldn't find any solid answer and I am so confused right now
Also I have successfully added the php interpreter and the xDebug
on linux ubuntu
For PHP5: sudo apt-get install php5-cgi
For PHP7: sudo apt-get install php7.0-cgi
I faced with the same problem. After replacing /usr/bin/php5-cgi with a little shell script I found that error
Host 'localhost' has multiple addresses. You must choose one
explicitly! Couldn't create FastCGI listen socket on port
localhost:56468
After commenting 127.0.0.1 localhost in /etc/hosts the problem seems to be solved.
After commenting IPv6 hosts the problem seems to be solved:
# The following lines are desirable for IPv6 capable hosts
# ::1 localhost ip6-localhost ip6-loopback
# ff02::1 ip6-allnodes
# ff02::2 ip6-allrouters
for mac:
install XAMPP (it's easy and straight forvard) it comes with apache and php interpreter
in phpstorm in settings ->php -> interpreter choose path /Applications/XAMPP/bin/php
phpstorm in settings -> build, ... -> Deployment add in place server, url root localhost
More info can be found on jetbrains web page
This helped me to solve this problem and run php by clicking on web browser icon inside phpstorm.
and don't forget to turn on apache in xampp --> manage servers!)
If it's not already done install Homebrew :
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Now, that we've Homebrew, tap php repositories by entering this on your terminal :
brew tap josegonzalez/php
brew tap homebrew/dupes
Check what options are available for PHP 5.4 :
brew options php54
Now install/build PHP 5.4 with some option (in your case PHP-FPM with CGI) :
brew install php54 --with-fpm --with-debug --with-cgi --with-libmysql --with-homebrew-curl
brew install fastcgi
Note : If you're not going to use Apache add --without-apache, if you need others things, just check the options and add what you need
Now, check if PHP-FPM is enable by typing this in your terminal :
php-fpm -v
If you get this :
PHP 5.4.24 (fpm-fcgi) Copyright (c)
1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013
Zend Technologies
You just installed PHP with FCGI like a boss..
Found it Here
Basically the who page says to do this.
Download the interpreter thing oh php from php.net.
Do make install
Make a file called newpath.txt and add to it
PATH=~/custom/php5/bin:$PATH
export PATH
Type cat newpath.txt >> .profile
I will make a youtube video and upload it.
I also experienced the same problem before, however to have the right PHP version installed for your current version is the first step, then before starting the IDE, ensure that you have the php7.x-cgi version installed
open the terminal and input
sudo apt update && sudo apt install php7.x-cgi
replace the x with the version number, then after that you need to configure your IDE to find the path to your PHP installation directory
In the "PHP-CGI Server" tab in phpStorm you see the error:
/usr/bin/php-cgi -e -b localhost:52109
Host 'localhost' has multiple addresses. You must choose one explicitly!
Couldn't create FastCGI listen socket on port localhost:52109
PHP-CGI Server terminated
There curently seems not to be any fix for this known bug: https://youtrack.jetbrains.com/issue/WI-24373
Commenting out either the IPv4 or the IPv6 address for localhost in /etc/hosts (on Linux) is a workaround.
I also had this problem. It depends on your version of php that you want to use it as interpreter in your PhpStorm.
This error message shows that PhpStorm needs to CGI binary to execute your code.
I'm using Ubuntu 18.04 and PHP version that I have used is 7.2.
You need to install modules based on your application requirements. So you use this following command to search available PHP 7 modules in the package repository:
sudo apt-cache search php7*
Now you can see all of available modules (also for cgi) in repository. Now You must install the required PHP modules on your system as below command. Make sure to install packages for correct PHP version by specifying the version with the package name. Without defining the package version, it will install the latest package. E.g. for me, I need php7.2-cgi :
sudo apt install php7.2-cgi
Now cgi is installed. You must restart PhpStorm and test it again. It works well for me.
I recently discovered NginX, and decided to try it out on my server. I have NginX running and able to serve PHP and HTML files. But now I want to try to install drupal. When trying to install it and check the requirements, I am stopped by one requirement.
PHP extensions Disabled
Drupal requires you to enable the PHP extensions in the following list (see the system requirements page for more information):
gd
I have tried to install gd by doing apt-get install php5-gd, and it says it is already installed. So I created a phpinfo() file, and checked to see if gd was enabled and I wasn't able to find it. Does this have to do with NginX or PHP? What do I do to fix this?
Since you are using Nginx - that must mean you are running PHP with PHP-FPM.
After you install stuff you need to:
sudo /etc/init.d/php-fpm restart
or
service php5-fpm restart
in newer ubuntu versions
so that PHP will pickup the new extensions.
If your web server setup is in order, only install the php gd extension and restart php scripting interpreter and web server.
sudo apt-get install php5-gd
sudo /etc/init.d/php-fastcgi stop
sudo /etc/init.d/php-fastcgi start
sudo /etc/init.d/nginx stop
sudo /etc/init.d/nginx start
Here's a great LEMP tutorial http://library.linode.com/web-servers/nginx/php-fastcgi/ubuntu-10.04-lucid
For future me if I forget this.
If you've been messing around with /etc/php/fpm then you may have accidentally lost the symlink to conf.d which means the gd and PDO load files won't be booted with FPM.
This will be an issue if you're just using the basic config that comes with PHP5-FPM. If you have a custom config you may included the files in a different place.
Solution: Recreate the sym-link.
cd /etc/php5/fpm
sudo ln -s /etc/php5/conf.d /etc/php5/fpm/conf.d
PHP extensions have only to do with PHP. Your choice of webserver (apache, nginx, etc) do not affect them. Most likely you just need to enable the gd extension. If you are on Ubuntu, check /etc/php5/conf.d folder and add a gd.ini with the following line:
extension=gd.so
if you are using centos 7 and you can't find /etc/init.d/php-fpm, you may try systemctl restart php-fpm, that worked for me.
I encountered the same problem with making sudo apt-get install php5-gd to work. Console output suggested to do sudo apt-get update. Just basic updating on all your packages.
After updating, I run sudo apt-get instal php5-gd and it did all heavy lifting for me, including restarting php5-fpm and correctly installing everything in between.