ryumada / centratama-hcportal

MIT License
0 stars 0 forks source link

Deploy Codeigniter Application on IIS 8 #5

Closed ryumada closed 4 years ago

ryumada commented 4 years ago

so this is my journey to deploy my Codeigniter Application to IIS 8.

first, install this from Windows Platform Installer image :

after install those platform, go to php.ini for my installation the file goes here C:\Program Files\PHP\v7.2\php.ini, scroll to the bottom of file and make sure the last setting like this:

[WebPIChanges]
error_log=C:\Windows\temp\PHP72x64_errors.log
upload_tmp_dir=C:\php\upload_temp_dir
session.save_path=C:\php\session
cgi.force_redirect=0
cgi.fix_pathinfo=1
fastcgi.impersonate=1
fastcgi.logging=0
max_execution_time=300
date.timezone=Asia/Krasnoyarsk
extension_dir="C:\Program Files\PHP\v7.2\ext\"

[ExtensionList]
extension=php_mysqli.dll
extension=php_mbstring.dll
extension=php_gd2.dll
extension=php_gettext.dll
extension=php_curl.dll
extension=php_exif.dll
extension=php_xmlrpc.dll
extension=php_openssl.dll
extension=php_soap.dll
extension=php_pdo_mysql.dll
extension=php_pdo_sqlite.dll
extension=php_imap.dll
extension=php_tidy.dll

[PHP_WINCACHE]
extension=php_wincache.dll

extension=php_pdo_sqlsrv.dll

extension=php_sqlsrv.dll

for [ExtensionList] you can enable what you want and disable it by adding ; in front of extension line. In the code above I enable all extension.

you need to make sure the temp and session path goes to outside of windows folder, because it will conflict with the permission if place it on windows temporary folder, for example I will place in this folder:

error_log=C:\Windows\temp\PHP72x64_errors.log
upload_tmp_dir=C:\php\upload_temp_dir
session.save_path=C:\php\session

next, for those who still experiencing 404 error not found, install this module, this module is important if you want to use .htaccess file to rewrite index.php, on IIS you'll be using web.config to rewrite index.php. Something like this localhost/index.php/auth to this localhost/auth:

otherwise your web.config file won't be read by IIS source: https://stackoverflow.com/questions/14607390/iis-urlrewrite-is-not-working-for-iis-8

place your web.config file to root directory and done.

web.config file: https://gist.github.com/rizuki-ryumada/682a3b65b6539b32264aaceb5ff92c04