CSHTML not rendering under mod_mono/mono3.2.5 - linux

Background:
I currently have a working ASP.NET4.0 + Razor2.0(view engine only, no MVC) + mod_mono + Apache + mono3.0.4 + Ubuntu12.10 on a cloud server provider. I found another service provider which is more cost-effective than my current one.
The Issue:
This server is running on Ubuntu13.04 and was able to compile Mono 3.2.5(the latest release on Mono site). I configured it almost identical to my other server and made a simple CSHTML page which works on my MSVS2010; a simple page with layout. I uploaded everything to the directory and when I tried to open the page, instead of being rendered, the server only let me download the whole cshtml file.
I added these lines in mod_mono.conf:
<IfModule mod_mono.c>
MonoAutoApplication enabled
MonoServerPath /usr/bin/mod-mono-server4
</IfModule>
AddType application/x-asp-net .cshtml
Then on my virtual hosting file for Apache2, I added these lines to let Mono handle everything:
<Location /mono>
SetHandler mono-ctrl
Order deny,allow
allow from all
</Location>
My configurations are identical to my previous server which is working properly. The only difference I know is I'm using Mono 3.2.5 and Ubuntu 13.04, also I'm using the master branch of XSP, mod_mono, and libgdiplus. I pulled the code through git.
UPDATE
I checked again the the current stable version of Mono and found out that it is 3.2.4 so I re-compiled it to this version but the the issue is still there.
UPDATE 10-Dec 2013
I was able to rebuild the server using Debian 7.0 and it is already running ASP.NET 4.0(and theoretically even 4.5). It can now run properly execute regular ASPX but not CSHTML.
The page runs properly under IIS on MS Windows 7 but it can't render and just download the page when I try to run it on mod_mono(mono 3.2.7 runtime) + Apache2 + Debian or XSP4 + Windows 7 though both can run ASPX pages properly. This test site still runs on my older server running mod_mono(mono 3.0.4 runtime) + Apache2 + Ubuntu 12.10. Both servers have the same configuration on both mod_mono.conf and site(/etc/apache2/sites-enabled/000-default) but can't make it run on my new server.

Even if the following are already in the GAC, copying and placing the files in the "bin" directory fixed the issue:
System.Web.Helpers.dll
System.Web.Razor.dll
System.Web.WebPages.dll
System.Web.WebPages.Razor.dll

Related

Beginner - setting up local host for Angular app using XAMPP on Windows 7

I have taken a Angular App which works on Local host when I use visual studio IIE server.
I don't want to use Visual Studio and I am trying to test the app locally using XAMPP.
I am a complete beginner, and I cannot get the local host to pick-up the html initialization file. I have checked the following:
Skype is off and the port is set to 80 in XAMMP
the root server in HTTPd.conf is setup correctly (no slash at end)
I am getting a little confused as to 'how' angular will work on the XAMMP local host.
Do I need to get Yeoman or grunt (seen these apps in some posts, but they seem to be for command line environment).
Any help, or even a pointer to a step by step set-up would be great!
Angular is no different from a normal html web page, when it comes to working in a localhost.
Does your XAMPP work with standard HTML files?
Do you have any error generated?
OK. Got this sorted. I was over complicating things entirely, angular runs sweet on regular XAMPP, no Grunt/ Yeoman etc. required.
All you need to do is: 1. install XAMPP 2. Close Skype 3. Place you app, libraries and everything else in the folder C:\xampp\htdocs\
localhost/Angularappstartpage.html
BOOM!
it works.
You may need to adjust the port number on the localhost (default is 80 e.g. localhost:80/...)
You can also change the root folder in your XAMPP config setup to point to your local GIT.
Do this by changing the line in the HTTPD.conf file (click 'config' on the apache module)
DocumentRoot "C:/xampp/htdocs" to DocumentRoot "C:/myLocalGIT"
Hopefully this will help all the new guys out there. Good luck!
Skype blocks the port 80, which is used for browsing. XAMPP uses the same port so exactly.
https://support.skype.com/en/faq/FA148/which-ports-need-to-be-open-to-use-skype-for-windows-desktop
If you use mysql, also open first XAMPP and start your services and then keep working on your SO as always.

Xampp not working on Linux

I recently installed Linux and Xampp server. I had been working on it last night and this morning without any problems. This morning I started working the zend framework. Everything was going well until I had to restart my computer.
After restarting, when I tried to access localhost I was getting this message in my browser:
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
I have restarted xampp and apache. In the httpd.conf file I have changed the port from 80 to 8080. I'm running php 5.4.6. I have also reinstalled xampp just to be sure.
As far as I can tell, the only alterations I made outside of the zend project directory were the httpd.conf file. I changed "allowOverride None" to "allowOverride AllowAll". I also installed Composer and phpUnit, though I can't imagine how they would have caused the problem.
Any help you can throw my way would be great. I'm very stuck with this.
This is the default content of index.php or index.html file. Try rename these files.

