Zendframework link problem - php

I am very to new to zend frame work , I am trying to set up a project (Done by other programmer) in my local server, but in this project the all links to another are not working?
Plss help me!!!!!!!!1

I don't know where exactly relies your problem but it could be several things
make sure the rewriting is working
properly (Apache settings, IIS
settings, .htaccess). You check that
by adding a die('I am in
index.php'); in your index file and
browse some urls
$frontController->setBaseUrl if your website is not at the root of the server your should set the baseurl to match that.
That's the two main reason that come to my mind now I would be glad to help more if you give more details...

Just a guess. Since I had a problem that is a bit like this. You may need to set up your virtual host for this one. Maybe the old developer used a certain virtual host. That is why it is not working when you transfered it to your local machine

Check your VirtualHost settings, then check .htaccess or post this files.

Related

Running Wordpress repo locally through MAMP. Assets not being pulled in

Currently I am trying to run a Wordpress repo locally for development. I am not using MAMP pro even though I still have a 9 day trail. I figured since I'm going to be using the free version for now I might as well work with that. I have my Apache & MySQL server running along with the Document Root pointing to my Sites folder where my projectName repo sits. I'm still running off of the default port of Apache 8888.
After I start the servers, I open WebStart and import my DB into phpMyAdmin. Everything works perfectly fine and the copy of my db gets imported. I then make sure that my wp-config.php file has the appropriate settings to access this db. I then click on My Website. This pulls up the content of the website. However, it does not pull in any of the assets(imgs/js/css). I receive the following errors in the console:
Failed to load resource: net::ERR_EMPTY_RESPONSE http://projectName.dev/wp-content/uploads/2016/09/logo-footer-1.png
Failed to load resource: net::ERR_EMPTY_RESPONSE http://projectName.dev/wp-content/themes/projectName/images/circle.png
And so the list goes on and on for pretty much every asset the project could possibly have. Now configuration is NOT my strong suit, and at this point I am at a loss of what could possibly be happening. Awhile ago I did follow a tutorial on how to setup my files so that I can access them in the web browser by simply typing the name of the project with the domain .dev, example: projectName.dev. I started having issues with this after upgrading to OS Sierra and it no longer works. Could this possibly be the reason as to why it is looking for these assets in the projectName at the .dev domain?
I apologize if this does not make sense. I am willing to provide anyone with any information on this as I need as much help as possible because I still need to level up my configuration skills. Let me know if you have questions.
The images and other assets are referenced with an absolute filepath (i.e. the URL of the server on which you first set it up). This has to be changed in all database entries. There are tutorials for this on the net, but the most simple version is to open the sql file in an editor and search & replace the general URL part in the complete database.
Be sure to keep a backup of the file - that might not work on the first try...

Changing directory paths of links in one place

I've got a website which I need to move across to another server, however i've got a problem with the directory paths and how they've been setup throughout the whole site.
So on every page, there're includes that look like the following
<?php include($_SERVER['DOCUMENT_ROOT'].'/views/includes/header.php'); ?>
This setup works perfectly fine on its own server because the DOCUMENT_ROOT is fine, however, the issue i've ran into is that i've just brought this down onto my localhost where the DOCUMENT_ROOT is
/Applications/MAMP/htdocs
when i need it to look like this
/Applications/MAMP/htdocs/website-name
Is there anywhere in the Perch CMS or .htaccess where i can perhaps change the DOCUMENT_ROOT or otherwise without having to amend every single link?
Thanks.
If you have mod_rewrite activated in Apache, you could use a rewrite rule in .htaccess.
http://httpd.apache.org/docs/current/mod/mod_rewrite.html
$_SERVER is a global variable. You could also override it in an entry point PHP script.
I guess you're using the free MAMP where setting up hosts is a manual task? Now you're running the site in a subdirectory of the root, right?
I strongly recommend always running the CMS in the root. Running CMS in a subdomain is always trouble, in my experience. Also, you want your local and remote setup to be as similar as possible.
With MAMP PRO it's very easy to set up multiple roots, it's a good investment to avoid the hassle with manual apache configs. Works flawlessly.

Eclipse PDT, how to setup 'Run Configurations'?

Eclipse PDT is very slick, but here's my issue, Re: Launcher (run configurations)
I'm trying to keep things very clean, concise on my local machine (with WAMP stack) and I have a number of virtual hosts configured, that keep my URL's easy to use.
In eclipse, I set up PHP servers to correspond with these Vhosts.
Since I have existing code, I'm usually setting up a new project 'from existing sources'.
Then when I try to 'run', I get URL auto-generated like this; with the Project name in it:
http://MyVhost/MyProj/testing.php
And what I really want is:
http://MyVhost/testing.php
I find myself doing a lot of editing and adjusting of the servers and run configurations, before I can get the URL that works. Any recommendations ?
You can create a new Run Configuration Run->Run Configurations and as long as you have setup your virtual hots as servers, you can untick 'Auto Generate' option under URL and enter you URL manually for each project. So even if you point to different files in your project, it won't matter because Eclipse will use your manually entered URL. Save these and then you're done!
The path part of the autogenerated URL is the Base Path (which defaults to / + project name) + the path of the file inside the project location. You can set the Base Path to / in Project | Properties | Debug . It applies to Run configurations as well. If you always use the documentroot of the site as the project location, it will work.
I ran across something similar where if I had a vhost named "test" I wanted to run everything for that project as...
http://test/<whatever_else>/
Here is my 3 step how-to to solve it, though I am not sure of any unintended consequences other than zend debugger not working.
From Eclipse, go to Windows/Preferences
Go to PHP/PHP Servers
Change Default PHP Web Server from http://localhost to http:/
The project will append the second slash and your project name if you just let it auto-generate.
Hope that helps someone. Helped me a ton.
You can modify the org.eclipse.php.server.ui plugin to get it the way you want.
Use the Plugin devlopment perspective of Eclipse to modify the plugin. The dialogs are available in
/org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/ui/launching/PHPWebPageLaunchShortcut.java
/org.eclipse.php.server.ui/src/org/eclipse/php/internal/server/ui/ServerLaunchConfigurationTab.java
https://vsubhash.wordpress.com/2013/01/26/fix-for-url-auto-generate-bug-in-eclipse-php-pdt-plugin/

Switching between Htdoc Webroots - Change my "DocumentRoot" variable in "httpd.conf" or use Symbolic Links?

I've officially reached the end of my wits on this problem. As someone who constantly works on several websites at a time (I'm sure I'm not alone here), it becomes frustrating renaming my "htdocs" directory whenever I want to work on a different site, so I decided to throw together a simple script.
My first approach was to reset the "DocumentRoot" variable in "httpd.conf" based on the directory input I provided, however, having a DocumentRoot outside of the main "/Applications/XAMPP/" directory has proven to be a bigger problem. As you can see, I'm running OSX with an XAMPP installation. Ideally, I'd like to have all my sites located at "/Users/Me/Sites/*". Even when I tried to move my sites within XAMPP's base directory, Apache does not want to load anything other than "htdocs" as my DocumentRoot.
My next approach was to simply add symbolic links to all the files/directories within each site I was working on at the time to "htdocs". This loads fine in the browser for basic html files, however, I work primarily with PHP and this does not appear to want to render (I can see the file but it will not display as a webpage).
Neither of these approaches in themselves sound too difficult, but from learning Xcode, to AppleScript, to Apache's httpd.conf documentation, I feel I've experienced enough headaches. I've played with permissions for each attempt I've gone through and nothing has panned out for me yet.
I'm sure there are plenty of other webdesigners out there who have faced this problem in the past, what's your solution?
This is actually really easily achieved, given that you are using XAMPP, I am not 100% but if you go under /bin/apache2/conf/extras/ you should see a file called httpd-vhosts.conf in this file you can add as many virtual hosts as you want. Make sure you set the ServerName to be something unique. Once that is done, make sure that the Include Vhosts is enabled in the httpd.conf
Now, you just edit your hosts file. I am not sure where this is on OSX, since it is linux based I would say /etc/hosts but google will help you. Add a line for each of your sites like so:
127.0.0.1 site1.dev
127.0.0.1 site2.dev
etc. Now restart apache and in your browser type site1.dev and apache should understand it and take you to that site. Pretty simple.
Brad's solution should work.
If you are on OSX, you might also want to check out MAMP (http://www.mamp.info/en/index.html). There is a free and "Pro" version. I've only used the free version but it's pretty drop dead simple to change the root directory from one project to the other. Only kind of gotcha is the MySQL which uses a socket to connect but if you know what you are doing, this isn't a big deal.
Once you'll understand the virtualHost things, let'say you'll use names based virtualhosts and edit you host file to get all theses names matching your development server IP, once done, you'll see you will have to adjust documentRoot and directory settings on all theses virtualhosts for each new project.
So a generic solution exists: mod_vhost_alias : http://httpd.apache.org/docs/2.2/mod/mod_vhost_alias.html
All you virtualhosts will be the same, with variables (documentRoot, serverName,etc). If you want specific setting for some projects ensure you have allowed .htaccess files and set the specific things there.

Problems while Developing MVC Projects using WAMP server

I am trying to develop websites using Zend Framework. But I came to a strange problem, the public folder is not showing up. I was suppose to change the apache's configuration to redirect http://localhost/ to http://localhost/public, but there are many projects inside the WWW folder, which has to be accesed.
I can enable the mod_rewrite to bring out the public folder, but I am not allowed to change it while I upload it to the actual web server. Is there anyway to solve this problem?
May be a .htaccess file to change the site root folder would be of help.
This answer is a detailed description of manually setting up your virtual host and configuring a basic ZF app to run. Hopefully it will help.
Update: Given your edited question, perhaps my blog post discussing one approach to deploying a ZF app on shared hosting might be helpful.

Categories