PHP versions confusing - Gettext not working with PHPStorm - php

I have a tedious setup and have ended up with multiple versions of PHP on Mac OSX Yosemite, and now it has become confusing.
So, I managed to have gettext working with PHP for localization, and it works for Apache. But now when I have installed PHPStorm, I get:
Call to undefined function bindtextdomain()
indicating the gettext isn't supported. I understand that php.ini is also telling this isn't enabled and infact, there are different phpinfo() outputs for when I run the same file using apache and then using built-in server with PHPStorm.
Is there a way to be able to know which PHP is currently being used by apache and replicate the exact functionality with PHPStorm ? I wished that it will make debugging faster, but instead the setup has me stuck.

Related

ldap_set_rebind_proc() function does not work in any PHP Windows distribution

The problem is:
ldap_set_rebind_proc() function does not work in any PHP Windows distribution
error obtained when executing the php file:
Undefined function ldap_set_rebind_proc()
PHP tested versions (5.* y 7.*), I've even tried it on PHP versions included in WAMP and XAMPP server.
The other LDAP PHP functions , like ldap_connect(), ldap_bind(), etc. works well.
ldap_set_rebind_proc() function works well on PHP Linux distributions.
Any idea of this bug? Any solution to read referrals responses of ldap_search() function without using ldap_set_rebind_proc()?
You'll need to compile PHP against a current version of OpenLDAP, though TBH I'm not sure how easy that is on Windows.
Looking at the code, you will see the function is only defined if:
#if defined(LDAP_API_FEATURE_X_OPENLDAP) && defined(HAVE_3ARG_SETREBINDPROC)
These are both quite old features (like, turn of the century), but perhaps the prebuilt binaries are not compiled against modern versions.

PHP function name conflict

We have a PHP-based website that has been in operation since 2005. We have just added a new developer. We have each developer install a local apache stack for debugging. When he executes the site on his workstation, there is an error message having to do with a name conflict with one function.
Specifically, we have a function called GetText which takes 5 parameters. On his system he gets a message saying the the function cannoot be redeclared. It is conflicting with a function which appears to be named gettext (note the different in capitalization) which is said to take one variable.
We do not get this conflict on any of our other instances. The other instances include our production website and three development websites. All of these instances are running on FreeBSD unix. We have developers running os OS X and in various Windows machines. The developer in question is running on Windows 7.
We do not see any such "gettext" function in our code base, including Pear libraries. As a temporary workaround we have renamed our function to "XGetText". That cures the problem.
Where is this conflict coming from?
That developer has the gettext extension active on his PHP install, which defines the function gettext. Capitalisation doesn't matter to PHP. He'll either have to deactivate the extension in his php.ini if possible, or recompile PHP to exclude the gettext extension (in which case I'd suggest using a virtual machine to install a custom PHP version).
BTW, gettext is a pretty popular and often used extension, naming your userland function GetText is a bad choice.
PHP has a built-in gettext function (in both PHP 4 and PHP 5), and PHP function names are case insensitive. Presumably, your PHP is not compiled with the --with-gettext flag and his is.
Disable the Gettext extension, as I'm sure you're not going to use it in your project
This is how it's done in WAMP:

site is running slow when php version is newer than 5.2

My site had worked great untill I updated its php version to 5.4.4 (I also tryed 5.3), I can't continue using php v5.2 because I have added some function that are not supported in 5.2 version.
I work on a windows server.
Profile your PHP with xdebug.
You can see PROFILING PHP WITH XDEBUG AND WEBGRIND, the main parser of xdebug files (kcachegrind) is native for Linux.
An alternative is windows port of kcachegrind, but I never tried it.
XHProf is another simple tool for Profiling
It's very simple to use and configure.

Using inclued php pecl extension

I'm currently trying to level up on my PHP debugging skills and as part of that I'm trying to learn several new tools. One of them is inclued.
The extension seemingly works fine (no startup error, shows up in phpinfo, generates dump files), but it always reports number of includes as 0, so something is clearly not working right.
At first I suspected this was related to my heavy use of auto_include, but after doing some tests which do not, I doubt that is related.
Class graphs are generated OK, but include maps simply don't exist. Am I simply Doing It Wrong, or is the extension broken? I just don't know and even after some heavy duty googling cannot find anything useful.
I installed inclued using the "phpize method". My PHP version is 5.3.2 running on Mac OSX 10.6.5. I also have XDebug and memtrack installed.
After doing a test run with valgrind watching Apache I noticed xdebug was operating below inclued. On a blind test I tried disabling XDebug and lo and behold: inclued works as expected.
So to answer my own question:
Don't use XDebug in conjunction with inclued if you want to have include graphs. Class graphing works fine with XDebug running.

php, xampp and debug - can't get to work

I know this question has been asked before and I've looked through the responses but no matter what I do, I can't create an environment to step through my php programs.
I've downloaded the XAMPP stack, and Eclipse and enabled xdebug but nothing.
PHPinfo reports: Debug Build, No.
Does that mean that I'll never get an XAMPP installation to debug. If so is there another Windows, Apache, PHP, MySQL stack recommended?
I downloaded the Komodo IDE 21 day free trial and their wizard can't start debug either.
help
No, the Debug Build phpinfo() refers to is a compile-time switch/define that affects the way php itself is compiled. The debug build is less optimized, contains some more test code and the symbol files, used when stepping through the php C code with a debugger, are more accurate (mostly due to the less optimized code).
It does not affect the ability to add a script debugger module like xdebug. But you need a version of the module .dll/.so that is compatible with your version of php. The API version, Thread-safety "enabled/disabled" and "debug yes/no" information must match. (on second thought I'm not even sure if debug yes/no must match).
Does the xdebug section appear in the output of phpinfo()? If not make sure you've edited the right php.ini. In recent versions of xampp that should be <xampp dir>/php/php.ini regardless of whether you use php-cli or the apache module. But it used to be <xampp dir>/php/php.ini for the cli version but <xampp dir>/apache/bin/php.ini for the apache module of php.
Also check the error.log in <xampp dir>/apache/logs for error messages that might be related. Those should begin with "PHP Startup: ....error message..."
try using wamp if your using windows. It works great for me

Categories