1 頁 (共 1 頁)

PHP 5.3 to 5.6 for OS X 10.6 to 10.10 as binary package

發表於 : 2015-06-21 12:34:00
yehlu
http://php-osx.liip.ch

Intro

This package installs the (usually) latest PHP 5.6/5.5/5.4/5.3 on OS X 10.6 (aka Snow Leopard), OS X 10.7 (aka Lion) and OS X 10.8 (aka Mountain Lion) and OS X 10.9 (aka Mavericks) and OS X 10.10 (aka Yosemite) in /usr/local/php5. It installs many useful extensions (see below) and ini-settings and is what we at Liip use for our development. It's especially suited for Symfony 2 development. It also provides a decent php.ini with all settings configured according to "Best Practices".

It doesn't install Apache, MySQL or any other external programs. It uses the Apache installation, which comes with OS X and for installing MySQL you can for example use Homebrew. The package is based on entropy's php package .

One Line Installation

All you need to do to install the whole thing is opening up a Shell and execute the following line:

PHP 5.6 (Current stable)

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
PHP 5.5 (Old stable)

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.5
PHP 5.4 (Older stable)

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4
PHP 5.3 (End of life)

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.3
It will ask you for your password. We install the packager in /usr/local/packer and PHP into /usr/local/php5 and for this, we need your password. We don't do anything bad with it.

Frequently Asked Questions

Why does php -v on the command line still show my old version?

php-osx doesn't overwrite the php binaries installed by Apple, but installs everything in /usr/local/php5. The new php binary is therefore in /usr/local/php5/bin/php.

You can also adjust your PATH do include that directory, eg. write into your ~/.profile file the following

export PATH=/usr/local/php5/bin:$PATH
Why is Europe/Zurich the default timezone? Where to change that?

Because we are based in Zurich (and Fribourg and Lausanne). Change the file in /usr/local/php5/php.d/99-liip-developer.ini to adjust that.

It doesn't take my php.ini values

We introduced our own ini file to be able to easily overwrite the standard values with our recommended values. You can find it in /usr/local/php5/php.d/99-liip-developer.ini

As this is read last, it will overwrite values defined in other files. You can also just delete the file.

Why is the MySQL Socket configured to use /tmp/mysql.sock and how to change that?

If you download the native binary from mysql.com, that server uses /tmp/mysql.sock as its socket location (see this). Therefore we choose that value as default.

You can change that value in /usr/local/php5/php.d/99-liip-developer.ini

How to install pecl extensions?

sudo /usr/local/php5/bin/pecl install pecl_http
Where is the memcached daemon?

We started not including the memcached daemon anymore. But you can install it by hand with

sudo /usr/local/packager/packager.py install tools-memcached
How can I help?

This project is hosted on github here https://github.com/liip/build-entropy-php/. The website itself and install.sh is hosted on https://github.com/liip/php-osx/. It's all Open Source, so feel free to fork it and send Pull Requests, if you want to change/fix something.

I have more questions. Where to put them?

You have basically three options:

Open a ticket at https://github.com/liip/php-osx/issues
Write a tweet, we monitor that and are reachable at @php_osx
Write on Stack Overflow with the tags "php osx". We do monitor that, as well
Additional important notes

32 bit only systems (no workie)

