PHP 5.6 and 7.x

Hi Experts,

Can I run PHP 5.6 and 7.x for the same website on IIS 8.  

I have a lot of legacy code which I want to keep but my all new development I want to utilize PHP 7.x

Is this possible in a production environment

Thanks

Chris
chrislindsayAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

skullnobrainsCommented:
as long as different page use different versions no problem. you'll need a bunch of rules or use explicit extensions such as "php7"

but then backwards compatibility is not that bad so porting your older work to php7 probably requires little work and possibly none.

but do not expect to include a 5.6 piece of code from 7.x or the reverse or expect sessions to work consistently on both versions unless you store them externally ( in memcache or sql for example )

personally, i would not recommend doing that in a single website/vhost
1
Dan McFaddenSystems EngineerCommented:
From the IIS scope, you can register multiple versions of PHP on a single server.  Then down at the site level, you can indicate what version the site should use.  To take it a step further, you can create a virtual directory or virtual application and change the setting there as well.

Though, as mentioned above, mixing PHP versions at the site level is something I would not recommend either.

I also recommend using PHP Manager for IIS on the server.  It makes managing PHP registrations and version settings easier to manage.

Link:  https://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/using-php-manager-for-iis-to-setup-and-configure-php

Running PHP in IIS:  https://php.iis.net/

Dan
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PaseurCommented:
in a production environment
Not to be flip, but if you have to ask the question, the answer is "no!"  Depending on your level of PHP and your diligence with security, modernity, etc., there may be breaking changes in PHP7, so you want to take some careful steps to accomplish the upgrade.

First, know why you want to upgrade.  Set measurable goals so you can see the advantages you want to get from the upgrade, and measure your progress against these goals.

Second, be certain that you have (as near as possible) complete code coverage in your tests, and a sturdy test data set that you can exercise quickly and easily.

Third, read the migration guides. http://php.net/manual/en/migration70.php  Then read them again.

I agree with skullnobrains on this (I usually do): You might want to consider using a different file suffix for the PHP7 code.  I recall using .php and .php5 when PHP5 was introduced.  It helped keep everything well-segregated, and allowed us to make piecemeal changes in the 400+ scripts that required upgrades.  I don't really know much about Windows, but in a Linux environment you can use .htaccess to control PHP versions and settings on a directory-by-directory basis -- very handy!
1
chrislindsayAuthor Commented:
Thanks Guys.  It looks like updating from 5.6 to 7 is relatively straightforward  and maybe this is the best way to go....
Thanks for you help...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.