Manual update of PHP Version [closed]

2

Developed in PHP compatible with the minimum version 5.3.7, and to my dismay, the version that is installed on the Apache server is 5.2.17.

How can I manually upload the new PHP version via ftp to upgrade?

I researched some things like:

  • It can be done through a .htaccess file, which should be in the folder where I have my scripts , informing the server that it will run the specified version of PHP.

    AddHandler php53-script .php .php5 .php56 .pht .phtm .phtml
    suPHP_ConfigPath /home/user/public_html/quero_que_seja_executada_a_nova_versão_nesta_pasta
    

The problem of this is the php.ini file, which I do not know if I can indicate to read my, not the server's.

  • Can be done by creating an Apache Handler direct with cPanel
  • There are those who say they have no way, as it is exclusively done on the server in the Apache bin

Does anyone know how, or at least enlighten me, with some way where I can do this?

    
asked by anonymous 06.03.2015 / 12:48

1 answer

2

Whether or not you can use your custom php.ini depends on apache settings.

Just put it at the root of your site, if it works it's because it's possible (:

The .htaccess file is already limited by the folder where it is. So you do not need the second line of code you pasted. However changing the version will only be possible if your hosting service has the version you are trying to use available.

For the error you reported in the comments, it is possible that the error exists in your development environment, it only appears in the production environment because of the error_reporting directive.

You can suppress errors by using a same php function:

error_reporting(E_ERROR);

However, it is recommended that you configure your development environment to show all errors, and check and correct errors instead of simply scraping them.

For example, the error you posted in comments is usually caused by white space and any other type of text / html, functions like echo and print used before the header function.

If you have .php files that do not contain html / text then you are advised not to close the php tag. Ex.:

<?php
   function util(){ 
     //fazalgo 
   };
//fim do arquivo sem fechar php porque não tem html depois
    
23.04.2015 / 08:35