Short tags IS THE most common problem

Short tags IS THE most common problem

The most common problem when switching to a new PHP version in code is using a shot tags.

So I decided, by default, that short tags ARE allowed, as I had so much problems always forgetting about this tag-stuff.

This is for my PHP-FPM done easily:

echo "short_open_tag = On" >/etc/php5/php566/fpm/conf.d/10-short_open_tag.ini
Find existing PHP short tags

This is always a big bug and problem!

Please note that, since PHP 5.4, the inline echo short tag <?= is perfectly valid and is always available regardless of the short_open_tag ini setting.

grep -rPn --include='*.php' "<\?(?!(php|=|xml))(\s|\t|\n)" .

PHP: PHP tags

To solve, just put short_open_tag in php.ini

Make your PHP scripts ready for PHP 5

Or use some of available command line tools to convert tags:

Laravel framework

Laravel 4 nginx Config

Find out Laravel version

To find out Laravel’s version, cd to site root and type:

grep 'const VERSION' laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
Mcrypt extension

Enable Mcrypt PHP extension as Laravel needs an mcrypt extension. Quoting: Laravel requires the Mcrypt PHP extension.

This is not the right way:

ln -s ../../mods-available/mcrypt.ini /etc/php5/fpm/conf.d/20-mcrypt.ini
ln -s ../../mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini

This is the right way, of same task:

php5enmod mcrypt
service php5-fpm restart

You can also disable PHP module with php5dismod mcrypt and list all modules with php5query -M.

date 01. Jan 0001 | modified 29. Dec 2023
filename: Server - PHP Miscellaneous