PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Tue Oct 17, 2017 2:31 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Mon Sep 25, 2017 2:36 pm 
Offline
Forum Contributor

Joined: Wed Sep 25, 2013 4:09 am
Posts: 170
Hi,

so the time have come when I'm ready to try out a PHP framework.

I chosed Laravel because I heard it is quite secure and have nice functions for RESTful API. It also seems quite popular and according to what I read in some articles it has a big community and lots of tutorials and is easier to use than some other frameworks if you are new to frameworks.

First question:
I'm gonna make a (hopefully) secure site with login + pw, login with facebook and a restAPI. I'm by no means an php guru but I have some experience. I have ZERO experience with using frameworks.
Do you think Laravel is a good choice for me concidering my "skill" and aim for my project?

Second question:
I used to do all coding straight at my shared host (One.com) in their editor so I never had any local scripts on my computer at home. Last night I installed Apache, netbeans and Laravel (Windows 10).
Do I have to do the laravel site building on my local computer and then upload the result to the shared host or is it possible to install laravel directly on my shared host?

Third question:
If I develope locally..CAN I upload the result to my shared host. Does anyone have experience with Laravel and one.com (<- specifically)?


Ok I think those are enough for now. I will try to do some tutorials now but I'm sure I will return to this thread with more newb questions soon :) Thanks.


Top
 Profile  
 
PostPosted: Mon Sep 25, 2017 3:50 pm 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6384
Location: Montreal, Canada
hybris wrote:
First question:
I'm gonna make a (hopefully) secure site with login + pw, login with facebook and a restAPI. I'm by no means an php guru but I have some experience. I have ZERO experience with using frameworks.
Do you think Laravel is a good choice for me concidering my "skill" and aim for my project?

The framework itself is solid. Check out Laracasts to help you get up to speed quickly.

hybris wrote:
Second question:
I used to do all coding straight at my shared host (One.com) in their editor so I never had any local scripts on my computer at home.

Don't do that. Develop locally, push to Git, deploy from Git.

hybris wrote:
Last night I installed Apache, netbeans and Laravel (Windows 10).

That's a good start. I'd consider looking at a Vagrant VM. If you're using Laravel, check out Homestead.

hybris wrote:
Do I have to do the laravel site building on my local computer and then upload the result to the shared host or is it possible to install laravel directly on my shared host?

You install it directly on your server using Composer. Keep the framework and its dependencies out of your Git repo.

hybris wrote:
Third question:
If I develope locally..CAN I upload the result to my shared host. Does anyone have experience with Laravel and one.com (<- specifically)?

Develop locally then deploy to your remote host. Probably the easiest way is to SSH into your remote server and pull your code down with Git, but there are tools like Capistrano that will allow you to deploy directly from your development environment. I haven't worked with one.com, but I would try to avoid shared hosting when possible. Look at something like Digital Ocean. Costs less and does more.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Mon Sep 25, 2017 5:28 pm 
Offline
Forum Contributor

