zend framework basepath - php

hi i have a web application installed in a remote server i wanted to modify this web application so i downloaded all the files from the server
.zfproject
library folder
application folder
public_html folder
and i created a folder called newZend in my local xampp\htdocs folder
when i tried to access the website
"http://localhost/newZend/public"
it gives me an application error saying
script 'login/index.phtml' not found in path (C:/xampp/htdocs/newZend/application/modules/user/views\scripts/)
i believe something might be wrong with the url router or base path..please help

The standard Zend Framework .htaccess rules and routes will take the url you gave
when i tried to access the website "http://localhost/newZend/public"
and call for the "index" action of the "public" controller.
None of my Zend apps allow access directly to the public directory. Try this url:
http://localhost/newZend
which will call the index action of the index controller.

Related

Laravel: Put index.php in a subfolder of public folder

I have singlepage app at https://example.com.
App's api and backend is driven by laravel.
Can someone point me to the right direction how to open my spa at: https://example.com and backend at https://example.com/backend
What I've tried:
I've put all my files of SPA in public folder and move laravel public files (including .htaccess and index.php) in public/backend folder
Changed the public path of laravel to public/backend
This gives me Internal Server Error when access https://example.com/backend
Thanks in advance!
In case you want your SPA served via Laravel
Edit your routing so the api group is changed to backend. Then create a route in the web group for / which loads a blade template containing your vue components and vue router. The vue router will handle the SPA page loads after its loaded.
In case you want your SPA served separately from Laravel
In this case you'll have an entry point for your backend which is index.php. And you'll have an entry point for your SPA which will be index.html.
I would advice you to keep your index.php in the /public folder of our Laravel installation. Then change the way index.html is compiled so it's placed in a different folder, lets say /build. You can probably achieve this by adjusting some webpack or vue-cli settings. Then adjust your webserver configuration (apache/nginx) so it will have the following two entries:
https://example.com/backend which maps to /var/www/{project}/public
https://example.com/ which maps to /var/www/{project}/build

error invalid controller specified in zend framework after upload to another folder

My problem is, when i upload my project into hosting:
http://172.20.30.43/psm/CB11011/
i got this error
An error occurred
Page not found
Exception information:
Message: Invalid controller specified (psm)
this is my full domain link..
http://172.20.30.43/psm/CB11011/carrental/public/user/register
But if i access in localhost,it look fine. This is my url for localhost..
localhost/carrental/public/register
The true controller is "register", not the psm.. for the base url i already add a line into application.ini, this is my code :
resources.frontController.baseUrl = "http://172.20.30.43/psm/CB11011/carrental/public/"
the problem path for css,js or another include file in layout.phtml look fine. They can link to right path, the only error is zend framework wrong pick my controller.. what should i do guys??
i'm sorry for my explaination, i'am new with zend framework, Don't know how to explain well using term in zend framework.. this is my first project using zend framework.
The problem is that your application is in an subfolder in your hosting environment. This way zend thinks (with this call http://172.20.30.43/psm/CB11011/) that it should access the controller psm and call the action CB11011. Simply change your .htaccess file inside you /public directory.
Something like this (untested!!!) should be fine:
RewriteEngine on
RewriteRule (.*) ./psm/CB11011/$1
And change the path to the frontcontroller inside your application.ini:
resources.frontController.baseUrl = "/psm/CB11011"
PS: There a some security concerns about putting the whole application into a subfolder, since your controller/modules might be accessible!
Try just inserting the following:
RewriteBase /psm/CB11011
into your .htaccess file, where psm/CB11011 is the subdirectory you moved the application to.

Cakephp Requires Controller

Can anyone help me,
i developed my application with Cakephp 2.1, and it works fine on my development server running Centos 5.7. My challenge came when i transfer my application to the lice server to be accessed by on LAN. It states that a missing controller which is not available in my whole application, for example, i named my folder which contains my application and uploaded to the correct folder in Centos, e.g /var/www/html/students and every time i need to access the application states that students controller is missing. I tried to rename my folder to 'mysite' and the errors still remain with mysite controller is missing.
So everytime i changed the name of the folder it states a missing controller for that named folder. I tried to figure out in core.php but cant find the solution.
To change the base directory to say /mysite you will have to modify your 3 .htaccess of cakephp i.e one in installlation folder , second inside the app folder,third inside the webroot folder
try adding:-
RewriteBase /mysite/
Hope this helps!

wordpress integration with codeigniter base functions conflict

I have developed the CRM based web application what i need to do is to integrate the wordpres with my CI first i have the problem when i include the main WP file
require('./wp-blog-header.php');
in my one of the CI view file the error i was getting that function site_url() conflicts this function is the base function of both WP and CI ,although i found a solution to include the WP file in the main index.php file of CI but there is uncertainity too that after this the session library of CI stops working is.
How to show the posts of WP in the footer of my CRM?
When using include or require in my CodeIgniter views I make sure the files I am linking to are outside of the CodeIgniter application folder as I had trouble using files there because of some permission problems. My solution was to just keep a folder in my web directory. You also cannot use base_url or site_url CodeIgniter functions here since you want to get the server path not the web address of the file. So you can use the php variable $_SERVER['DOCUMENT_ROOT'] which will return the root of your web directory.
It might look something like this:
require($_SERVER['DOCUMENT_ROOT'].'wp-blog-header.php');
Which would work if wp-blog-header.php was in your web root directory.

How do I get CakePHP configured so it shows up correctly in my browser?

I am a cakephp newbie and I had trouble to view the files under the view folder through browser.
I used cakephp console to bake model, controller and views. (ex: Invoices_controller.php for controller, invoice.php for model and a invoices folders under views folder). According to the tutorial I read, I can access the invoice view by typing http://localhost/myProject/invoices
(there is no index.php inside the invoices folder..but the tutorial shows it still can display a page. no idea how they did it)
The path for my invoices is myProject/views/invoices and there add.ctp, index.ctp, edit.ctp files inside the invoices folder.
The browser showed the file is not found when I typed http://localhost/myProject/invoices
You have some lack in your knowledge about how the webserver handling a request when cakephp is installed. Assume that we use apache.
In cake's folder structure you can see .htaccess files in the root, app and webroot directories what have url rewrite rules in them. At the end a normal request to a cakephp site will be transformed to a http://site.url.root/app/webroot/index.php?url=original.url
In nutshell to understand it in your point of view:
That index.php call the required php files and at least a cakephp app object is built up in the memory with the required models and methods. Then the app object let say start and calls its methods (model, controller and view methods) and at the end it gives back a result to apache what serves it to you.
Therefore the original url path is a "non existent" virtual url.
If you enter http://localhost/myProject/ do you get a cake intro page? If so does it highlight any problems?
It sounds to me as if you do not have Apache set up properly. I don't know what OS you're using, but it might be worth checking this link, written for Ubuntu, to make sure all is well: http://leoponton.blogspot.com/2010/05/getting-cakephp-up-and-running-on.html
I fixed the same problem.
if you are using windows 7 os, wamp server, cakephp 2.2.3. then
goto apache -> http.conf -> open -> search for mod_rewrite -> uncomment the line LoadModule rewrite_module modules/mod_rewrite.so
Now restart your server, now it should work fine.
Jerry, I think the issue is this. You have put the CakePHP folder in the root of localhost. I would propose that you create a virtual host pointing the myProject so the url becomes:
http://myProject/accounting
This may solve your problem. Be sure rewrite module is on. Also, when you point the virtual host to myProject, it should be the APP folder of the cakephp. If you want to run multiple projects off the same core, you can set them up like so:
/var/www/cake
/var/www/html/myProject
/var/www/html/myProject2
The /var/www/cake directory is where you drop the cake core. Under this directory you will have cake, app, plugins, vendors, etc. the myProject(2) directories will be the contents of the app directory.
Now, to get this to work, you need to go to /var/www/html/myProject/webroot/index.php and edit it to point to the cake directory in /var/www/cake. This will then load the core when rewrite points to index.php in webroot. You should be good to go!

Categories