Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I want to install Wordpress on my server and i found at their site (https://wordpress.org/about/requirements/) that the recommended requirement is php 7.2 (as a note it say its also support 5.4 but its discouraged, ) .
On my server i have ubuntu 16.04 and php 7.0. (sudo access).
My questions:
1) Will it work smoothly/at all or should i expect hard times to come with php 7.0.
2) I have few existing PHP projects (non-Wordpress), should i expect hard times to come if i upgrade or nothing was totally deprecated.
3) Does ubunto 16.04 have php 7.2 on the official repositories? (what i found on Google was mainly how to use ppa and I'm not sure if this info is up to date)
4) how can i check the above?
thanks
1) Will it work smoothly/at all or should i expect hard times to come with php 7.0.
Will work fine on PHP 7.0 and according to benchmarks will run faster twice than php 5.6.
Here is some interesting information about Wordpress on various PHP's versions:
What’s New in PHP 7.2
See the section: "What Does PHP 7.2 Mean for WordPress Users?"
It does cover 7.0 too, it's dated 4 March 2018
2) I have few existing PHP projects (non-Wordpress), should i expect hard times to come if i upgrade or nothing was totally deprecated.
Assuming your non-WP projects are written in PHP 5.6 you may have some issues.
Some parts of your code may need minor fixes.
See the official documentation: Migrating from PHP 5.6.x to PHP 7.0.x
3) Does ubunto 16.04 have php 7.2 on the official repositories? (what i found on Google was mainly how to use ppa and I'm not sure if this info is up to date)
Not that I'm aware of at the time of writing. If using ppa is an issue for you you then -standing at the informations above- you can run smooth on 7.0
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last month.
The community reviewed whether to reopen this question last month and left it closed:
Original close reason(s) were not resolved
Improve this question
I have a program that is written in PHP. The current version is 7.4 and everything works great.
Today I have upgraded the PHP version in composer.json to 8.2, and everything still worked. Now the question. Is my software now really on the latest version of PHP, or do I still need to do something?
Is it necessary to update the code too? Enums are new for example.
Earlier the enum looked like this in my code:
use Elao\Enum\SimpleChoiceEnum;
final class LogReason extends SimpleChoiceEnum
{
public const NEW_REGISTRATION = 'NEW_REGISTRATION';
}
So is it necessary to update that? Or is that OK as long as it works?
Updating the PHP version number in composer.json only tells composer which version of PHP your project should use. It uses it to decide which packages are compatible with your application.
E.g. if you have "php": "8.2" then it will only install versions of packages that are compatible with PHP 8.2.
It'll also prevent you from running composer install etc in an environment with the wrong version of PHP installed.
To actually upgrade your PHP version you are using, you'll need to install it in the environment your application is running in (on your server, VM, Docker container, XAMPP, MAMP, local OS, WSL or whatever).
To be sure that your software is now running with php8.2, you can check it by calling the phpinfo() function.
BUT you need to be sure that all of your code is still working. To do this, you can run the testsuite of your application if provided.
I suggest you to read the backward incompatible changes and check that the code isn't using it. And you have to do it three times, one time per version (8.0, 8.1, 8.2) You should do it for the deprecated features, so migrations for PHP9 will be easier.
A you have upgraded composer.json, a lot of libraries have upgraded too. So, some manual tests could be a good idea in dev then qualification environment.
About the enum type, it isn't necessary to upgrade your code (but a good idea for maintainability).
When we talk about "versions of PHP", what we generally mean is "versions of the software that executes your PHP scripts". (Theoretically, we could mean "the version of the language specification that that software implements", but PHP has no external language standard, so the software essentially is the specification.)
As an analogy, imagine you buy a new computer, and plug in your existing keyboard. There are three things you might want to check:
Have you definitely plugged it into the right computer? You can look at the wires, or you can open Notepad and start typing something.
Does it work fully with the new computer? Maybe it has special macro keys that open your favourite software, or perform a special move in your favourite game. You can test that those still do what you expect; or you can look at the instruction manual for what needs setting up on the new system.
Are there new features you can use that you couldn't before? Maybe the macro keys can do extra things now; but if you don't make use of that, it doesn't mean you're not using your new computer.
For a PHP upgrade, you can ask the same three questions:
Are you definitely running with that version of the software? You can look at the system settings, or you can ask PHP directly using functions like phpinfo, phpversion.
Is your program working correctly on the new version? Ideally, you'd have a nice suite of automated tests; more realistically, you can manually test functionality, keeping an eye on your error logs; you can also look up the migration guides in the PHP manual to see what you might need to change. Pay particular attention to the 7.4 to 8.0 migration since that is where the majority of "breaking" changes happened.
Are there new features you can use that you couldn't before? This is where enums come in - you can now use them if you want, but not using them doesn't mean you're not using PHP 8.2. Having a new way to do something doesn't mean the old way will immediately, or ever, stop working.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'd like to be able to run PHP application on my own windows desktop.
What are my options?
accodring to this reference, I have to install visual studio 2015 to able to do it. Is it the really necessary?
Why do they mention compiling php? it's a scripting language so am I still supposed to pre-compile it before running it?
Is Visual Studio the only editor or there are other suggested IDEs?
Do I have to run it on IIS, can't I install apache server on my desktop and run the php application on it?
The instructions you find on the wiki are for building PHP from source, but you don't have to do that to use PHP on Windows.
You can use one of the WAMP/XAMPP packages mentioned in the comments. That's definitely a quick and convenient way to get it working on your system. But if you really just want to put PHP on your Windows machine without using one of those, it really isn't too hard.
Based on your questions, including:
Why do they mention compiling php?
I think I can safely assume that you don't want to compile PHP. Fortunately, you don't have to.
Just go to the PHP for Windows download page and find the version that will work on your system. The "Which version do I choose?" in the left panel will help you figure out which one you need. These are pretty much ready to use, just extract it where you want it (I usually just do C:\PHP).
You will need to have the appropriate C++ redistributable installed before it will work. There are also links to those on the PHP for Windows page that I linked above. If you chose PHP 7 (why not?) it will be the VC14 version.
After you have installed the C++ redistributable and extracted the PHP zip file you downloaded, add the new PHP directory to your Windows path, and you'll be able to use PHP on the command line. You can test that it's working properly with php -v (displays the installed version) in a cmd window.
To configure your PHP installation, start with one of the provided ini files, either php.ini-development or php.ini-production. Make a copy of the one you want to use and rename it to php.ini.
Of course, this is only PHP. If you want to use it to with Apache or some other web server, you'll need to install that separately and configure it to use your PHP installation. It's not difficult after you have some experience with it, but I remember it being pretty frustrating to get it working the first time. The advantage to using XAMPP or similar is that includes Apache and MySQL with one installer. If you're just starting out, that's definitely the easiest way to get going.
As far as IDEs, there are various ones that support PHP. There are some free ones that are fine, if that matters to you, but all you really need is a good text editor.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I have used PHP Version 5.3, So i need to Download MongoDB 3.0 and PHP Driver version 1.6 how to download older version (3.0) of MongoDB and PHP Driver.. And also i want use PHP composer and already i have used Composer for like composer require "mongodb/mongodb=^1.0.0" (for PHP Driver version 1.0), Now i want to use PHP composer for PHP Driver Version 1.6..
composer require "mongodb/mongodb=^1.6.0" is it Possible?
please suggest your solution and post download link for MongoDB3.0
You can download MongoDB from here: https://www.mongodb.com/download-center?jmp=nav#community
Just scroll down a bit and there's a link named "All Version Binaries" just below the download button. It opens a page that lists all previous releases of MongoDB. Also, remember to select your OS before clicking on the link.
To start mongo you need to unzip the folder and start with /mongod.exe (in windows).
My suggestion is to create an data folder and specify dbpath as the data folder. Their are various other parameters as well which you can configure. Here is the further installation details.
Once you start the server, verify you can connect to it. You can use a GUI tool (Robomongo works best) or you can use mongo shell command.
To access mongo via php, you can refer here
Please let us know if you face errors.
If am not wrong https://packagist.org/packages/mongodb/mongodb has all ur answers and to fetch latest mongodb releases. And as far as i know PHP Driver version 1.5 and 1.6 are only compatible for PHP version 5.3.
Ref : https://docs.mongodb.com/ecosystem/drivers/php/
did you try this link?
https://www.mongodb.com/download-center?jmp=nav#community
Allows you to select between various editions.
At the moment of this writing the MongoDB Driver Library mongodb/mobgodb has version 1.1.1.
How are you going to use version 1.6?
It has also following requirements:
php: >=5.4
ext-mongodb: ^1.2.0
So, it does not work with PHP 5.3
At the moment of this writing the MongoDB Driver Library mongodb/mobgodb has version 1.1.1.
There are many way to use in different versions.
How do you use version 1.6?
Some requirements are needed :
php: >=5.4
ext-mongodb: ^1.2.0
So, you do not use it with PHP 5.3
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'd like to install the 'pthreads' PHP extension on Ubuntu. I'm using Ubuntu 12.04.1 LTS. And I can upgrade if needed. I really don't want to compile anything from source. For example recompile PHP from source sounds like a horrible idea to me.
In my view, the best option is to install this extension with aptitude command. For example like aptitude install php5-mysql. Another good idea is to use pecl pecl install pthreads. But is does not work for me because of the following error:
checking checking for ZTS... configure: error: pthreads requires ZTS, please re-compile PHP with ZTS enabled
Let me explain why I don't like the idea to recompile PHP from source:
I guess I should uninstall original PHP package then and all the dependencies. Because if I compile it over standard PHP then any packages update would overwrite my changes. And yes, another option is to keep PHP from updating. Anyway this introduces some extra work and makes the setup more complicated. We work in the distributed team. And I don't want other people to deal with this complicated setup on production servers.
I want to install updates on servers. And I don't want to recompile PHP because of security fixes etc.
I don't want to compile anything on production servers and do this many times. Then I should build my own packages and update them with new versions etc. Sorry but I'm not smart enough to do this. May be in 2-3 years but not now. Because there are a lot of things to keep in mind here. For example how, to replace standard PHP package with custom package while still satisfying all dependencies.
Some references:
Dynamically Configure PHP for Thread Safety --enable-maintainer-zts, or use YUM to install pThreads?
How to use Pthreads PHP extension (in Ubuntu) - Some talks about what I'm going to do here.
Building pthreads
This article seems to be old and not actual. I'll keep it for reference only. And I guess it should be read as 'PHP was not thread safe 3 years ago'.
Don’t Believe The Lies: PHP Isn’t Thread-Safe Yet
ZTS: [Z]end [T]hread [S]afety.
ZTS is a compile time option that cannot be enabled at runtime. It allows the PHP interpreter, which usually executes in a single thread, to be executed in many, each with their own isolated instance of the interpreter.
The only option for you appears to be a fresh build, and then using package building tools for your distribution.
I'm not able to advise on the creation of a deb directly, however, creating an rpm is quite trivial, https://github.com/krakjoe/spex there's a starting place for that, you can then use alien to turn an RPM into a deb if you are not able to find out how to create deb packages directly.
Building from source is going to be inescapable, unless you can find some repository with a thread safe build of PHP, with a complete build environment. To that end, the information http://pthreads.org/building may be of use to you. It really isn't that hard to build PHP, nor does it take many hours, on modern hardware you can have a build in less than a minute. You can and should take the opportunity to trim the fat from your installation.
On a side note, the article you reference about PHP not being thread safe is from 2008, it's very wrong. The core is thread safe, there are a few extensions that are inherently unsafe ( not abstracted badly, but fundamentally unsuitable ).
It seems, Ubuntu doesn't have a package for the thread-safe PHP in the official repositories.
Pthreads extension requires ZTS. Thus, you have two options:
compile it yourself:
find a .deb package somewhere, e.g. repositories of the other Debian-like systems.
I'd compile and package it myself using "checkintsall" utility. Thus, Apt will have ability to keep track of PHP version. I would also request Canonical for a package for ZTS PHP.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
The PHP community recently announced the release 5.4. So, here is my first question: Is this version finally thread safe?
I’ve read a lot of posts here and around on the Net about this hot topic (PHP tread safety) and I must admit that I’m a little bit confused.
As of today, my poor understanding on this subject is that the “thread safe” versions of PHP could be used on a multi threaded server such as Apache2-mpm-Worker (or IIS on Windows) when the none thread safe PHP versions should be used on a multi processes server such as Apache2-mpm-Prefork while it’s also my understanding that PHP by itself can’t start multiple threads.
I currently use PHP 5.3.10 on a Windows 7-64 system with WampServer2.2d-64 where phpinfo() states: Thread Safety : Enabled and Apache 2.2.21 Loaded modules: mod_php5 and also on another Ubuntu 10.04.3 LTS (64 bit) system with PHP 5.3.2-1ubuntu4.14 where phpinfo() states Tread Safety: disabled and Apache 2.2.14 loaded Modules mod_php5. I thought using mod_php5 automatically loaded a thread safe version of PHP (but I guess I'm wrong).
So, here is my second question: Is PHP (any version) truly Thread Safe yes or no?
So my third question is: how to enable the thread safety option on my Ubuntu system?
And my last question on this subject is: is there a difference in execution times between the thread safe and non thread safe PHP/Apache versions?
PS: one additional question: How to install PHP 5.3.10 on Ubuntu since this package isn’t proposed by Synaptic?
Is any version / 5.4 finally thread safe?
A caveated Yes. See the obtaining PHP FAQ and the Windows download page. Not all extensions are thread safe and bugs exist. Most Linux distros supply the non-threaded version, including the Ubuntu ones.
how to enable the thread safety option on my Ubuntu system.
You can get the packages apache2-mpm-worker and apache2-threaded-dev from the ubuntu repositories. You will need to configure and build the threaded version from source (hence the dev kit). Again some basic extensions are not thread safe and can't be used.
is there a difference in execution times between the thread safe and non thread safe PHP/Apache versions?
Yes some, but if you are that interested in performance then you should by looking at lighttpd, or other alternatives.
How to install PHP 5.3.10 on Ubuntu
10.04-3 LTS supports 5.3.2. Precise Pangolin will support PHP 5.3.10, but this is still in development. You can try building this source set on your current version, but at your own risk.