![]() |
Codeigniter WIndows Apache IIS PHP (display source code partially on page) - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Codeigniter WIndows Apache IIS PHP (display source code partially on page) (/showthread.php?tid=60871) |
Codeigniter WIndows Apache IIS PHP (display source code partially on page) - El Forum - 07-16-2014 [eluser]bpics[/eluser] Hi guys, First of all, thanks for your help. I recently need to migrate my development environment from Mac to Windows, and everything was working on Mac (Codeigniter, MySQL, Apache...), but when it was transferred to Windows, it's working, but with some problem. I first started setting up the Windows environment with IIS, that I have IIS 7.5, with FasCGI, and URI Rewrite, I can see the site is up and running, but the display is strange, that it displays part of the source code from php file, ie. at the home page (actually each page), it displays load->view('home/header'); some error message complaining of the undefined variable error (I defined this variable in the controller home) some html code here ... load->view('home/footer'); Then I thought it was something IIS not working, then I removed this site from IIS, downloaded Apache and configured everything properly, then the same look page displayed. I then thought something wrong with manual setup for Apache, PHP, etc, so I downloaded XAMPP (a bundle with PHP, Apache, MySQL,etc), after I configured it properly, same look page displayed... It looks to me that the variable $this has no value somehow in the controller, or in other words, the Codeigniter is not functioning properly, although I can even login into my site without any css... (database seems working) So is there any had similar problem, or know anything about this? thanks Please let me know if you guys need any further information Codeigniter WIndows Apache IIS PHP (display source code partially on page) - El Forum - 07-16-2014 [eluser]CroNiX[/eluser] Are you by change using short php open tags, but don't have them enabled on the server? Like using Code: <?=$some_var; ?> Code: <?php echo $some_var; ?> Codeigniter WIndows Apache IIS PHP (display source code partially on page) - El Forum - 07-16-2014 [eluser]bpics[/eluser] yes, you are right, I'm using open tag, where can I enable it in the server? thanks Codeigniter WIndows Apache IIS PHP (display source code partially on page) - El Forum - 07-16-2014 [eluser]Rolly1971[/eluser] locate your installation directory for PHP. FIne the File: php.ini in this file are all your options, find the line(s) that deal with short tags and enable it. After doing so you will need to restart your server. other options would be to change out the short tags for full tags or use CI's template parser and use tags like; {var} Codeigniter WIndows Apache IIS PHP (display source code partially on page) - El Forum - 07-16-2014 [eluser]bpics[/eluser] thanks Rolly, let me try it later and let you know Codeigniter WIndows Apache IIS PHP (display source code partially on page) - El Forum - 07-16-2014 [eluser]bpics[/eluser] [quote author="CroNiX" date="1405528399"]Are you by change using short php open tags, but don't have them enabled on the server? Like using Code: <?=$some_var; ?> Code: <?php echo $some_var; ?> thank you CroNiX, I will let you know if enabling the short tag can resolve the problem Codeigniter WIndows Apache IIS PHP (display source code partially on page) - El Forum - 07-17-2014 [eluser]bpics[/eluser] Hi guys, It really was the problem that short open tag was off, and by turning it on, everything works! thanks Another question, regarding to the extension_dir in php.ini When I manually downloaded and configured PHP and Apache, I set the extension_dir="ext", and put # LoadModule php5_module "c:/dev/project1/php5/php5apache2_4.dll" AddHandler application/x-httpd-php .php # configure the path to php.ini PHPIniDir "c:/dev/project1/php5" and the whole directory looks like dev--- | ---project1 | ---php5 | ---Apache24 then when apache starts, everything works expect the short open tag was off, therefore the page is not loaded properly, but all the extensions are loaded. Then I downloaded and started xampp (stop the apache server I manually installed above), and when I start Apache, it complains the extensions cannot be loaded since the path is pointed to c:/dev/project1/php5/ext\php_mysql.dll then I have to define the extension_dir in php.ini (the one in xampp/php)as absolute path extension_dir="c:/dev/project1/php5/ext" then apache can load the extensions. Now since I know the issue that page not loading properly was the short open tag off, then I deleted xampp, uninstalled the apache service installed by xampp, and plan to use the manual installed environment, however, when I start the Apache in c:/dev/project1/Apache24/bin, it complains the dynamic extension cannot be loaded just like what xampp first did, but it displayed that it try to find the extension from c:/php/ext I therefore change the php.ini in c:/dev/project1/php5 to set the extension_dir="c:/dev/project1/php5/ext" then it started working again. I don't really quite understand why it used to work, but just after xampp being used, the extension_dir stopped working with relative path, is there any cached configuration I need to delete after using xampp? again, thanks Codeigniter WIndows Apache IIS PHP (display source code partially on page) - El Forum - 07-18-2014 [eluser]bpics[/eluser] anyone knows? thanks Codeigniter WIndows Apache IIS PHP (display source code partially on page) - El Forum - 07-22-2014 [eluser]CroNiX[/eluser] Just a FYI, there is also the CI config option to use short tags, which is more bulletproof than expecting short tags to be turned on in php.ini. Sometimes you might not have control of php.ini on the host you are installing onto. As to your path problems, I'm not sure why, but it probably doesn't really matter if it works with a full path. I always just use the full path. If you really want to know the answer I'd try a forum that is more dedicated to apache/php setup. |