It is been a long time since i last used php. If i remember correctly, I used php around 2 year and 6 months back. Since them am fiddling with RoR and java with struts, hibernate , and scala with play.
It's a reminiscence for me.
Ok, lets start with php5 with laravel.
Setup:
sudo apt-get install apache2 php5
Once, apache2 is installed, move to next step of creating a site.
Here is the template of site look like:
http://localhost
Now, lets edit /app/routes.php file and add our "hello world" route
Route::get('/hello', function() {
return 'Hello world!';
});
Point your browser to : http://localhost/hello
happy coding.. ;)
==============================
Issue:
Routes not working?
Solution: Please verify you have 'rewrite' module enable. If it's enabled then verify you have write permission to laravel project dir and it's subfolder.
If it's still not working, then google is your friend.
Reference:
It's a reminiscence for me.
Ok, lets start with php5 with laravel.
Setup:
- Install apache
- create config file
- enable rewrite module, if not
sudo apt-get install apache2 php5
Once, apache2 is installed, move to next step of creating a site.
Here is the template of site look like:
Now, you may see your site at following destination<VirtualHost *:80># Host that will serve this project.ServerName app.dev# The location of our projects public directory.DocumentRoot /path/to/our/public# Useful logs for debug.CustomLog /path/to/access.log commonErrorLog /path/to/error.log# Rewrites for pretty URLs, better not to rely on .htaccess.<Directory /path/to/our/public><IfModule mod_rewrite.c>Options -MultiViewsRewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteRule ^ index.php [L]</IfModule></Directory></VirtualHost>Edit it to suit laravel project directory. Replace "/path/to/our/public" with the path to public folder inside laravel project dir.Now, put this site inside /etc/apach2/site-availableEnable site:a2ensite site_nameEnable rewrite modulea2enmod rewriteReload apache2sudo service apache2 reloadRestart apache2sudo service apache2 restart
http://localhost
Now, lets edit /app/routes.php file and add our "hello world" route
Route::get('/hello', function() {
return 'Hello world!';
});
Point your browser to : http://localhost/hello
happy coding.. ;)
==============================
Issue:
Routes not working?
Solution: Please verify you have 'rewrite' module enable. If it's enabled then verify you have write permission to laravel project dir and it's subfolder.
If it's still not working, then google is your friend.
Reference:
- laravel site config: https://github.com/daylerees/laravel-website-configs
- Routes not working? http://stackoverflow.com/questions/12045881/php-laravel-routing-issue
No comments:
Post a Comment