Docs
Work with PHP 5.4
All about PHP 5.3 is true for PHP 5.4. Except for certain extensions, such as rar, mongo, memcache (there is no compatible version for the 5.4). Zend Guard Loader and ionCube are missing, too. But Xdebug is already done :)
PHP 5.4 is installed as an additional PHP version. Since the port 9000 is used for PHP 5.3, we need another port for PHP 5.4, by default, we take for this the port 9054 (last digits just refer to a version, no more). You can set the port up in the php-cgi.conf file in the same directory, where the php.ini of corresponding PHP version is located. In our case it is winginx\php54\php-cgi.conf. These settings are made through Winginx TM as well.
Despite the fact that version 5.4 has been released as the current stable version of PHP, it still has some incompatibilities with other extensions and does not find broad support from the hosting. It is recommended to use this version in experemental purposes.
How to use both PHP 5.3 and PHP 5.4 in one project
Author's notice:
I really don't know why you may use it, but just an example :)
server { listen 127.0.0.1:80; server_name test.local www.test.local; root home/test.local/public_html; index index.php index.html; log_not_found off; charset utf-8; access_log logs/test.local-access.log main; location ~ /\. { deny all; } location / { } # files with the .php extension are for PHP 5.3 location ~ \.php$ { if (!-e $document_root$document_uri){ return 404; } fastcgi_pass localhost:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # files with the .php54 extension are for PHP 5.4 location ~ \.php54$ { if (!-e $document_root$document_uri){ return 404; } fastcgi_pass localhost:9054; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } # second case - special URL for PHP 5.4 # all scripts at http://test.local/php54/ # will be processed by PHP 5.4 location /php54/ { location ~ \.php$ { if (!-e $document_root$document_uri){ return 404; } fastcgi_pass localhost:9054; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } }
In this example, we suppose that PHP 5.4 is running on the port 9054.