Joined: Wed Sep 25, 2013 4:09 am
Posts: 170
Ok so I did some routing and middleware / controller tutorials and so far I must say I really really like it so far. It is nothing like I done in my previous projects but I really like the way it is structured (so far, that may change when I'm done with the tutorials and shall try my own code haha).

Great tips, I never used Git before but I seen my friend use it some weeks ago and thought Id try it later on.. might as well do it now then since it seems like I will be developing locally from now on heh.
Digital Ocean looks good but maybe you should check one.com. Its pretty good and cheap. If you write your own code its cheap anyway.. then you pay extra if you want to use their webshop and so on..

Prices:
2,50$/month for basic (unlimited bandwidth, 25GB, 1 domain, 512MB ram, 1DB, PHP & FTP/SFTP, SSL, 1 x CPU)

12$/month for bussiness (unl BW, 500GB, several domains, 2GB ram, several DB, PHP & FTP/SFTP, SSL
8 x CPU, SSH, Backup & Recovery).

And some other subscriptionforms in between ^^


Top
 Profile  
 
PostPosted: Mon Sep 25, 2017 8:28 pm 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6384
Location: Montreal, Canada
I took a look. It’s shared hosting. Not interesting to me. I want full control over the machine I’m hosting on.

Also, yes, learn Git. Git is not optional for software development.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Tue Sep 26, 2017 3:59 pm 
Offline
Forum Contributor

Joined: Wed Sep 25, 2013 4:09 am
Posts: 170
Edit: I checked out Homestead btw it looks very interesting but I don't really understand what it does exacly. Will it install and configure all those programs (Lavarel, php 7.2, mysql, mariadb...) so I don't need to install those things separately?


Celauran wrote:
Also, yes, learn Git.

Well seems like I need to learn how to set up the #¤% php - mysql environment in windows first :/

I did some lavarel tutorials and it went really good until I got to the database part. I just can't get it to connect to the database.
Now Im on that part when Lavarel throws me exceptions it cant find any driver.. I guess it mean the sql driver..

"could not find driver (SQL: insert into student (name) values(groda))"

So I tried to look for a solution and found out that I need to add in apache httpd.conf and add php7apache2_4.dll there... Funny thing is I can't even find that file anywhere on my computer.. Do I need to download it seperately or did I do something wrong when installing php on my computer (did it really late the other night night so was pretty tired.. don't even remember what I did exacly)

Does anyone know of a good guide how to properly set up apache, php and mysql (and lavarel)?

For mysql I thought it was running fine, I could go into the workbench and add users and databases. I could run the cmd
mysql -u root -p -h 127.0.0.1 -P 3306
fine.. I entered my pw and got in.
But when i try
mysql -u root -p -h > localhost -P 3306
and enter my password I get:
ERROR 2005 (HY000): Unknown MySQL server host '-P' (0)

I don't really have a clue what to do now.. Shall i try and find just the apache php dll file and just copy it to my php dir or should i reinstall php? Any ideas?


Top
 Profile  
 
PostPosted: Tue Sep 26, 2017 9:36 pm 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6384
Location: Montreal, Canada
hybris wrote:
Edit: I checked out Homestead btw it looks very interesting but I don't really understand what it does exacly. Will it install and configure all those programs (Lavarel, php 7.2, mysql, mariadb...) so I don't need to install those things separately?

Yes. Probably not PHP 7.2 as I don’t think that’s released yet, but definitely PHP. Also it might use Nginx instead of Apache, not sure, but that doesn’t really matter. The beauty of it is it installs everything you need for you, and does so without polluting your machine. The fact that it more closely resembles a production environment is also valuable.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Wed Sep 27, 2017 4:34 pm 
Offline
Forum Contributor

Joined: Wed Sep 25, 2013 4:09 am
Posts: 170
I wonder how many could-have-been-coders gave up after trying to set up a programming environment and just took another job heh.

I just can't get it to work :(

I tried to follow some tutorials but it seems many of them forget to mention they already have some stuff set up since before or something or some file been changed and the info is outdated..

Anyway the closest I got was when following this guide:
https://www.youtube.com/watch?v=r5cytqxsZf8&t=248
I got the same result as him up to time:10.01 in the video. Prior to that I only had to make some small modification when he cloned from git.. I think he wrote ... .homestead.git but i it couldnt find the file so i just typed it without the .git at the end.. the structure i got in my folder looked just as his though..

I did create the key as he did (sucessfully) but when i did:
lavarel new test (he named his project deepdive and i named mine test instead) i got an exception
Syntax: [ Download ] [ Hide ]
Crafting application...

                                                         
  [Composer\Exception\NoSslException]                    
  The openssl extension is required for SSL/TLS protection If you can not enable the openssl ex
  tension, you can disable this error, at your own risk, b-tls' option to true.
                                                         

