php - How to configure CodeIgniter to automatically detect development machine and real machine? -


I am developing from my Windows laptop but need to test my development on my shared Linux hosting. I have the usual $ application_path = "application"; put together at the bottom of the line.

 $ env ['laptop'] ['ip'] = '127.0.0.1'; $ Env ['laptop'] ['host'] = 'mat-window 7'; $ Env ['laptop'] ['path'] = 'private';  

$ env ['mattpotts'] [' ip '] = '12 .34.56.78'; $ Env ['mattpotts'] ['host'] = 'my.webhost.com'; $ Env ['mattpotts'] ['path'] = '../private / blah';

 $ ip = $ _SERVER ['SERVER_ADDR']; $ Host = php_uname ('n'); Foreign exchange ($ en $ as $ E) if ($ E ['ip'] == $ ip & amp; $ e ['host'] == $ host) $ application_folder = $ e ['path']; Not set ($ env); If (! Isset ($ application_folder) dies) ('Application folder is not set');   

... which works fine to set the application path but now I can

I work with some simple IFS But I was wondering if this is the best practice solution.

Cheers

Use revision control such as A configuration file has been deployed in your test environment and a modified version has been examined in your development environment. Just ask your client not to make this configuration change so that they do not do it in your test / production environment.

This is definitely the best practice solution :)

If you do not feel like setting up a Subversion Server, then always such solutions are hosted as if You're on Windows, it's a clever customer.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -