I'm trying to install php5.4 but i can't find it in the packages, I added also paa or ppa repository and nothing... I specifically need 5.4 cause all the php files aren't working so well on latest versions. thank you very much.
PHP 5.4 security support has ended on 3. September 2015. You should upgrade your script the latest supported PHP version. At the time of writing this, the recommended version is at least PHP 5.6 that will be supported until 31. December 2018.
Running unsupported version of PHP is strongly discouraged as the obsolete version have or will have security vulnerabilities. The aforementioned PPA is kept only for historic reasons and I will not produce any new builds of PHP 5.4 for any Ubuntu version.
You can still use it to install latest PHP 5.4 on Ubuntu 12.04 LTS, but again it's strongly discouraged to do so. See my answer to similar request for PHP 4: Installing obsolete libapache-mod-php4
Use the following set of command to add PPA for PHP 5.4 in your Ubuntu system and install PHP 5.4
sudo apt-get install python-software-properties sudo add-apt-repository ppa:ondrej/php5-oldstable sudo apt-get update sudo apt-get install -y php5
To check the installed version, just type: