I know PHP7 isn't released yet, however I would like to start trying it out, and to do this I would ideally like to keep using PhpStorm. The problem naturally is that it doesn't yet have language support for it.
I have compiled the PHP7 source and added it as an interpreter to PhpStorm, which surprisingly it accepted, however this made no impact on the language level. So my guess is the interpreter is for debugging and the IDE uses its own parser to debug code.
Has anyone found a way to get support for PHP7 into the IDE? even if its the messiest solution in the world, it would be enough.
That's not possible with current versions on PhpStorm -- it has to be natively supported by IDE.
Support for PHP7 will come only in v10 (e.g. no mention for v9 in current roadmap -- no need to support something that is still work in progress, especially since v10 will be released close to PHP7 target dates).
UPDATE ( 21/05/2015 ):
Based on today's tickets it's quite possible that PHP 7 support will actually be added in PhpStorm v9.
UPDATE ( 22/05/2015 ):
Master ticket: https://youtrack.jetbrains.com/issue/WI-27468 (check linked tickets for particular features).
UPDATE ( 08/07/2015 ):
PhpStorm v9 has been released with very basic PHP7 support.
I have compiled the PHP7 source and added it as an interpreter to PhpStorm, which surprisingly it accepted, however this made no impact on the language level. So my guess is the interpreter is for debugging and the IDE uses its own parser to debug code.
Generally speaking -- you are correct here.
Interpreter is used to execute and debug your local (or remote via SSH) scripts and other external stuff that required specifying php executable (e.g. PHPUnit tests etc). It is also used by built-in simple web server if it's used to serve your pages.
At the same time specific language level (5.4, 5.5, 5.6 etc) is set separately and requires IDE to know about such new constructs/syntax etc which means it has to be coded first (as IDE has its' own PHP parser/lexer).
Related
I have a commercial membership site php program on the server, but after the server upgrade it no longer works. The provider has ceased to operate so there is no support. I am using php 7.0.15, but the server wants me to upgrade to a more recent version, 7.4. This breaks the program /all I get is a blank screen)
My level of PHP does not allow me to debug such a complicated program. My question is:
is there any way of instructing php to only use the older version? I imagine that this would have to be done in the php.ini file on the server?
I would like to upgrade to php 7.4 on the server, but have this software run in php 7.0.
Is this possible?
The simple answer is No - PHP does not offer any options to emulate the behaviour of previous versions.
Partly because features are sometimes removed because they prevented changes in the engine, or would need a lot of work to operate with them; partly just because there is only a limited amount of resources available to work on the core of PHP, and maintaining multiple versions of each feature to enable such compatibility would take effort away from improving the current version.
Your short-term option is to find a way to run an actual copy of PHP 7.0 on the server, or a different server that will allow you to run it. You may need to pay someone who provides unofficial long-term support for old versions, since the last official security patch for that version was over 3 years ago. Even PHP 7.4 will only receive official security patches until the end of this year.
In the long term, your only options are to hire someone to update the application to run on a modern version of PHP, or to migrate to a different application which still has a vendor supporting it.
I have a website hosted on a VPS server using PHP version 5.6.40. I would like to upgrade PHP version to 7.0.33. Is there a way to run some sort of audit to determine if anything would break as a result of migration?
The best way to determine this is to have a full suite of tests for the application in question. You can then run it on the new version.
Failing that, I have used PHP Compatibility before, which is a series of sniffs for PHP Codesniffer, and will at least tell you if the syntax is incompatible with the specified version of PHP. It won't guarantee it will work as expected with that version, but will catch syntax problems, which you can then resolve manually.
It still doesn't offer a cast iron guarantee that it'll catch everything, but if the application is small then coupling it with manual testing may be sufficient.
I have an inconsistency, and I could not align their versions properly, so I just wanted to remove the library version. Can I do this? Is the header version for PHP while the library is from my distro? Can I upgrade PHP's library version? If so, how? I am using PHP 5.4.4
For example,
Is the header version for PHP while the library is from my distro?
It means it was compiled against the 1.0.1 headers, but is now dynamically linking against 0.9.8. So you are using an older version than what was used when PHP was compiled.
Many libraries store the version in the header files. So when a program uses the library, it can do something like int HEADER_FOO_VERSION = LIBRARY_VERSION, which embeds that version number into the program (e.g., php). Now when that program runs, it links dynamically against the library, which may be a different one than was on the host system.
That library may have a function call, say int get_library_version(). So the program (PHP) can check if HEADER_FOO_VERSION == get_library_version(). If it's different, then there could be a compatibility issue. (Of course, it doesn't have to be assign to a local variable... I'm just trying to drive home the point that the header version number can be compiled into php, and remains constant no matter which version of the library is being used at run time.)
Whether or not it is a problem depends on if the two versions are compatible.
Usually if the library is > than the header, you are okay. It's definitely more likely to be a problem if the library is older than the version it was linked against. Of course, this is because it's impossible to know what changes future versions may have.
So in your case, I would try to update your system's SSL libraries via apt-get, yum, etc, to match the version PHP is expecting.
To check which version php is using on Linux:
$ ldd `which php` | grep ssl
libssl.so.1.0.0 => /lib/i386-linux-gnu/libssl.so.1.0.0
Note that which php is just a short-cut to find the full path. You can hard code any executable you'd like to check: ldd /usr/sbin/httpd.
I dont know the answer myself, but when searched on google some nice resources explaining the same.....
What's the difference between a header file and a library?
The version of the files are the one mentioned in the phpinfo used to create a library.
Hope it helps, there are lot of resource available if searched on google.
Still will like to hear from someone in great details about the question
The header version is the functionality version, whereas the library version is the code version.
The header defines the interface - it tells you what functions are within the library. If a header gets updated, then you need to check to make sure all the functions are the same, and see if any are added or subtracted.
But if a library gets updated, and not the header, it means all the function calls are the same, but some of the code may be changed (eg, bug fixes).
In your example, PHP is seeing functionality for OpenSSL 1.0.1, but the actual version of the source code that OpenSSL is loading is 0.9.8o
This is commonly seen on updated versions of openssl. What happens is the newer versions for the libraries are stored in different folder. The original folder located at /usr/bin/openssl would need a symbolic link to the new folder /usr/local/bin/openssl. That would get both to be the same version or just show OpenSSL Version _(Whatever)
Normally there is no concern for this, since it still works the way it is intended. This is seen a lot on shared servers.
EDIT:
The information in this post is generic and can be different if you are running
CentOS, RedHat, Ubuntu, or another Linux/BSD version. Check documentation or man
pages for the best information
If you do update your OpenSSL, some versions of *nix Require for you to rebuild PHP and Apache for it to update
If you are rebuilding PHP from source, I have found another possible reason for a mismatch. It's so simple yet if you are not familiar with building from source on Linux, not knowing it can cost you a lot of time.
The answer is here: https://serverfault.com/a/567705/305059 - unfortunately I cannot up-vote it over the not-so-useful answer, so if you have the reputation there, please do.
You need to run "make clean" before "make" in order for it to rebuild all binaries. Strangely, without this step I was getting an updated library version, but the old header version - so I think it must have rebuilt something, but not everything. My rebuild involved linking to a version of curl in another location (built with ssl), which might be the reason behind it.
Anyway, I hope this helps someone. Thank you to #velcrow on serverfault.
For debugging php code I use MacGDBp but it has its quirks: it shows only the top frame variables of the stack, it sometimes refuses to display any variable at all and last version has decorates the source text with non ascii characters.
Is there any alternative that is native OS X? (ie. not Eclipse, I can't stand it).
I have also used MacGDBp and became frustrated with the limitations you mentioned. While it is not a native app per say, NetBeans 6.5 and higher is free and includes a decent PHP debugger that works with XDebug.
http://netbeans.org/kb/docs/php/debugging.html
It is not without it's own set of issues, but it does seem to be more reliable than MacGDBp.
If you are not opposed to paying, the Komodo IDE (My IDE of choice) also has a PHP debugger.
http://www.activestate.com/komodo-ide?src=AScom&type=bn&X=HP&campaign=KMD
Also, though slightly off topic, you may find the easy Xdebug FireFox extension useful:
https://addons.mozilla.org/en-US/firefox/addon/58688/
Lastly, the XDebug website has a list of additional clients, browser plugins and instructions on how to use them:
http://www.xdebug.org/docs/remote#browser_session
For Linux users - http://protoeditor.sourceforge.net/ has a nice lightweight client for Xdebug which is also available as a plugin for Kate (this is not mentioned on the Xdebug site)
Xdebug also runs happily with XAMPP - if you figure out where to put the compiled .so file ;)
There also is an article describing on how to install Xdebug on Linux w/ XAMPP on the SaniSoft blog: http://www.sanisoft.com/blog/2007/06/23/how-to-install-xdebug-php-extension-for-xampp-on-linux/
http://debuggable.com/posts/setting-up-xdebug-on-mac-os-x-or-win32-linux:480f4dd6-0240-4a90-8fa1-4e41cbdd56cb
That helped me a lot. Perhaps it helps you as well.
Edit: By the way, it is a PHP extension. It can be used in competent IDEs including Netbeans, Eclipse, AS Komodo... Oh, and you may use it manually as well by setting a special GET variable (or COOKIE) (see xdebug manual for more info).
I watched the Creating a weblog in 15 minutes with Rails 2 and after 9 minutes in the video he shows ruby's interactive debugger, which allows you to call functions/methods from within a running script.
This goes way beyond breakpoints and looks very useful.
Is there something for PHP that gives similar functionality?
Install xdebug and then use one of the debug clients mentioned here.
Although Milen's answer is the only correct one circa 2009, and Xdebug is still a useful tool, using it requires you to recompile your PHP or to edit your php.ini runtime configuration to load it as a shared object. It also means using a specific client application that supports its network protocol, such as an IDE like PhpStorm.
An alternative is phpdbg, which is an interactive debugger that ships with PHP core versions 5.6 and later and can debug PHP scripts written to conform to PHP 5.4 or later.
Using it is simple:
phpdbg php_script_i_want_to_debug.php
Once in the debugger, type help to access the help menu.
If you don't already have phpdbg on your system, it may be because your PHP was configured without the --enable-phpdbg option. You can either:
Recompile your PHP, being sure to add --enable-phpdbg when you run ./configure (this will simply also build the phpdbg binary), or
download the phpdbg source independently and compile it against your installed PHP (assuming you have the PHP source available). Instructions for doing that, while sparse, are here.