Deploying Laravel Application to Shared Hosting

I added this article to Stackoverflow Laravel Documentation, i thought it would be great if it is in my blog too. Deploying Laravel Project to Shared Hosting is easy.
image-is-100-percent-not-related-to-the-topic

Requirements:

  • PHP >= 5.5.9
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • First of all archive/zip/compress your project file
  • Now Let say you have shared hosting server and you want to deploy your laravel project / app there. In your Hosting cPanel click on Filemanager it will lead you to another page where you can find the directory/folder called public_html .
  • Upload the compressed project file to public_html directory and extract it
  • Now you can move all your project files to public_html ( just select all project files and click on move, it will pops up a box enter public_html there )
  • Now in cPanel you can find MySQL Databases, Create Database, database user and password plus assign user to your created database in there.
  • After creating database, in cPanel Click on PhpMyAdmin and Select the database you have created. Import the .sql file from your local PhpMyAdmin.
  • Once importing is done, Visit public_html directory and edit .env file
  • In .env change the following lines accordingly
DB_DATABASE=yourdatabaseName
DB_USERNAME=databaseUsername
DB_PASSWORD=databasePassword
Save the .env file and now visit yourwebsite.com/public and your project will dance there.
BUT what if i want don't want /public in my website, i.e i want to run my application on my website root (website.com) for that do the following steps.
Copy all the /public directory files to root directory, and edit index.php.
Change
require __DIR__.'/../bootstrap/autoload.php';
And for LARAVEL 5.5+ Users Change the below
require __DIR__.'/../vendor/autoload.php'; TO the below
require __DIR__.'/vendor/autoload.php';
To
require __DIR__.'/bootstrap/autoload.php';
And
$app = require_once __DIR__.'/../bootstrap/app.php';
To
$app = require_once __DIR__.'/bootstrap/app.php';
Once that is done, in server.php change
 if ($uri !== '/' && file_exists(__DIR__.'/public'.$uri)) {
    return false;
}
To
if ($uri !== '/' && file_exists(__DIR__.'/'.$uri)) {
    return false;
}
And
require_once __DIR__.'/public/index.php';
To

require_once __DIR__.'/index.php';

1 comments:

Life tip

Sometimes all you need is to remove someone from your life, then your life become easier.

0 comments:

Find your passion and you will never work a day in your life.

Assalam-O-Alaikum. I am Iftikhar uddin, a Software Engineer and Full Stack Web Developer. Today I will share some tips about career which I have faced in my life and I hope someone may get help from my experience.


First of all one thing I am going to focus on is Passion ! Passion is 7 letter words which makes our life beautiful, successful and of type which we would never regret in the whole life and I bet you will be happy if you try to learn the real meaning of passion. In our generation, the problem is they get inspired so quickly from films, and shit ideas… they define passion and love for work in some manners which are just limited to a character.  But let me tell you the definition or definitions of passion which I have learnt from my experience, mentors and teachers.
  •         Passion is something which kicks you out of time and space 
  •         Passion is when you work 18 hours a day and you are not tired.
  •         Passion is work which will make your inner happy.

You may be thinking that I am trying to be a philosopher, but the fact is without passion your career is nothing. If you haven’t found a passion and you are trying to get a job you are just wasting your precious time nothing else. You may have noticed some people they said oh again Monday, let me tell you they don’t hate Monday they just hate their jobs. And the reason behind that hate is they haven’t spent time on finding their passion, otherwise they would never regret. So, I hope it is crystal clear now that how to find your passion. If still confuse read the above 3 definitions again and you will find your passion easily.

Now once you find out your passion, the game begins.  Now in your field about which you are passionate you will find to many routes. Again there you will see many fields which will surely confuse you. Take example of Information Technology field, when you get into it there are hundreds of fields, you will face many problems and will be confused for long time in this thinking that where to go and which field to select. In case of IT field one will say Go for Software Development, some will say no go for web development BUT the critical point here is DO research not just act on blind advices ! Suppose I love web, I will surely preach about web BUT you are blessed with mind ! You have to think too, you have to do research about the field you gonna jump into. Because in the near future, you will be responsible for your decision. So in simple words take advices BUT do research yourself to, so once you completely get satisfied about a field…. There you’ll meet your perfect and pure passion. This will be the passion which will not bore you, this passion will then let you work 18 hours a day. And believe me you will never get tired and bore, you always will be happy and won’t regret it.


First when i started Software Engineering, I was totally blind about these facts. When I came to know the there is a huge ocean in Software Field, I was stuck and was totally upset that what to do ? Which field to select. But one day I grab my laptop and started research my self, I googled about different fields related to Software Engineering. I asked the people who were in the market, I contacted them one by one. I collected a lot of precious advises, then again I studies that and again did a lot of research on YouTube, Google, and Forums. And finally I found my passion in Web, now I professionally I am Software Engineer but by passion I am Full Stack Web Developer, and you know this just makes me a happiest person in the world. You may be thinking that what the heck I am talking blah blah. BUT believe me once you get into this world you will get it. Another thing skills has price but passion is priceless. 