It only works on a 64-bit-capable system. This means not on very old hardware with Intel Core Duo and Intel Core Solo processors (see http://support.apple.com/kb/ht3696 for the overview). If anyone wants to make it work on those systems too, please tell us how (We tried, but didn't came up with anything running in a decent amount of time)

php.ini

The php.ini is located in /usr/local/php5/lib/php.ini, additional config files are located in /usr/local/php5/php.d/. The php.ini is based on php.ini-development

Liip php.ini

The Liip php.ini for development is located in /usr/local/php5/php.d/99-liip-developer.ini.

Re-installs into new directory

All installed files go in a new directory with every update, you have to manually maintain/merge your changes from the old directory! (like pear installs)

apc, twig and xslcache

apc, twig and xslcache need to be enabled manually in /usr/local/php5/php.d/50-extension-$name.ini.

xdebug

xdebug settings needs to be configured (idekey etc) manually in /usr/local/php5/php.d/50-extension-xdebug.ini.

apache error with ulimit

If you are seeing "/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument" when loading apache, here is a fix

More history and all that

See this blog post for even more background info.

(Alternative) Installation by "hand"

If you don't trust us, here's the code of install.sh, which you can run by yourself (instead of the one-liner above):

curl -s -o /tmp/packager.tgz http://php-osx.liip.ch/packager/packager.tgz
sudo tar -C /usr/local -xzf /tmp/packager.tgz
sudo /usr/local/packager/packager.py install 5.4-frontenddev
If you already have installed the packager and just want to update the PHP package, you can do it with the following line.

sudo /usr/local/packager/packager.py install tools-frontenddev

Included extensions

bcmath bz2 calendar Core ctype curl date dom dtrace ereg exif fileinfo filter ftp gd gettext hash iconv imap intl json ldap libxml mbstring mcrypt memcache memcached mhash mongo mssql mysql mysqli mysqlnd OAuth odbc openssl pcntl pcre PDO pdo_dblib pdo_mysql pdo_pgsql pdo_sqlite pgsql Phar posix Reflection session shmop SimpleXML soap sockets solr SPL SQLite sqlite3 standard sysvmsg sysvsem sysvshm tidy tokenizer wddx xdebug xhprof xml xmlreader xmlrpc xmlwriter xsl zip zlib Xdebug

available but disabled by default: apc, xslcache, twig, uploadprogress

See this output of phpinfo() for more info.

Uninstall

Change in /etc/apache2/httpd.conf

LoadModule php5_module /usr/local/php5/libphp5.so
to

LoadModule php5_module libexec/apache2/libphp5.so
also delete the file +php-osx.conf and +entropy-php.conf in /etc/apache2/other

and optionally remove /usr/local/php5-*

Source Code

build-entropy-php. Needed for generating the PHP binaries and all the needed libraries
packager by local.ch. This downloads and install the package on your computer.
php-osx. The scripts needed for doing the package and this webpage
Thanks

Thanks to Local.ch, which made all the groundwork for this. And thanks to Liip (and especially Patrick) for everything else.

Re: PHP 5.3 to 5.6 for OS X 10.6 to 10.10 as binary package

發表於 : 2016-08-30 14:39:19
yehlu
https://coolestguidesontheplanet.com/up ... hp-on-osx/

Upgrade to PHP 5.6 or 7 on Mac OSX 10.11 El Capitan and OSX 10.6 – 10.10

May 21, 2016 16 Comments
OSX 10.11 El Capitan ships with PHP 5.5.x and OSX 10.8 Mountain Lion ships with PHP version 5.3, there is an easy upgrade method to either the newer stable version 5.6 or an older stable PHP version or even the latest PHP version 7.

The latest PHP version in this guide is from this PHP Packaged site which is being maintained for OSX and is known as a reliable source.

Download and Install PHP 5.6

Open the Terminal and issue one command –

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6


That’s it! One line command in the terminal, this will download and install PHP5.6 in:

/usr/local/php5/
The install script will also disable the previous PHP5.5 if it was enabled in the Apache configuration file httpd.conf . The new 5.6 version is enabled in Apache right off the bat.



Download and Upgrade to PHP 7.0

Open Terminal and run…

curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0
You get a warning error for El Capitan

Detected OS X El Capitan 10.11. As this is quite new, there may be issues still. Your mileage may vary.

Test the php version by creating a php file named phpinfo.php in your web root with the single function:

<?php phpinfo();?>
Browse to that file and see the version displayed.

php7-osx



So as mentioned earlier by installing a different version than the one OSX is shipped with, the new install will comment out the PHP module inside the apache web config in /etc/apache2/httpd.conf

#LoadModule php5_module libexec/apache2/libphp5.so
It will load the new PHP version via the /etc/apache2/other/+php-osx.conf file.

So to reverse the behaviour uncomment the older PHP module in httpd.conf and remove the new config in other.

Re: PHP 5.3 to 5.6 for OS X 10.6 to 10.10 as binary package

發表於 : 2017-07-05 14:42:41
yehlu

代碼: 選擇全部

curl -s https://php-osx.liip.ch/install.sh | bash -s 7.0
sudo apachectl restart