How to update functionalities of a live Laravel web application? - php

I have a Laravel application. It's live and have daily users. I need to update some features. Not only front end work. Have to change back end too. With database. The problem is our old developer created this site. Now he's not here, and also no any documentation or blue print available. I downloaded the project. I can change front end even it's live. Changes affected. Is there any way to change some back end and database when it's live ? Is that a risk ?
Please guys don't give minus points to this question.

You should be creating a development environment on your local machine, with it's own database etc. Change that, test it, and once you are happy, upload your file and schema changes.
For setting up a quick dev environment that closely matches your production server, download VirtualBox and Vagrant. Then visit http://puphpet.com, which will allow you to generate a server config.
Unzip the config, cd into the folder, and type vagrant up. Your server is now on 192.168.56.101.
Lastly, edit your OS hosts file to point your.dev.site.com to that ip. (the default domain name in puphpet is awesome.dev
You can get inside the VM by typing vagrant ssh if you need to.
Don't edit a production site, especially with live users!

Related

Trying to work on a client's Drupal site from my local machine

I have a client who wants me to update their Drupal site. I've never done this before, and I want to work on it from my local machine just in case something goes wrong. I have no idea where to even start!
First off, how do I access my client's site files so I can get them onto my computer? I've tried entering the information the client gave me into Cyberduck, but it won't give me access. Is there another way to get access?
Also, how do I host it locally? I have XAMPP, but I'm not sure how to use it.
That being said, I have found a few forums that should help me set up the local server. I just don't know how to get the files from the live server to my computer.
I know this is a super noob problem, but I could use the help. Thank you!
Well, for the basic question, you have to get the correct credentials from your client. There's no alternative, really :D
While you're at it, you'll want a copy of the site's database too.
For the question "how do I host it locally?" Here's how I would go about it.
Get the site into version control.
Given that you were given (S)FTP credentials, I'm guessing the site is not version-controlled. If that's correct, then that is probably the very first thing you want to do. This will allow you to keep track of the changes you've made on your local site that are different to the production version.
Create an empty directory on your computer.
Navigate to the directory in a terminal and run git init.
Add a .gitignore file to that folder (you can create your own, or use one customized for Drupal).
Download the site's files into the directory created in step 1.
Add the files from the in the directory to the git repository by running this command in a terminal: git commit -am "First commit of Drupal files to repository."
There's a good help page about working with Drupal in git on drupal.org.
Create and populate your database.
Get a database dump from the live site.
Create a new database and database user on your machine.
Import the database dump into your new database.
Record the database credentials in settings.php or settings.local.php and store them somewhere safe, preferably in a password manager.
Change the database credentials in settings.php or settings.local.php to match the credentials of the database you've just created.
(For safety and to avoid confusion, I always create local databases with a different name, user, and password than the live site has. This means if your local credentials are compromised, the live site isn't, and it means you can't connect to and change the live site's database by accident.)
Set up the webserver in XAMPP
Create a new site in XAMPP called e.g. example.local that points to the directory that contains the file index.php
Add the following line the file called /etc/hosts on your computer:
127.0.0.1 example.local
Test that this works in a browser by visiting e.g. http://example.local or http://example.local/robots.txt.
Move your local changes to the Production site
How you will be able to do this depends to some extent on your client's web-hosting infrastructure, and what version of Drupal your client uses. but in any case, you will have three separate concerns for changes you make:
Code changes
You will need to deploy changes you make to the code back to the server. Ideally you would probably do this via Git either by cloning directly into the live site or (far better!) as part of an automated build process. By the sound of it, you may just have to FTP the changes back up.
Be careful not to re-upload your modified settings.php or settings.local.php file!
Content changes
You probably have to test some/all of your content changes locally and then recreate them on the live site. Because your client may have made changes to the live site while you were working, you can't risk importing your local database into the live site.
Configuration changes
Changes to configuration should be managed in code (i.e. as part of 1. Code changes above) if that's possible. In Drupal 7, the Features module is usually the best way to accomplish this (here's an answer I wrote describing the Features workflow). Drupal 8 has the Configuration Manager. Be aware that these two tools can both be tricky to use well.
Your client needs to gave you access to the files so you can put them into htdocs on XAMPP, then you need the database (also provide by the client), start XAMPP, create a new database on localhost/phpMyAdmin and import the db of the site. On the proyect code go to sites/default/settings and change the db settings to your local settings. Then you can go to localhost/{your-proyect} and it should work.

Download Wamp onto a Shared Drive so everyone in school can access HTML and PHP pages

I am new to all things servers but I am competent enough to understand. Please point me in the right direction.
At school, we have a 'shared drive'. I downloaded, set-up, and ran a WAMP server. I created HTML pages with PHP code to send/retrieve data from the database. I didn't want it on the internet, only locally accessible.
I then decided to move this to the 'shared drive' so that everyone on the school network could access it by simply going to their favorite browser on a school computer and typing 'localhost:8080/' like I do on mine.
I copied and pasted everything, the entire 'Wamp64' folder with all my changes included, onto a folder in the shared drive. I modified the 'http-vhost.conf' file
DocumentRoot "I:/Laboratory/Internal/Server/wamp64/www/project1/"
Directory "I:/Laboratory/Internal/Server/wamp64/www/project1/"
as follows with the new path. Still, nothing when I got onto a PC and typed 'localhost:8080/'
This is all I've done. Every single step.
I understand how naive my understanding may seem. Please, point me in the right direction.
I think you are missing the point of what a web server is i.e. Apache.
It is a software server and as such can sit on any PC in your network, which could be the server or the little old box in the corner that no one ever uses because it is a bit out of date.
It sits on that PC and listens for things trying to connect to it, usually on port 80, but could be any port like your 8080.
So, placing it on the hardware server itself is not necessary.
And, just copying an install to a shared drive and expecting an PC on the network to be able to then us it is just not possible.
Also, its always best to install WAMPServer i.e. Apache, where you want it to be located. Copying an installed version from one drive to another never works, as the install modifies path data all over the place and of course the Apache and MySQL services are installed (windows service installed) from the original drive and folder. So your moving the wamp folder to another machine will definitely not work.
I suggest you install a WAMPServer on a PC that is left on all the time, using port 80, I am guessing that the school wont let you install it on their server for obvious reasons.
Then copy your site code to this new installation.
Then backup you database, and restore it to the new machines WAMPServer (MySQL)
Then amend the Apache config to allow access from the schools local network but not the internet, by amending the httpd.conf or if you are using WAMPServer 3 by amending the httpd-vhost.conf file, there are many answer available on that subject.
Next, if the school has a DNS Server, I would ask for a domain name to be added to that, pointing to the ip address of the PC you installed WAMPServer on. The domain can be anything but something like davidproject.school could be used.
Then you create a Virtual Host in WAMPServer using the ServerName = davidproject.school and ServerAlias = www.davidproject.school
Then people will access it from any browser in the school with the url davidproject.school

Using Xampp and 'git' for team web development in wordpress. Database issue

me and a coworker are trying to move a website from a test server to local web development. Our boss wants us to use Amazon web services CodeCommit in conjunction with Xampp to do this. We have made progress but cannot overcome a database issue. Here is what we have done.
Set up AWS accounts and recieved necessary credentials from boss for the sites repo
Pulled repo and ensured that we could both commit and pull normally
Downloaded xampp, made sure apache and php were functioning normally
Now, one of us (me) has used the duplicator wordpress plugin to backup the site and load it into a local version.
I can now develop locally fine and push changes, all images and pages from the site are showing up locally
ISSUE:
How can my coworker also develop locally, the issue appears to be that he has not made a database in xampp phpmyadmin control panel for the site, but if he did wouldnt it be a different one than I am using, and thus wouldnt sync with git properly? Where xampp stores the database info isnt in the git folder, so I may be doing it wrong as well!
We cannot figure out the correct course of action, please if you can point us in the right direction. Much appreciated!!

How to work on server without the site being actually online?

I have a wordpress site, I need to work on it on my server but i don't want the site to be online in any way shape or form. i want to complete the site completely and only then launch it, how can i do this?
thanks,
edit: im currently using xampp, but facing issues, so i want to shift to my server.
Take the wordpress files out of the documentroot (where your files are displayed from)and put them in some temporary document and set up virtualhosts on your server so that you can have more than one documentroot so you can test it in your browser but it wont be live.
You could use something like MAMP or WAMP, MAMP works on both windows and macs, these are local server environments which you install on your own computer. You can then develop them on your computer and once finished, upload the files to the production server. This is quite common practice.
If however, you want to use your server you could block all connections which do not come from your own IP Address. For example in your .htaccess file you could put:
order deny, allow
deny from all
allow from 111.222.333.444
If it was me working on development of a WordPress site I would do it one of 2 ways:
1) Either create a new VirtualHost and password protect it
2) Use a local instance of Apache to serve the WordPress installation locally.
Option 2 is probably the handiest. Pushing the new site live is then a simple case as uploading the theme directory to the live environment and enabling it, provided you keep all relevant files within the theme directory.
Apache can be installed using either LAMP (for Linux) or WAMP (for Windows)

Creating a test environment for an existing website

So I have an employer who currently operated their website with no testing server whatsoever. All updates to the site are "tested" live in front of the whole world. I don't need to hear about why that's dangerous... I know it is. In fact if this continues for much longer I'm going to develop an ulcer.
I am trying to place a working copy of the svn of the site on my MB pro for testing purposes. The site is all PHP and MySQL so my plan is to install MAMP and run the test copy on localhost.
My employer is worried that by hosting a copy of the site on my laptop I will interfere with the operation of the live site. Is this possible? Is there any way that my hosting a copy of the site on localhost will interfere with the operations of the live website (hosted on a remote server)? Are there dangers in setting up a localhost copy?
Apologies if this is out of scope, hopefully this will be useful to others.
It depends on the site. When I make a site and the database is hosted on localhost / the same server as the web-server, no.
But I have noticed that if you use for example WordPress, you are testing on your local copy one minute and are on the live site the next as the url seems to be hard-coded in the generated pages (in the case of WordPress a setting in the database).
So:
Always make sure the database connection is to your local database (ideally that is just in one place and you don't have to change anything if the live site uses localhost as well)
Look out for links / settings / rewrites that direct you to the live site from your local site.

Categories