PHP GD Extension is not loaded on IIS 7.5

PHP GD Extension is loaded and working on local server but it is not loaded correctly on our live server even though I am using all the exact same files.
(PHP GD is working fine here)
Local Server: Microsoft Windows Server 2003 For Small Business Server SP2
IIS Version: 6
Then I copied the whole "C:\PHP" folder from local server to "C:\Program Files (x86)\" on live server. That "PHP" folder does include ext folder and "php_gd2.dll" file inside it. I changed the path from "C:\PHP" to "C:\Program Files (x86)\" in "php.ini" too. However, PHP is not loaded on live server.
PHPINFO Local:http://jsfiddle.net/hFKfx/
PHPINFO Live: http://jsfiddle.net/h77Hy/
I am not very good with PHP. Please help.
In Win2K3 / IIS6, you're running PHP as a ISAPI module (thread-safe).
In Win 7 / IIS7.5, you're running PHP as a FCGI module (non-thread-safe).
This is likely your problem. You can't mix and match thread-safe (TS) / non-thread-safe (NTS) extensions with core PHP. If you just copied everything over, you probably have TS extensions. You need to download and use the NTS ones.
(archive link to PHP 5.2.6 NTS)
To verify this assumption, check where php.ini specifies a log for startup errors. If you're logging startup errors, you should see something similar to:
PHP Warning: PHP Startup: gd Extension: Unable to initialize module
Module compiled with build ID=API20041225,TS,VC6
PHP compiled with build ID=API20041225,NTS,VC6
These options need to match
(note "TS" vs "NTS")
Hope that helps. If not, maybe you'll find something else in the log that indicates what the problem is.

How do I profile a Codeigniter Web App with XDebug?

I'm running XDebug on Linux CentOS. I want to profile pages on a web app built with CodeIgniter, served by Apache.
XDebug is enabled in php.ini with the following settings:
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp/xdebug
Everything works fine when I trigger php scripts from the command line, and XDebug profile logs are written to /tmp/xdebug, as expected. When I load a url from the web app through the browser, XDebug does not create any profile log files.
Has anyone gotten XDebug to work with Codeigniter? From what I can tell, I should not have to trigger XDebug profiling via GET in the url because profiler_enable is turned on for all php scripts, although I've tried this and it doesn't seem to work either.
Apache needed to have write permissions on the /tmp/xdebug folder.
sudo chown -R apache:apache /tmp/xdebug
XDebug can profile Codeigniter page loads from a browser now.
Thanks #J. Bruni.
It seems to me that the issue is not related to CodeIgniter... It seems you may have multiple php.ini files...
In my Ubuntu installation, I have several sub-directories inside /etc/php5 directory: cgi, cli, fpm, etc. Each one of these has a php.ini file inside it, which is specific to a single "mode".
In other words: PHP may have several different php.ini files... one for CLI (command-line), other for CGI, and so on...
Maybe the xdebug configuration lines you pasted above are not in the php.ini file used when you access PHP scripts from the browser. Maybe you added these lines to /etc/php5/cli/php.ini instead of /etc/php5/cgi/php.ini (or another... in my setup, it is /etc/php5/fpm/php.ini, because I use php-fpm)

Mono on Linux plus MVC3: Root directory shows file/folder list on web browser

I'm struggling getting my MVC3 site I developed on Windows to correctly run on Linux (Ubuntu) and Apache using Mono 2.10.5.
When I browse to the site root via my web browser, I see my file/folder structure instead of the home page of the site, which appears to me as though routing is not working. Everything works fine on my development environment on Windows.
When in this view, if I click on Global.asax, for instance, I see the standard ASP.NET "yellow screen of death" (YSOD) with a 500 error stating "Could not load type 'System.ComponentModel.DataAnnotations.KeyAttribute' from assembly 'MyWebSite'.".
On the bottom of the YSOD, I see the following: Version information: Mono Runtime Version: 2.10.5 (Debian 2.10.5-1); ASP.NET Version: 4.0.30319.1
I've followed the instructions for configuring Mono for MVC3 here: http://www.integratedwebsystems.com/2011/06/get-mvc3-razor-running-on-mono/
Does anyone have any clues as to why the file/folder structure is being listed when I visit the site root from my browser?
It turns out that mono was running under port 8080, and I couldn't configure it to run on port 80 due to a conflict with another module. I am able to run things fine on port 8080 now.

Resources