install [--prefer-source] [--prefer-dist] [--dry-run] [--dustom-installers] [--no-autoloader] [--no-scripts] [--no-p] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--c [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packa

Application ready! Build something amazing.


I can't figure out how to solve this..

Anyway it still says the application is ready so I thought I could try it out even if it would be unsecure..

Then I tried to check test.app in my browser but got some other exceptions (like the guy in the video does not get).. I looked around some and there was a suggestion some files were missing in this installation and I should do
composer install in the (test folder)
so I did and the exception went away and now I only get to a page that says:

Whoops, looks like something went wrong.

It looks like lavarel font so I guess I'm pretty close with the installation but I have no clue how to fix the last part..


Another question, the exception I got when making the page (NoSslException) I guess it has to do with it cant find the key I created, I took a copy of the key (after I tried to create the test project) and placed it in another folder closer to c: like c:\key\
Now I have no clue at all what homestead.yaml is but before creating the test project the tutorial said I should change some path in it (under sites: to add /test/...) I see above it says keys ~/.ssh/id_rss and i wonder if it could be this line that makes it dont find my key and maybe i should set an absolute path here like c:\keys\id_rss
but I dont know if thats what causing the error or if I shall mess with the yaml file at all..?

Any ideas?


Top
 Profile  
 
PostPosted: Thu Sep 28, 2017 2:54 am 
Offline
Forum Contributor

Joined: Wed Sep 25, 2013 4:09 am
Posts: 170
Ok so I finally got it to work.

If someone else is going through install-hell and get the same errors:

rename .env.example in your "root" created project file.. for me that created a project named test that would be /test/
rename it to just .env

then instead of oops something went wrong you see debug info.. in my case it was lacking encryption key so I went into shell:
$vagrant@homestead:~/code/test$
and typed artisan key:generate

then i tried in my browser test.app and lo and behold, it finally worked!!! So now I'm back to where I started haha but hopefully the db will work now... bbl


Top
 Profile  
 
PostPosted: Sun Oct 08, 2017 11:37 am 
Offline
Forum Contributor

Joined: Wed Sep 25, 2013 4:09 am
Posts: 170
Hello again,

so I think I finally got homestead to work on my computer and I started a droplet on DigitalOcean running Ubuntu 16.04.3

shall I install homestead on there too or just laravel?

I guess I shall install homestead and if so how do I do that? Can I use Vagrant? Does anyone have a good link to a tutorial?

Thanks :)

EDIT: or do I need to install laravel, mysql, php and so on manually on the digital ocean server?

(at home I run virtualbox, vagrant/homestead)


Top
 Profile  
 
PostPosted: Sun Oct 08, 2017 1:06 pm 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6384
Location: Montreal, Canada
You don’t need Homestead or Vagrant on your droplet. Deploy your code, composer install, and you should be set. You will need to install PHP, a web server, and a database server on your droplet. Digital Ocean has pretty good tutorials for doing all of that.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Sun Oct 08, 2017 5:00 pm 
Offline
Forum Contributor

Joined: Wed Sep 25, 2013 4:09 am
Posts: 170
Woha, some tutorials that actually worked without having to search the net for tons of workarounds :)

Ok so I set up apache, php and mysql (was actually easier to set those things up in DO than to install homestead on my local computer heh).

Ok so another newb question.. shall I install git on the server or only have it on my local computer?

Edit and another question:
I installed laravel on my DigitalOcean site using composer create-project --prefer-dist laravel/laravel test
First i got an error Dont have permission to mkdir() so I manually created the folder test and did a:
sudo chmod 777 test
then installed.
Is 777 the correct setting or should I use something else like 775 or 755?

Also I got some warning:
Failed to dl laravel/laravel from dist: The zip extension and unzip comm are both missing, skipping. the php.ini used by your commandline php is: /etc/php/7.0/cli/php.ini
now trying to dl from source
-installing lavarel/lavarel (v5.5.0)
cloning (number and digits here)

created project in test
loading composer repositories with package information
updating dependencies (including require-dev)
Killed

Did it install ok? if i cd test and ls i see
app, database, public, routes, tests, bootstrap, config, resources, storage folders and some files like CHANGELOG.md, composer.json, package.json, server.php and so on so it seems it installed?

If my site is www.mysite.com where do i find the lavarel welcomepage now? If i try www.mysite.com/test i get The requested URL /test was not found on this server.

