PHP Settings Required for Local Server

3

I'm starting development in PHP, and I've started to have some incompatibilities in my code. I say in case something works locally and when I upload it to the server, something goes wrong.

On the server, the PHP version is:

PHP Version 5.2.17

Locally, the PHP version is:

PHP Version 5.5.7

I would like to know the best recommendations for avoiding incompatibilities in the codes when executed locally and when run on the server, taking the php version because I know it is essential to have the same version in both. Necessary php.ini settings and etc.

A problem that I came across lately gave me a lot of headache (I discovered that it was simple after asking a question here in the forum and finding out what caused the error), simply my local%% did not generate error when a% % was called after some PHP code, or the file was set with header(); encoding.

Even html being enabled this way (I do not know if it has something to do with this type of error), the error was not shown. So what I want to know are the necessary settings that will leave the local server as "close" as possible to a dedicated server.

    
asked by anonymous 17.08.2014 / 21:50

2 answers

2

Try to equalize the version and the active modules, few things in php.ini will generate code incompatibilities.

Use the function phpinfo(); it returns all settings and modules enabled, just run in both , compare and configure the local server in the same way as the remote.

Another tip is to see in the manual the modifications from one version to the other, to know more precisely the which you can not use.

Oh, check also the version of the MySQL server, as you may have problems with incompatible querys.

    
18.08.2014 / 00:57
0

Use Vagrant , so you can have the same production environment on your development machine, you can even have multiple environments configured. If you use Windows, here has a good tutorial, it has a very good book .

    
17.08.2014 / 21:53