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

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)

Related

Having trouble running a backup copy of php on Xampp

I uploaded a php script to a subdomain that I own, for testing and customizing purposes before it goes live (I had planned on moving everything over to the root domain when done).
Someone then suggested that I work on in Xampp instead as it is all locally installed and therefore much faster, etc.
Thing is, I had already customized the script a lot (mostly CSS but also uploaded graphics via the admin panel, etc) while it was up live on the web host, so I would like to run a copy of the most up-to-date version of it in Xampp and continue customizing it from there.
I downloaded a copy of all my files by FTP into htdocs > Test folder. I also downloaded a copy of the database via phpmyadmin and imported it via phpmyadmin into my localhost.
The big problem I have is when I try to access the scritp via localhost, the url immediately reverts back to the live url. How do I set it to link to the local host copy instead?
Thanks.
Based on AbraCadaver's suggestion, I found the answer lied in changing the URL parameters in config.php
Thanks

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 MAMP to test online instead of localhost

I'm new to PHP and everything, so I'm trying to learn some things.
I'm currently developing my first PHP site in Dreamweaver using MAMP and Localhost.
I have already bought my domain name, and built a smaller html site just to act as a "holding site" before the PHP one gets put up. I'm wandering if instead of using localhost, that I could use a subdomain of that domain. So instead of going to localhost/mysite I could go to test.mysite.com.
Tell me if I'm wrong, but I shouldn't have to upload any files to GoDaddy because I'm using MAMP as the server. Right?
Keep in mind, this isn't permanent. I'm not planning on hosting my site on my computer using MAMP. I'm just wandering if it's possible and how to do it if it is.
Any suggestions, comments, or answers are greatly appreciated.
Thanks.
- Ryan
MAMP is not the server. MAMP adds server capabilities to your computer, but you can't use MAMP to mimmic any server.
What I recommend you is working on your computer, with MAMP and using localhost as the "test address". After the page is finished in your localhost, and everything work fine, you can upload your page to your server (with FTP). This way you avoid having to upload your files via FTP every time you make a change in your code.
And welcome to the PHP World. Countless mugs of coffee and restless night await you.
You can create some folder on web server(on your paying hosting) and upload all files from your test localhost folder. Everyting would work perfectly if you type: https://yourwebsite.domain/yourfolder. If you want to set it to view like http://yourfolder.yourwebsite.domain you must from Control Panel set up an some subdomain. Subdomain is make something like this: you enter name of subdomain and folder which is mapped to that subdomain. For example, you set up subdoman http://test.web.com and map that to http://web.com/testfolder.
I hoppe that I help you.

How to set virtual directory for php

I am learning php. I am learning through by looking at structure of existing web site. I can configure it correctly.
I dont how to set the virtuall directory for web site. Like ASP.NET you have either host the site on IIS or you can use local ISS. Is there any such thing with PHP.
I am using eclipse for development.
If you're only running a single site on your Apache server, then you simply have to set the DocumentRoot and Directory entries to match your document root.

Development environment for a LAMP-based website - Redirects to Server Default Page

In our current environment, if any changes need to be made to the code, these changes are directly coded and updated to the Live server. GWe would like to set-up a development server where we can test our changes before uploading to the live site.
I have attempted to build a development site locally by installing Apache, PHP & MySQL and copying all the htdocs to the Apache folder. However, when I try to access localhost/ it redirects me to the server default page. Any ideas on why this may be happening?
Have you setup Apache VirtualHost and configured it for your sites Document Root?
I would look into your production site and see what's configured.
Also note that when you're setting up a dev/prod environment you will need not just PHP/Apache/etc.. install but also any packages/mods/libs that they are using installed as well.
For Example: if you're using Mod-Re-Write with Apache you need to install and enable it

Categories