Required PHP settings for local server

Question:

I'm starting PHP development, and I've already started having some incompatibilities in my codes. I say in 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 incompatibilities in the codes when executed locally and when executed on the server, apart from the php version, because I know that it is essential to have the same version in both. Required php.ini settings etc.

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

Even though error_reporting = E_ALL is enabled in this way (I don't know if it has anything to do with this type of error), the error was not displayed. So what I want to know are the necessary settings that will make the local server as "close" as possible to a dedicated server.

Answer:

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

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

Another tip is to see the changes from one version to the other in the manual , to find out more precisely what you cannot use.

Ah, also check the MySQL server version, as you may have problems with incompatible queries.

Scroll to Top