1

I got this project developed with PHP5. The project was given to me with full details (php version to use, mysql version to use, etc). My client said to develop the project using PHP5, I am glad about this cause i could practice my OOP.

After the project was completed in my local server I uploaded the files to the live server, the problem is, the live server is running in PHP4, so my work was all messed up when we run the project.

Today is the deadline of the project and I've doing this for a couple of weeks coding with PHP5 OOP and before the end of this day I have to make it work with the live server.

My client dont want me to update the PHP version of the server because some other web apps might be affected. If i recode the project It might also take me weeks to do that.

Is there some way this could be done? Im running out of time.

hakre
  • 193,403
  • 52
  • 435
  • 836
Jayson O.
  • 485
  • 1
  • 6
  • 20
  • 2
    This sounds like a problem that should be solved by deploying to a server which a compatible PHP version. – alex Oct 24 '12 at 06:59
  • Yes but the client want to upload them on that server and on that server only. – Jayson O. Oct 24 '12 at 07:02
  • Maybe there is a solution to setup the server to php5 only for your project by using htaccess with AddType x-mapp-php5 .php AddHandler x-mapp-php5 .php when your ISP allow this ... – donald123 Oct 24 '12 at 07:05
  • @donald123 do you have any source links on how to do this? – Jayson O. Oct 24 '12 at 07:07
  • So in short, your client is stupid? "I want you to develop with PHP5, but the app must run in this server that only has PHP4, and I don't want to upgrade it" – Carlos Campderrós Oct 24 '12 at 07:18
  • 1
    Yeah, but during the development they did not inform me that the server is running on PHP4 because their instruction is to use PHP5 so i just guess the server would have the same PHP version. – Jayson O. Oct 24 '12 at 07:27

3 Answers3

3

You can run multiple versions of PHP on the same machine. Try googling for "install 2 php versions on same apache server". One of results is here.
The key idea is to have a separate virtual hosts for PHP5 and PHP4 applications.

bhovhannes
  • 5,511
  • 2
  • 27
  • 37
  • and how do i tell my application to use which php version? – Jayson O. Oct 24 '12 at 07:16
  • @Cubixsyntax: You can configure that per directory or even per file (if not per virtual host, e.g. subdomain) – hakre Oct 24 '12 at 07:17
  • what method should I use to configure my project to work with php5 instead of php4? – Jayson O. Oct 24 '12 at 07:19
  • 1
    @Cubixsyntax, did you looked into provided link? There is done setup with 2 different ports: 8447 and 8423. One is using PHP5 and the other PHP4. If you want to configure per directory, you can change `` definition to something else. – bhovhannes Oct 24 '12 at 07:24
  • @bhovhannes the only thing i have access on the server is the ftp so it cant be done for now. and im waiting for my client to respond. i already told them all of this so lets hope for the best. – Jayson O. Oct 24 '12 at 07:26
2

Run another server (possibly on another machine, which might be a virtual machine) with a modern install of PHP.

Use an Apache ProxyPass Directive to map the old server onto the new server.

Begin testing the web applications on the old server with a modern version of PHP and begin migrating everything so it isn't running a hideously out of date security risk as soon as possible.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • during the migrating process, am i going to have enough time to do it? i got 2 hours left. – Jayson O. Oct 24 '12 at 07:05
  • Setting up a new server without an existing company disk image to work from? In 2 hours? Probably not. – Quentin Oct 24 '12 at 07:07
  • Ok i have no other choice. besides this is not my fault. the client told me to use php5 and i use it. i follow what he said so its not my problem anymore xD – Jayson O. Oct 24 '12 at 07:17
1

My client dont want me to update the PHP version of the server because some other web apps might be affected. If i recode the project It might also take me weeks to do that.

If installing a compatible PHP version on the server is not an option (your client is wrong, you can have multiple PHP versions next to each other or even two systems next to each other that are accessible via the same domain), then you need to rewrite the code for the target platform.

As this takes more time until the end of the day (or your left two hours), the deadline needs to be lifted and the porting to PHP 4 budgeted.

Reviewing your options from top I'd say the situation is insane. Get PHP 5 to run on the or another server and job done. You need more cooperation from your client.

hakre
  • 193,403
  • 52
  • 435
  • 836
  • Yes, this is insane. I am waiting for my client to reply, i told them if they dont want me to do install php5, then they should do it to make this possible. – Jayson O. Oct 24 '12 at 07:23
  • Tell them to install it. I assume you're not managing their servers, so it's their business. – hakre Oct 24 '12 at 08:26