zend docroot does not change - php

Just now I have start with zend framework, I have succesfully install zend framework, I followed the quick start guide I am stuck with doc root.
Short description of what I have done
1) Install lamp and zend framework
2) cd /var/www
3) zf create project quickstart
4) cd quickstart/library/
5) ln -s /usr/share/php/libzend-framework-php/Zend .
6) vi /etc/apache2/apache2.conf
<VirtualHost *:80>
ServerName zend.gworks.mobi
DocumentRoot /var/www/quickstart/public
SetEnv APPLICATION_ENV "development"
<Directory /var/www/quickstart/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
note: also I tried with /etc/apache2/sites-enabled/000-default.conf but no luck
7) service apache2 restart
But still my browser point /var/www/html/index.html not /var/www/quickstart/public/index.php, I'm out of ideas. can anyone help me what I miss?
Solution (update)
I did right. when I restart vagrant, document root problem got solved, I don't know why it is not work previosly. but it throws .htaccess: Invalid command 'RewriteEngine' then I run this command sudo a2enmod rewrite && sudo service apache2 restart now it shows zend framework welcome page

You need to edit /etc/hosts file and add below line then do apache2 restart..
127.0.0.1 zend.gworks.mobi

Related

Can't route to CakePHP Controllers with Apache

I have my own digitalocean droplet setup and followed this tutorial to a T to get Cakephp working
Setup CakePHP with LAMP Stack
Everything works exactly as written in that tutorial besides for 'Step 6' - Creating the Article user interface. (Books in my case)
After using the bake all command and navigating to `/books' I get a 404 not found
As you can see CakePHP is setup and working at the top level URL, however when trying to move past that to a Controller that definitely exists it can't find it.
After some more digging, I found the issue. Apparently mod_rewrite is turned off by default on Ubuntu
`sudo a2enmod rewrite
systemctl reload apache`
is the solution here
Make sure your rewrite mod is On
If you are using Linux goto /etc/apache2/sites-enabled -> open 000-default.conf file
<VirtualHost *:80>
....
// add these lines
<Directory /var/www/html>
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>
....
<</VirtualHost>
Save it.
restart your server: sudo service apache2 restart
give your project permissions by giving this command:
sudo chown -R user_name:www-data project_name/
sudo chmod -R 755 project_name/
cd project_name
chown -R www-data tmp
chown -R www-data logs
chmod -R 777 tmp
chmod -R 777 logs

Host Laravel on apache tomcat, routes not working properly

I want to host my laravel 5.2 project on apache tomcat server.
I have tried to host my laravel application on tomcat, but my routes are not working, getting 404 not found.
Please follow following steps:
Copy your Laravel Project's root folder to /var/www/html, or clone your
project on this path
Run composer install (You must have composer installed already)
Copy .env file from local environment to you server on project's root directory
Run php artisan key:generate
run chmod -R /var/www/html/{project_dir}/storage
run chmod -R /var/www/html/{project_dir}/bootstrap
run cd /etc/apache2/sites-available
Here you will find nano 000-default.conf file. Open it & change DocumentRoot options like DocumentRoot /var/www/html/{project_dir}/public and save it
Next, Find the apache2.conf located in /etc/apache2
Search for following lines in <Directory />:
Options Indexes FollowSymLinks
AllowOverride All
Require all denied
Change it to this:
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
run sudo a2enmod rewrite
run sudo service apache2 restart

How to Deploy Laravel app on Apache Production server

I am try to run Laravel app in Ubuntu 16.04 Apache server.
It is show server error as fallows
This page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500
but i run it on development artisan server using below command and its working.
php artisan serve --host=192.168.2.103 --port=8050
pls can you explain what i have done wrong way in Apache server and how to do it correctly.
STEP 1
cd /etc/apache2/sites-available/
STEP 2
sudo cp 000-default.conf yourprojectName.conf
STEP 3
sudo vi yourprojectName.conf(you should know vi editor command)
STEP 4
Update below code
ServerName siteexample.co.in
DocumentRoot /var/www/project/public
<Directory /var/www/project/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order Allow,Deny
Allow from all
</Directory>
colse the editor
STEP 5
sudo a2ensite yourprojectName.conf
STEP 6
sudo service apache2 restart
Now will work
Congratulations!

"The requested URL was not found on this server" error in laravel php project

I started to develop a project with laravel. I installed it using this link how-to-install-laravel-on-ubuntu-lamp.
I installed composer successfully, and using this command : sudo composer create-project laravel/laravel /home/egz-pc/laravel-project I created new project named laravel-project then a changed permissions using chmod 777 command.I restart apache and execute my project.
My problem is that when I type in browser: http://localhost/laravel-project I'm getting an error: The requested URL /laravel-project was not found on this server. If I create a project in /var/www/html on my local host I have no problems, and that error does not appear. What can I do?
The Apache server is installed on var/www/html.This is the default root directory of apache.
Either change the root directory of Apache or move the project to var/www/html.
To change Apache's root directory,
Run
cd /etc/apache2/sites-available
Then open the 000-default.conf file using the command
nano 000-default.conf
Edit the DocumentRoot
Then restart the apache server
sudo service apache2 restart
If you get "Forbidden You don't have permission to access / on this server" after changing the root of apache then do follow these steps
1.Find the apache2.conf located in etc/apache2 and open it using
nano apache2.conf
2.Use ctrl+w and search for Directory (It should be in line 153)
3.It should look like this
<Directory />
Options Indexes FollowSymLinks
AllowOverride All
Require all denied
</Directory>
4.Change it to
<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
5.Restart apache2 and it should work.
EDIT:
I have made a script that lets you change Apache root directory in 1 command.
Link: Script for Apache

How can I enable moodle?

I've installed postgres for moodle and I got the following instructions:
Apache/mod_php setup
Give full access to the project directory to the process running
apache. You might also have to set the x-flag on all .php files.
$ chmod -R a+rw * Create a 'moodle.vhost.conf' from moodle.vhost.conf.example in project directory. * Create a symlink
from /usr/local/var/moodle to the project directory.
$ cd /usr/local/var; ln -s moodle * Also symlink the new virtual host into apache config dir.
$ cd /private/etc/apache2/other
$ sudo ln -s /moodle.vhost.conf moodle.conf
$ sudo apachectl restart * Create your own custom /etc/vcmoodle/config_local.php file for things local to your
environment by copying, and modifying if required, the example file.
$ sudo mkdir -p /etc/vcmoodle
$ sudo cp /config_local.php.example /etc/vcmoodle/config_local.php
Still it won't work. When I look at my apache root then it comes just the standard apache page and no moodle. I've this sites-available
:/etc/apache2/sites-available$ ls
000-default.conf default-ssl.conf moodle.conf
and the file moodle.conf contents
<VirtualHost *:80>
DocumentRoot "/usr/local/var/moodle"
ServerName moodle.localdev.kth.se
ErrorLog /usr/local/var/moodle/error_log
LogLevel debug
<Directory "/usr/local/var/moodle">
AllowOverride all
Order allow,deny
Allow from 127.0.0.1
</Directory>
</VirtualHost>
But I don't get a moodle page at my web server. What am I doing wrong?
if youre running Ubuntu (judging by the tag), you need to put your project directory inside /var/www. Apache cant access project folders inside your specified directory unless you change the users/groups etc.
what youve tried is the normal apache default location for web folders, but Ubuntu like to change things.

Categories