PHP 7.0 is a thing.

This commit is contained in:
Phil Sturgeon
2015-12-02 10:07:13 -05:00
parent a29c98dba1
commit b92bd33776
4 changed files with 35 additions and 23 deletions

View File

@@ -1,15 +1,16 @@
---
title: Use the Current Stable Version (5.6)
title: Use the Current Stable Version (7.0)
isChild: true
anchor: use_the_current_stable_version
---
## Use the Current Stable Version (5.6) {#use_the_current_stable_version_title}
## Use the Current Stable Version (7.0) {#use_the_current_stable_version_title}
If you are getting started with PHP, start with the current stable release of [PHP 5.6][php-release]. PHP has added
powerful [new features](#language_highlights) over the last few years. Though the incremental version number difference
between 5.2 and 5.6 is small, it represents _major_ improvements. If you are looking for a function or its usage, the
documentation on the [php.net][php-docs] website will have the answer.
If you are getting started with PHP, start with the current stable release of [PHP 7.0][php-release]. PHP 7.0 is very
new, and adds many amazing [new features](#language_highlights) over the older 5.x versions. The engine has been largely re-written, and PHP is now even quicker than older versions.
Most commonly in the near future you will find PHP 5.x being used, and the latest 5.x version is 5.6. This is not a bad option, but you should try to upgrade to the latest stable quickly. Upgrading is really quite easy, as there are not many [backwards compatibility breaks][php70-bc]. If you are not sure which version a function or feature is in, you can check the PHP documentation on the [php.net][php-docs] website.
[php-release]: http://php.net/downloads.php
[php-docs]: http://php.net/manual/
[php70-bc]: http://php.net/manual/migration70.incompatible.php

View File

@@ -5,8 +5,8 @@ anchor: mac_setup
## Mac Setup {#mac_setup_title}
OS X comes prepackaged with PHP but it is normally a little behind the latest stable. Mountain Lion has 5.3.10,
Mavericks has 5.4.17 and Yosemite has 5.5.9, but with PHP 5.6 out that is often not good enough.
OS X comes prepackaged with PHP but it is normally a little behind the latest stable. Mavericks has 5.4.17,
Yosemite has 5.5.9 and El Capitan has 5.5.29, but with PHP 7.0 out that is often not good enough.
There are multiple ways to install PHP on OS X.
@@ -29,14 +29,14 @@ MacPorts supports pre-compiled binaries, so you don't need to recompile every
dependencies from the source tarball files, it saves your life if you don't
have any package installed on your system.
At this point, you can install `php53`, `php54`, `php55` or `php56` using the `port install` command, for example:
At this point, you can install `php54`, `php55`, `php56` or `php70` using the `port install` command, for example:
sudo port install php54
sudo port install php55
sudo port install php56
sudo port install php70
And you can run `select` command to switch your active php:
sudo port select --set php php55
sudo port select --set php php70
### Install PHP via phpbrew
@@ -44,6 +44,7 @@ And you can run `select` command to switch your active php:
applications/projects require different versions of PHP, and you are not using virtual machines.
### Install PHP via Liip's binary installer
Another popular option is [php-osx.liip.ch] which provides one liner installation methods for versions 5.3 through 5.6.
It doesn't overwrite the php binaries installed by Apple, but installs everything in a separate location (/usr/local/php5).

View File

@@ -20,8 +20,11 @@ One recommended way to use namespaces is outlined in [PSR-4][psr4], which aims t
namespace convention to allow plug-and-play code.
In October 2014 the PHP-FIG deprecated the previous autoloading standard: [PSR-0][psr0], which has been replaced with
[PSR-4][psr4]. Currently both are still usable, as PSR-4 requires PHP 5.3 and many PHP 5.2-only projects currently implement
PSR-0. If you're going to use an autoloader standard for a new application or package then you almost certainly want
[PSR-4][psr4]. Currently both are still perfectly usable and PSR-0 is not going away. As PSR-4 requires PHP 5.3 and
many PHP 5.2-only projects currently implement PSR-0. Luckily those PHP 5.2-only projects are starting to up their
version requirements, meaning PSR-0 is being used less and less.
If you're going to use an autoloader standard for a new application or package then you almost certainly want
to look into PSR-4.
* [Read about Namespaces][namespaces]

View File

@@ -6,20 +6,27 @@ anchor: mysql_extension
## MySQL Extension {#mysql_extension_title}
The [mysql] extension for PHP is no longer in active development, was [deprecated as of PHP 5.5.0]
[mysql_deprecated], and has been [officially removed as of PHP 7.0.0][mysql_removed]. If you are using any functions that
start with `mysql_*` such as `mysql_connect()` and `mysql_query()` in your applications then these will simply not be
available in PHP 7.0.0. This means you will be faced with a rewrite at some point down the line, so the
best option is to replace mysql usage with [mysqli] or [PDO] in your applications within your own development schedules
so you won't be rushed later on.
The [mysql] extension for PHP is incredibly old and has superseded by two other extensions:
**If you are starting from scratch then absolutely do not use the [mysql] extension: use the [MySQLi extension][mysqli],
or use [PDO].**
- [mysqli]
- [pdo]
Not only did development stop long ago on [mysql], but it was [deprecated as of PHP 5.5.0]
[mysql_deprecated], and **has been [officially removed in PHP 7.0][mysql_removed]**.
To save digging into your `php.ini` settings to see which module you are using, one option is to search for `mysql_*`
in your editor of choice. If any functions such as `mysql_connect()` and `mysql_query()` show up, then `mysql` is
in use.
Even if you are not using PHP 7.0 yet, failing to consider this upgrade as soon as possible will lead to greater
hardship when the PHP 7.0 upgrade does come about. The best option is to replace mysql usage with [mysqli] or [PDO] in
your applications within your own development schedules so you won't be rushed later on.
**If you are upgrading from [mysql] to [mysqli], beware lazy upgrade guides that suggest you can simply find and replace `mysql_*` with `mysqli_*`. Not only is that a gross oversimplification, it misses out on the advantages that mysqli provides, such as parameter binding, which is also offered in [PDO][pdo].**
* [PHP: Choosing an API for MySQL][mysql_api]
* [PDO Tutorial for MySQL Developers][pdo4mysql_devs]
[mysql]: http://php.net/mysql
[mysql_deprecated]: http://php.net/migration55.deprecated
[mysql_removed]: http://php.net/manual/en/migration70.removed-exts-sapis.php