Top Nav

Archive | PHP

Clearing PHP opcache

Great article on how to clear the PHP opcache:

https://ma.ttias.be/how-to-clear-php-opcache/

To facilitate use on a Plesk server created script and mapped into namespace:

https://acme.com/opcache_clear

Here’s the script:

And here’s the Apache config to map into a virtual host:

This above config should be placed in the “Apache & nginx setting” screen in the “Additional directives for https” field. In addition to setting the alias path we’re also setting the PHP handler.

Additionally under “Password protected directories” added password protection for “/opcache_clear”. This is just a placeholder for the password file which is referenced in the above config.

0

Magento SUPEE-7405 Parse Error

Applying the new SUPEE-7405 patch to Magento 1.7.0.2 (and probably other versions) results in a parse error in the sales order view page (admin/sales_order/view/order_id) if the site is running under PHP5.3. Here’s the error message:

The offending line is:

it can be changed to:

PHP 5.3 does not support the “[]” syntax for array initialization. Of course you should not be running PHP 5.3!

0

Plesk 12 / CentOS / PHP 5.3 Issue Causes “abrt” Crash From Yum

Recent on servers with Plesk 12 and the PHP 5.3 distribution from Odin, we’re seeing “abrt” crash reports from Yum with a back trace like:

Until Odin fixes their repository the only way to get updates to proceed normally is to disable the PHP 5.3 repository by editing:

And adding this line:

Since PHP 5.3 is EOL there aren’t any updates expected so disabling the repository should not cause problems.

 

0

Upgrade CURL

The Yoast SEO plugin in WordPress has started advising users to upgrade curl to the latest version. On CentoOS this can be done easily using the city-fan.org repo here:

http://www.city-fan.org/ftp/contrib/yum-repo/

For a CentOS 6 server, here are the steps:

 

 

0

Using PHP composer.phar With Non-default PHP Install

Composer for PHP is an increasingly popular tool for managing packages within a PHP application.  Here’s a link for more information:

https://getcomposer.org/

On many of our Plesk servers we have multiple PHP versions install. The default at /usr/bin/php is provided by the Linux distribution and then there are additional version installed at /opt/plesk/php. Plesk lets us easily select the PHP version for each hosted website. But you can run into problems with composer using the wrong PHP version. A typical composer command might be:

or

To make our alternate PHP version work we need to instead do something like this:

So we override the default PHP by adding our preferred version to the front of the path.

1