Manual update of PHP Version

Asked

Viewed 888 times

2

I developed scripts in PHP compatible with the minimum version 5.3.7, and for my misfortune, 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 update?

I looked up some stuff like:

  • Can be done through a file . htaccess, which should be in the folder where I have mine scripts, informing the server that in that folder the specified PHP version will be executed.

    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 with this is the php.ini file, which I don’t know if I can indicate to read mine, not the server one.

  • Can be done by creating an Apache Handler direct co cPanel
  • Some say they don’t have a way, as it is exclusively done on the server in the Apache bin folder

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

  • 1

    Renan you will have to contact your hosting provider. Unable to upload PHP executable via FTP and run your application through it as far as I know.

  • 1

    Are you using what kind of OS on the server? Windows, Debian? If the host and type "Shared hosting" you cannot. You can only if you have a "dedicated" server. There is also another question: there is no difference between PHP 5.2 and 5.3. What kind of thing you do, that doesn’t work on PHP5.2??

  • 1

    Note: PHP 5.3 is no longer supported and newer versions perform better than 5.3. I recommend upgrading to a newer version.

  • 1

    @Peter between 5.2 and 5.3 we have the namespace support. That alone I find enough.

  • 1

    If so, then: http://stackoverflow.com/questions/6473126/namespaces-in-php-5-2 But I don’t know if it will solve.

  • 2

    My suggestion is more to change the hosting if possible, or contact support for them to update.

  • is that I really need this most current version because I am using password hashing functions, not to mention that I was shown an error: Warning: session_start() [Function.Session-start]: Cannot send Session cookie - headers already sent by (output Started at /home/Fenix/public_html/login/admin/index.php:4) in /home/Fenix/public_html/login/admin/classes/Login.php on line 40

  • 1

    If the server is not yours, you can not, if it is a hosting I think your server should have something similar to Cpanel, there you can choose the version of PHP (usually has more than one installed), in the hosting of a client I have 5.2, 5.3, 5.4 and 5.5; I change when you want.

Show 3 more comments

1 answer

1

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 is why it is possible (:

The . htaccess file is already limited by the folder where it is. So you don’t 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.

As 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 due to the directive error_reporting.

You can suppress errors using a php function itself:

error_reporting(E_ERROR);

However it is recommended that you set up your development environment to show all the errors, and check and fix the errors instead of simply brushing them.

For example the error you posted in the comments is usually caused by whitespace and or 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 it is indicated that you do not close the php tag. Ex.:

<?php
   function util(){ 
     //fazalgo 
   };
//fim do arquivo sem fechar php porque não tem html depois
  • thanks to all. really had to contact the hosting for them to do everything there.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.