Can anyone help - I can't get a Testcontroller to route/display in my browers - zend framework? - zend-framework

can anyone help me with this ?
i'm following a zend framework tutorial http://www.youtube.com/watch?v=BOwSfKXKpZQ quickstart (2) I seem to have everything working ok and have craeted a new project called square and can acceess the index page ok - "http://127.0.0.1:8888/square/".
I have also created a new controller called Test , but when i try and access it - "http://127.0.0.1:8888/square/test" i get a 404 error ?? i've tried to solve this but cant seem to get anywhere ??
looks easy on the tutorial !
im using EasyPHP as my testing server.
thanks in advance

It looks like you've dropped your Zend project in the "square" directory, which will work for the index controller but other routes will not match. The "/square/test" route is most likely looking for SquareController::testAction.
What I didn't see at the beginning of that youtube demo is where he set up the virtual host. I'm not familiar with EasyPHP, so there might be an easier way to do it, but you can give your site a local name, we'll call it "square.local", and then you don't have to include the square prefix in the url.
VirtualHost Config:
<VirtualHost *:8888>
ServerName square.local
DocumentRoot /path/to/www/square
</VirtualHost>
Also add square.local to your windows hosts file (C:\Windows\system32\drivers\etc\hosts):
127.0.0.1 localhost square.local
Now you can go to http://square.local to get to IndexController. http://square.local/test to get to TestController, etc.

To start: in applications/configs/application.ini, set
resources.frontController.params.displayExceptions = 1
so that the 404 page can report what module/controller/action the system thinks is being requested.

Related

Mamp Pro 4 HTTP and HTTPS