Thanks and sorry for the noob questions but im not used to unix, composer, DO, lavarel and all.. its all very new to me :/


Top
 Profile  
 
PostPosted: Mon Oct 09, 2017 7:00 am 
Offline
Forum Contributor

Joined: Wed Sep 25, 2013 4:09 am
Posts: 170
Another question:

Im following this guide to install laravel on DO server:
https://laracasts.com/series/laravel-from-scratch-2017/episodes/1

I created a dir in
usr/local/bin named composer
in
usr/local/bin/composer I have the following files:
composer.phar and composer-setup.php

And I can run composer from all dirs so so far I think I got it right but then in the video at min 4:00 it says I shall make $HOME/.composer/vendor/bin in my $PATH so I did
vim ~/.bashrc
and added the line
export PATH="$HOME/.composer/vendor/bin (Video 4.27)
his .bashrc is empty but mine was not but I guess that doesnt matter so I just added that line to my .bashrc

then I did:
composer global require "laravel/installer"

and it says
changed current directory to /home/myuser/.config/composer
using v 1.4 for laravel installer
./composer.json has been updated
loading composer repositories with package info
updating dependencies
killed

then in the tutorial he can now type laravel and get it to work but when i type laravel it says command not found?

any idea how to fix this?


Top
 Profile  
 
PostPosted: Mon Oct 09, 2017 8:34 am 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6384
Location: Montreal, Canada
On the road today so my ability to respond is limited. Here’s a question, though: what’s the use case for having the Laravel installer on your DO box? You’re not going to be developing on that box, so generating a fresh Laravel install feels to me to be of little value.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
PostPosted: Mon Oct 09, 2017 11:42 am 
Offline
Forum Contributor

Joined: Wed Sep 25, 2013 4:09 am
Posts: 170
Celauran wrote:
what’s the use case for having the Laravel installer on your DO box?

Just for sports... didn't I tell you love torturing myself..?? :)
.
..
Rofl, I thought I had to install laravel on the droplet too to get it to work. I thought I had to set up an identical laravel project on the droplet and then if i change for example welcome.blade.php I only upload that file... through git..?.. but since you asked I guess i misunderstood it all haha

Atleast I think I solved the killed problem ... I bought a too small droplet (5$ one) so it seems i ran out of memory so I had to do a swapfile to get it to install (even though they dont recommend swapfiles on ssd).

Is it bad for me to have laravel installed on the droplet, should I remove it from the droplet?
And do i need to install git on the droplet?

Quote:
On the road today so my ability to respond is limited

If you go to Sweden give me a call and I'll buy you a nice shrimp sandwich :)

EDIT: Why are all deploy guides for LEMP stack? Is it better than LAMP? I set up LAMP at home and now on the droplet.. should I change droplet to LEMP instead and if so can I deploy from my LAMP stack to a droplet LEMP stack or will that cause much trouble?


Top
 Profile  
 
PostPosted: Mon Oct 09, 2017 6:55 pm 
Offline
Moderator
User avatar

Joined: Tue Nov 09, 2010 3:39 pm
Posts: 6384
Location: Montreal, Canada
hybris wrote:
I bought a too small droplet (5$ one) so it seems i ran out of memory so I had to do a swapfile to get it to install (even though they dont recommend swapfiles on ssd).

I have multiple Laravel-based projects on a single $5 droplet. That shouldn't be a problem.

hybris wrote:
Is it bad for me to have laravel installed on the droplet, should I remove it from the droplet?

You'll need to have Laravel installed if you're building a Laravel project, you just don't need the installer installed.

hybris wrote:
And do i need to install git on the droplet?

Yes. Develop locally, push code with Git, pull into droplet.

hybris wrote:
EDIT: Why are all deploy guides for LEMP stack? Is it better than LAMP? I set up LAMP at home and now on the droplet.. should I change droplet to LEMP instead and if so can I deploy from my LAMP stack to a droplet LEMP stack or will that cause much trouble?

LAMP is fine.

_________________
Supported PHP versions No longer supported versions


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group