How to insert Laravel Project into Apache Tomcat servelet? - php

I am new to web development and I am stuck on how to insert my project into Apache Tomcat. Before I created a simple website and inserted my code into the web apps folder and routed the url to that location. I tried the same thing with laravel and routed to public/index.php and all that shows up is the file index.php it doesn't pull up my site.

Apologies if I've misunderstood your question -- all your words makes sense but the order you've put them in does not. Apache Tomcat is for running Java applications. Laravel is a PHP framework. PHP web applications work by using the Apache web server, or a fast CGI implementation in other web server light nginx. They have nothing to do with Tomcat.
Setup apache to treat your Laravel public folder as a document root, and configure apache to sue mod_rewrite and .htaccess files. That's the basic Laravel (and PHP) setup.

Related

Laravel running on an existing Ubuntu Web Server

So I am setting up a laravel project on my existing Ubuntu Dev server. (So I won't need to run php artisan serve)
I managed to make it work by renaming server.php to index.php and copied the htaccess from public to project root.
However I am concerned if this might create a security issue? Is there a better way how to do this?
I believe This would also apply once the app is deployed to a live server.
Any feedback would be appreciated!
EDIT:
This is for development environment only as in my /var/www I have other projects not related to laravel and cannot change apache's virtual host to point to this laravel project. (Basically I need to run laravel in a subdirectory)

Why does this PHP Framework display the directory index rather than the webpage?

Since this is a problem that is related to an entire project which is finished, I do not think I will be able to post the entire code. If any additional information is needed, please ask and I will edit this.
I have a website that was developed for one of my classes using this PHP Framework: https://github.com/panique/mini. This website works on a server that I rented from HostGator (which provided me with a LAMP stack) and I am now trying to move the website to an AWS EC2 instance.
I have setup an AWS EC2 using the documentation and tutorial provided by Amazon and am able to successfully host webpages from my instance after installing the LAMP stack. The PHP Framework that I am using requires PHP 5.3+ which I have on my EC2 instance. I have also set up MySql correctly and I am able to access my databases using MySql Workbench.
I have uploaded the project files onto the public directory where the webpages are served which is var/www/html/. and have configured the config.php file correctly with my MySql information (it's the exact same login credentials as I used for MySql Workbench).
So now onto the problem I am experiencing. Whenever I browse to mydomain.com/Project (let's say the project is in var/www/html/Project) I get the directory index rather than the web application that I developed. From what I read in the Github readme, the PHP Framework should work after configuring the MySql database information in config/config.php. I know that this is correctly configured because I am able to make calls to the database tables.
Has anyone had any experience with this PHP Framework? This is the first time I have actually set up a LAMP stack in Amazon Linux. I was wondering if there are any configuration settings related to Apache that I should have configured?
New frameworks today separated /public directory for request accessible.
You have option to
1. Point your apache to /public
edit fie /etc/httpd/conf/httpd.conf (depend on distribution).
and change
DocumentRoot "/var/www/html"
to
DocumentRoot "/var/www/html/myframework/public"
you can also do this with VirtualHost or Alias.
2. Using .htaccess + mod_rewrite to framework's root directory.
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L,QSA]
3. Add an index.php file to your framework's root directory.
<?php
header('Location: public/');
// This option is not really fix the problem. it's just redirect user to `/public`. you will always have `/public` in your urls.
// It's only work for home page.
// You can use only relative path to your assets.

Running PHP and Rails apps under the same (Apache) web directory structure

My company have several apps running alongside on an Apache2 web server which resides on an Ubuntu server.
Our setup includes:
A portal website is set at Apache's document root "/",
Another customer service app (written in PHP) resides under a sub directory ("/php_app").
With that setup, everything seems to be working perfectly and smoothly.
However, afterward, there comes another requirement to have another ruby on rails app to be implemented under the same root directory's structure.
and that ruby on rails app should belong under another directory (under the same root) called "/rails_app".
I doubt if this setup achievable?
By the way, from my quick research, this should be possible by deploying ruby on rails app using Passenger Apache (Please follow the reference article here: https://www.phusionpassenger.com/library/deploy/apache/deploy/ruby/)
The reason we need to put them all under the same directory structure because my company will later need to share authentication system between all apps (SSO or a mechanism of such kind), and what I heard of from googling is it's best that all apps should be put under the same domain.
I need to hear anyone's working experiences on this kind of setup requirements to be shared with or anyone could suggest if my idea is possible or not?
Thank you very much in advance.

Moving CakePhp installation from internal dev server to local web server

I have setup CakePhp inside one of my application and able to run my application's scaffolding code on the internal development server at port 8765.
Now i want to make use of my local web apache web server.
I checked the documentation of CakePhp. Its mentioned like below
you should be able to move your CakePHP install (including the
hidden files) inside your webserver’s document root. You should then be able to point your web-browser at
the directory you moved the files into and see your application in action.
I am using Apache server so my document root is htdocs and can be configured through httpd.conf.
Now according to the above statement i have below queries
(a) What are the cakephp install files. I have a project created with all cakephp files.
(b) My project is already under htdocs which itself contains all the cakephp files. Where do i point my document root to ?
(c) How do i detach my application code with the cake php install files ?
Regards,
Saurav

install zend framework without apache virtual hosts

I have my website in /var/www/invent. I have zend-framework in /var/www/invent/library.
Basically what i want is when i access http://localhost/invent to work as if i had a virtual host "invent" defined in apache conf file (like accessing http://invent). How can I achieve this?
I have developed my project under windows, having virtual hosts set up but I don't want to continue working like this because i cannot deploy my app on public webhosting services that do not allow me to create virtual hosts. Not to mention that if I deploy an app on a LAN, i need to configure the client's hosts file as well...
Please help, this is the most annoying thing with zend (haven't tried other frameworks so far though).
Your application document root is wherever you place your index.php file, the locations of the Zend Framework library and your application code are irrelevant.
Provided you've used the BaseUrl helper in your views for static assets (JavaScript, CSS, images) and the Url helper for action links, your application should be very portable in regards to relative path from the web server document root.
Let me know if I'm way off track here. Your question could do with some more details.
remove vhost property and go directly to http://localhost/yourproject/public folder. You will need to stay with htaccess mod_rewrite , don't delete mod_rewrite properties in htaccess

Categories