Is it not possible in Mamp Pro 4 to have both http and https? The application I am working on requires both depending on the page.
I must be missing something as it makes no sense when I enable SSL only https works and http then stops working.
I tried going through the http.conf, but really have no idea whats causing this.
I think it just generates the vhost for https only and then removes http. Doesn't even look like you can manually edit it.
Any suggestion would be great.
Well to update my own post and if anyone else has this problem.
The software is currently not capable of this on the same hostname.
According to Mamp support you have to create two hosts with the same name (e.g. sample.app and sample.app.).
Enable one of the "sample.app" hostnames to use SSL
Enable the second host entry "sample.app" to not use SSL. (Don't forget to hold Alt or Option when clicking on +)
Point both to the same directory.
Mamp will highlight this in red, as its warning that you have two of the same hostnames.
So currently this is the only solution I am aware of for this issue.
Hope they resolve this in future updates as a lot of applications, especially ecommerce rely on the ability to switch between http and https.
You can see this on the Mamp Pro documentation here.
I got a simple solution by edit template:
Open Mamp Pro
File > Edit Template > Apache > httpd-ssl.conf
Add these line after
<VirtualHost *:80>
ServerName MAMP_SSLVirtualHost_ServerName_MAMP
MAMP_SSLVirtualHost_ServerAdmin_MAMP
MAMP_SSLVirtualHost_DirectoryIndex_MAMP
DocumentRoot MAMP_SSLVirtualHost_DocumentRoot_MAMP
</VirtualHost>
Mamp Pro 5 in 2020 Update
To tag onto MrDuy's great response, as the Alt Click on the + doesn't seem to work in V5, editing the httpd-ssl.conf template seems to be the way to go.
However MrDuy's answer assumes you're using port 80 for HTTP inside MAMP, which is not the default 8888. Additionally, and I can't speak for MAMP PRO 4 users, the snippet needs to be placed before the MAMP_SSLVirtualHost_iteration_end_MAMP line at the bottom of the file, as obviously this is the end marker that MAMP uses to conduct its iteration of the hosts in the GUI.
TLDR;
Follow the first two steps in MrDuy's answer:
Open MAMP Pro
File > Edit Template > Apache > httpd-ssl.conf
Then, at the bottom of the file, locate the line with MAMP_SSLVirtualHost_iteration_end_MAMP Before this line, paste the following:
<VirtualHost *:8888>
ServerName MAMP_SSLVirtualHost_ServerName_MAMP
MAMP_SSLVirtualHost_ServerAdmin_MAMP
MAMP_SSLVirtualHost_DirectoryIndex_MAMP
DocumentRoot MAMP_SSLVirtualHost_DocumentRoot_MAMP
</VirtualHost>
It would've been niced to use the placeholder markers MAMP uses in it's non SSL config file (MAMP_VirtualHost_IP_MAMP, MAMP_VirtualHost_Port_MAMP etc) but obviously these aren't passed in the file. Which means that if you decide to change the HTTP port, you must also manually update this file.
#MAMP, can't we make this a default? :`(
Cheers!

How to give www.domain.tld its own seperate folder?

I would like to try something.
I wanted to have on http://domain.tld/ a Multiuser Wordpress Install and on http://www.domain.tld/ a Link Directory.
As of now, the easiest way to go seemed like seperating www from non-www while putting the www in its own folder and haveing somewhere in the non-www version a clean redirect that in case someone opens the plain http://domain.tld, s/he would het redirected to http://www.domain.tld/ .. while users who open http:domain.tld/wp-admin would end up in the wordpress Login/Dashboard
Is there any idea you could give me how to seperate those two url's?
SOLUTION for WHM/cPanel Server
As I am not fond with console commands/navigation, I have used for everything WinSCP.
You might want to create a Testsubdomain if there is none.
locate this folder /var/cpanel/userdata/username where "username" is the username for the Account.
You will find several files like
domain.tld.cache
domain.tld
cache
main
main.cache
testsubdomain.domain.tld.cache
testsubdomain.domain.tld
Nearly all of them need to be edited. Download them all and edit them in an editor like Notepad++ .. rename testsubdomain files to www.domain.tld and www.domain.tld.cache .. Edit www.domain.tld like this
---
documentroot: /home/USERNAME/public_html/www
group: USERNAME
hascgi: 1
homedir: /home/USERNAME
ip: XX.XX.XX.XX
ipv6: ~
no_cache_update: 0
owner: root
phpopenbasedirprotect: 1
serveradmin: webmaster#www.domain.tld
serveralias: www.domain.tld
servername: www.domain.tld
usecanonicalname: 'Off'
user: USERNAME
userdirprotect: ''
do the same in www.domain.tld.cache.
Edit all other files and check that you change everywhere the testsubdomain to www .....
Upload everything and well, I simply had to wait just a wee bit (30 minutes where I was still looking for a solution) and it worked perfectly!
I could use the Wordpress Plugin "Eggplant 301 Redirects" to create with the Plugin an 301 Redirect from http://domain.tld to http://www.domain.tld/ that works like a charm.
Problem perfectly solved in my opinion a perfect manner :) ... all by myself :P ... I just have to update the places where I had asked for some intel/help in the Problem solving..... Strange that I didn't got some, but maybe its just too odd :)
Well, I have updated my initial Question, so that it no longer really is a question, but an answer too.
Took me quite some time, lots and lots of searching, finding breadcrumps and in the end it could have been solved already at least 4 hours ago sigh (In my first trys I had messed around in the DNS Entries, removed the default created entry for www and changed it from a CNAME record to an A record and that seemed to have caused the problem that my changes were not properly executed and only after I had terminated the account and recreated, uploaded the already long time edited files via SCP again, it worked) ... but in the end it is done
Thank you all for reading and I truly hope that this might help also someone else.

Setting moodle online

Good day everyone, I have been trying to put my moodle online so pcs from internet can access it, but until now, no luck at all. (Im using moodle 2.3.2 on Windows Server 2008 and IIS 7).
I tried to configure the moodle file config.php, setting the directive $CFG -> wwwroot = "my-public-ip/moodle". Then, when I access to moodel from the server, I can access it by "http://my-public-ip/moodle", when I try to access via localhost, it sends an error which it is OK.
But the funny part comes when I try to access the server from an outside pc. When I type "http://my-public-ip/moodle" it simply cant "see" the configuration I made to the config.php file (it says: This server cna only be accessed via localhost/moodle) it looks like the outside pcs are either ignoring it, or searching for another configuration file. I dont know what the hell is happening, this is very odd.
Any ideas?? tnx!!!
Change the following file:
lib-->setuplib.php
Redirect ($CFG->wwwroot, get_string('wwwrootmismatch', 'error', $CFG->wwwroot), 3);
for
Redirect ($CFG->wwwroot, get_string('wwwrootmismatch', 'error', $CFG->wwwroot), 0);
I realise this is an old question, but it's also worth pointing out you may need to also run the database search and replace script, at:
http://my-public-ip/moodle/admin/tool/replace/index.php
as referenced in Method 2 here.
This is required if you change the name of the site once you have installed it. If you were already using Moodle under "localhost", then there will be a number of references to the old localhost address stored in the database that need to be updated to the new IP-based address.
It might be because the http:// part is missing?
$CFG->wwwroot = "my-public-ip/moodle"
should be
$CFG->wwwroot = "http://my-public-ip/moodle"

ASP.Net MVC 2 on nginx/mono 2.8

I am trying to setup ASP.Net MVC 2 application on Linux environment. I've installed Ubuntu 10.10 on VirtualBox, then installed Mono 2.8 from sources. After that I have installed nginx and configure it as recommended here.
Unfortunately, FastCGI shows me standard error 500 page:
No Application Found
Unable to find a matching application for request:
Host localhost:80
Port 80
Request Path /Default.aspx
Physical Path /var/www/mvc/Default.aspx
My application is located in /var/www/mvc directory. I've tried to create some stub Default.aspx file and place it in root dir of my application, but it didn't help, same error occured.
Thanks.
I've been doing some testing with this as well, using all ubuntu10.10 binaries.
From what I can make from it, either nginx fails to pass the hostname of the mono server fails to receive it over the fastcgi protocol. Anyhow, the tutorial line:
fastcgi-mono-server2 /applications=www.domain1.xyz:/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000
doesn't work. Removing the hostname makes the thing work:
fastcgi-mono-server2 /applications=/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000
but this of course blocks the use of multiple virtual mono hosts.
Since you are running ASP.NET MVC 2 application you should use fastcgi-mono-server4.
Adding following line in /etc/nginx/fastcgi_param resolves the issue for me. It also allows to use multiple virtual hosts.
fastcgi_param HTTP_HOST $host;
Does your application work with xsp (xsp4 if you are using .net 4.0)? You'll want to make sure that is working before you try configuring the connection to another web server.
Does nginx know where to find mono? You most likely have a parallel install and it won't be in the default paths.
I use apache, but you may still find some of the instructions on my blog useful:
http://tqcblog.com/2010/04/02/ubuntu-subversion-teamcity-mono-2-6-and-asp-net-mvc/
I had this problem just now, I too had been following the document on the mono site:
I was trying to start the fastcgi-mono-server as it suggested:
sudo fastcgi-mono-server4 /applications=www.domain1.xyz:/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000 &
However when I did it like that I got the same problem as you. I changed it to this:
sudo fastcgi-mono-server4 /applications=/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000 &
And it worked ( I had to type in www.domain1.xyz/Home/Index to see my MVC page, not worked out how to stop it looking for www.domain1.xyz/default.aspx yet XD ).
You need to make sure the domain set in your site config matches the domain passed to the fastcgi server. So for example if your default site (/etc/nginx/sites-enabled/default) has the following config:
server {
...
server_name www.domain1.xyz;
...
}
You would need to pass that domain into the fastcgi server:
sudo fastcgi-mono-server4 /applications=www.domain1.xyz:/:/var/www/www.domain1.xyz/ ...
Then when you access the site it will obviously need to be with that domain you set.

"URL not found" error at my localhost setup of TYPO3 website.

I have setup TYPO3 successfully on my local server. But I am having problem when clicking on any menu item: It's showing "url not found on server".
When I type in the URL manually into the browser it shows the page. It's only having problems when redirecting after clicking on a page item at any frontend website page.
That might be related to the domain config or RealURL... or both ;)
Do you use RealURL? Or do you use the standard url config?
If links to sub pages look like index.php?id=12345 you are using the standard config.
My guess is that the local DNS ("hosts file") is not configured correctly.
With the hosts file you can simulate how the web site will appear when it's online, hooked up to a "real/global" DNS. (Not quite, but in a nutshell)
So if you set up Typo3 to be reached under http://www.example.com/ you need to tell your local DNS ("hosts file") to route a request to http://www.example.com/ to your local host e.g. http://127.0.0.1/ . In that case your host file needs an entry like so:
127.0.0.1 http://www.example.com/
What Domain do you enter to reach your web site? Where do the links from the menu link to?
If you wanna know mor about the "hosts file" look here:
http://accs-net.com/hosts/how_to_use_hosts.html
If you can log in into the TYPO3 backend (/typo3/) and can access the frondend through /index.php, but not through the generated menu links, then RewriteRules for mod_rewrite don't apply.
Usually TYPO3's installer should detect this configuration and disable RealURL, which is responsible for generating such nice looking URLs (instead of index.php?id=123). It seems like this failed (or you copied everything afterwards without the .htaccess file?).
Make sure that you have TYPO3's .htaccess file in place in the root directory of your installation. If this is the case, make sure that mod_rewrite is enabled in your Apache config.