PHP settings required for local server

Asked

Viewed 89 times

3

I’m starting development in PHP, and I’ve already started to have some incompatibilities in my codes. I say as a matter of something working locally and when I upload 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 to avoid code incompatibilities when running locally and when running on the server, apart from the php version, because I know that it is essential to have the same version on both. Required settings of php.ini and etc.

A problem that I came across lately gave me a lot of headache (I found that it was simple after asking a question here on the forum and find out what caused the error), simply mine PHP location did not generate error when a function header(); was called after some code html, or the file was configured with encoding UTF8 com BOM.

Even the error_reporting = E_ALL being enabled in this way (I don’t know if it has anything 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.

2 answers

2


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

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

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

Ah, also check the Mysql server version, as you may have problems with incompatible querys.

0

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

Browser other questions tagged

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