0 comments:

How my first product was approved in Envato Market

From 2013 i was trying to publish and contribute in one of the great market place in internet world called Envato.
Envato Market is a collection of themed marketplaces, where creatives sell digital assets to help bring your ideas to life. Buy anything from Photoshop actions and video footage to advanced WordPress themes and plugins.

First of all i tried the most trending Themes Market called ThemeForest. But you know, every time i was kicked on my ass. Back in 2013-14 i was submitting WordPress and HTML5 themes but all in vain. The point was, i was submitting products in which i was having hardly 2-3 months experience and to be honest i was cloning other designs and codes. But i didn't stop there, i created my own themes from scratch but that too was hard rejected. And i was like totally disappointed from Envato market. But you know when you have passion of something, nothing can stop you. I again created a HTML5 theme which was just wow in my views, but ThemeForest was like you're not part of our family ma nigga.

You know what was the real reason behind these rejections ? Limited Knowledge of field! Let me elaborate this, by limited knowledge i mean that if you want to approve a WordPress Theme at ThemeForest you should study the market themes, you should hangout in the forum to know the rules, plus you should read all the standards which applies to the product before submission. And i was ignoring these things like Terms and Conditions which was the main reason behind all the rejections. But let me tell you don't play with Envato if you want to approve your product be original and create your own. Study the product requirements and all standards which applies to your product. Then you just submit and let Envato do all the stuff for you.

Well, after all these failures i started studying Envato market seriously and specially PHP Scripts this time. After my little research about the market finally i started to work on a Laravel based Result Management System which i called RMS. I worked on this application for 2 months, and it was my second Laravel project. I added all the features i thought would be worthy for users. In this session i learnt alot about web development and Envato Market. I think it was my life changing research. But i didn't stopped there, i tried to contact some Envato authors and asked them to help me, some of them replied while many didn't. But i won't forget the help of those who replied. And surely i asked questions about their products and their first approval plus what should i do ? what things you think are important to take care of before submission ? And many other questions. And as a result when i crafted my app. Finally, i submitted my app to CodeCanyon ! Okay, here is the interesting story. Now i was waiting for another kick. I opened my gmail and i saw an email from Envato Market, and you know my heart beat was 90 per minute at that time. But when i checked there was a soft rejection mail from Envato Quality Team, and up to that time i was un-aware that soft rejection means 99% approved but do some little modifications which Quality team has suggested. And i spent 2 more days on the mentioned things to improve among which documentation was a lacking factor. I work upon my documentation plus other things which the Envato Quality team has mentioned and resubmitted. After 24 hours i got an email and you know i was in Clouds !

Congratulations! 
Your update to RMS - Laravel Result Management System on CodeCanyon has been approved. You can view your item here: 
 http://codecanyon.net/item/rms-laravel-result-management-system/17098010 
Thanks for your submission! 
Regards, Envato Market Team
Well, this was my story ! Now it's your turn to turn your dream into reality by making into the Envato Market. And yeah i am not that much expert to share my experience but i faced too many problems and i didn't found even one article from Envato authors which helps the newbies. So if you are looking for some tips here is the list and Good Luck !

Tips before submitting your product into Envato Market


  • Your product idea should be Unique ! And if not unique think what features you can add that you can beat the available product(s) in the Market ?
  • There should be no inline CSS, JavaScript and empty functions
  • No encrypted code is allowed, so make sure you have no encrypted code
  • Organized Structure of your project folders
  • Code should be according to standards, by standard i mean that use the code which is consider good practice in your field.
  • Give proper credits to the packages / libraries / images you use in your project 
  • Design should be simple and creative. Don't use colors which doesn't make sense, follow the trend.
  • Move all the business logic to your Controllers
  • For WordPress Users move all functions to functions.php and even if there is some if else statements or variables in header.php move that to functions.php and call the function back in header.php, it is consider friendly when using child themes.
  • There should be no security vulnerabilities, i will suggest to double check all security vulnerabilities and routes protections in your project
  • Don't copy and clone designs and codes
  • Documentation should be easy as eating piece of cake. Consider your buyers non-technical. In simple words create some screen-casts for using and installing your product.
These were some points i shared with you guys. If you have any other just shoot it in the comment box. I will constantly add new tips if i found useful. Good Luck !




0 comments:

Selling your skills is a great skill - Iftikhar uddin

Selling your skills is a  great skill - Iftikhar uddin

0 comments:

Fear flees when you hug it!


Fear flees when you hug it! - Iftikhar uddin 

0 comments:

Assalam-O-Aliakum and welcome to my blog

Thanks for landing on my blog , i'm Iftikhar uddin and i am starting this blog to share my experiences with you people. My blog will include life tips, computer tips , web development tips and many more.
iftikharuddin

0 comments: