开发者

how to make xampp environment behave the same as my remote shared hosting environment?

i don't know开发者_StackOverflow中文版 how to say that in technical terms. and i think this is the reason to why i cant get good answer from Google.

i have xampp on my local winxp machine. i use it for developing websites locally then upload these files to my clients shared hosting accounts.

the problem that in 2 years i have always found differences between how xampp works and how the web server work.

some code work locally but dont remotely and the opposite. also flash behave differently on xampp than the remote web server.

is there is a way i can get the server configuration and use it with xampp like get the server php.ini and use it with xampp?


In fact XAMPP may behave different than your production system's web server.

This might be annoying at first, but it is definitely manageable.

Some thoughts:

Run

<?php
  echo phpinfo(); 
?>

on both systems and check different features.

If a feature of PHP is marked as experimental, just drop it.

In case you need to deploy on different production servers, prepare a script called grabProperties.php and add code which checks essential properties you know to be in use. Output the result in some normalized way, so you may use another script to compare results and prepare a nice report.

Certain features activated in XAMPP are not enabled on most web hoster's server - e.g. Flash support. Before using these features, first ensure they are present on your production system.

You are always free to change php.ini. Thus, you may enable or disable modules in such a way, that you dev system mimics your production system's settings.

I wonder, that Flash problems relate to PHP itself. More likely, problems relate to erroneous code.

That said...

I do write PHP for quite some time. Upgraded XAMPP on dev and Apache/PHP/MySQL on production system several times. But not a single application failed to work after the upgrade.

Several times, I moved from dev Windows and production Linux to dev Mac OS X. Even there, everything worked fine immediately.

Needless to note, that not a single line of code needs to be changed between dev and prodution systems.

The essential point to to write high quality code is based on a defensive style.

  • Check as much input parameters of as much methods as possible (see assert()).
  • Log all errors to a log-file and visualize it using your admin backend (see set_error_handler()).
  • Use type-hints as often as possible (see type-hinting)
  • Set the maximum error level and code in such a way, that not a single warning appears.

Still unsatisfied?

In case you are still unsatisfied with XAMPP, prepare a virtual machine with VirtualBox, install some Linux edition and enable apache, mysql and php.

If your hoster's server is on linux - which is very likely - there should't be a big problem configuring the virtual LAMP server in a similar way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