I am a beginner and I learned only HTML and CSS.
When I tried to host my website I opened this look at method two it is about localhost I searched a lot about it but I didn't understand anything like:
It is a server side like PHP and phpMyAdmin
localhost is a hostname that means this computer and may be used to access the computer's own network services via its loopback network interface
I can't understand anything is it like WikiHow said and I can host my HTML and CSS website for free? Or is it like Google said?
First of all when learning CSS and HTML, you can simply just open the file location of the HTML in your web browser. There is truly no known reasons for someone doing CSS, HTML, and Javascript programming that is self-contained (i.e. no databases or crap like that)to NEED or even BENEFIT from having a web server set up.
That said, I'm a beginner, too, in a sense (I've just returned to web programming and found it so much easier and more fun than it was 7 years ago!) and I have been using a web server and localhost every time I program lately. This is because I'm programming in Ruby and I'm using a library for Ruby called Sinatra that makes web programming with Ruby SUPER easy! Anyways, when you use Sinatra, you must have a web server running, and you must use localhost rather than just opening a file location on your computer. Why? Because Sinatra replies to the GET and POST requests that a web server makes in response to a user's actions.
So, with Ruby installed, and Sinatra installed (I'm on Windows, not that it matters much) I simply use the Start Command Prompt with Ruby shortcut that was installed with Ruby and then at that command prompt I go to the directory with my program and type, e.g., ruby test.rb, and then I open Chrome and type localhost:3456. That's the default port for Sinatra. It can be changed easily. If you want examples of simple Ruby programs using Sinatra that you can use to see this web server behavior without even having to install a regular web server (you'll instead be using the lightweight one that comes WITH Sinatra's installation [on all platforms, I think]), you can find such examples if you Google Learn Ruby the Hard Way Exercise 50/51/52. That site is great. I've only used those 3 so that's why I chose them, there may be more.
Also, and again I've only been doing this for one month, on my own in a non-professional non-academic setting, I installed Apache, Googled that a bit, and it was also easy to install and serve up a HTML file to myself at least, and I think I got my Ruby program running easily, you just have to make sure you understand what the directory paths are supposed to be.
So, even though you don't need to unless you're doing something beyond HTML and CSS and basic Javascript, go ahead and either install Ruby and then follow Exercise 50 in Ruby the Hard Way to see how localhost works (this is easier than doing Apache IMO but that was my experience, plus you'll get exposed to Ruby with very easy copy and pasting from Ruby the Hard Way), or install Apache, it's super easy, get it running, and just find out what directory it's going to look for it's index.html on your system and make sure you put your index.html in that correct spot, load up your browser, and type localhost in the address bar (on chrome on windows 7 that's all you need, I bet OSX and Linux are same).
In fact, type localhost into Chrome (at least) and you'll see an ERR_CN_REFUSED or something like that. Note that Chrome would normally search the Internet. So, that loopback localhost functionality is in the OS... Cool stuff, good luck.
Localhost is just your local computer. It has an ip4 address 127.0.0.1 ipv6 ::1.
So if you connect to localhost you always connect to your own computer (usually not visible to the outside world unless you leave your computer on and stay connected to the internet and have your router/firewall configured that it forwards traffic to your PC (only do that when you know what your are doing).
You can try some IDE for coding, such as RubyMine or PHPStorm, and they're creating localhost for you, when you're running your code in web browser. I think that can be helpful because some of Chrome Extensions for web development doesn't work with local pages, for example, page rulers or so on.
Related
Bear with me here ... I can't show exact examples or provide a link to the web server for security reasons. If anything more is needed I will gladly provide it.
What I HAVE:
I have a server that hosts an internal networked intranet for my company.
Coded with PHP, MySQL, HTML, etc
Ubuntu 14.04LTS
Normal Apache Web Server Configuration
Login access
Couple hundred PHP files for different pages/features needed for the company
Maintenance
FTP into the directories (shown below)
Manually edit PHP files with Notepad++
Test in Beta Directory -> move to -> Secure (overwriting current file there)
I know this procedure for maintaining is horrible so I'm trying to come up with a better solution
What I NEED:
Features
IDE Connectivity (Aptana,Eclipse,etc)
Commit/Push/Pull Capable with Server from IDE
Version Control
Keep backups for Rollbacks
Test & Main Server
Like how I have a Beta and Secure Directory for testing and releasing to everyone
What needs to be done on the Ubuntu Server in order to accept push/pull requests, store multiple versions, and store commit messages?
Do I need to install anything on the Ubuntu server in order to communicate with the remote computer I'm trying to access from?
I got kind of a problem, I can't figure out.
I got a local development server set up in my office and an other online dedicated server, to test my web-apps on.
That's all fine as long as I work in my office and use the LAN/WLAN.
But sometimes I'd like to do some quick code changes at home. There's where my problem starts. I tried several possibilities. FTP, VPN, WebDAV, ...
It does work, but the speed is incredibly slow. I need 5 min to chance one or two lines of code.
How's your development environment set up and what option should I use to make the "connection" become faster?
Thank's in advance
Typically extreme slow downs like this are due to the IDE you are using. It wants to read and parse everything in the "project" for you, and it is doing that over a slow connection (ftp, sftp, ssh, etc.).
If you are using dreamweaver, check out this KB Article and this Google Search.
Ultimately, you are going to have some performance hit, but you should be able to configure your IDE to minimize that. You can also always drop back to using something like FileZilla or WinSCP plus your favorite editor ... perhaps Sublime Text with Remote Access.
Trying to do dev over remote file system access is painfully slow. A few options:
Use Remote Desktop (RDP) to connect into your machine and do local dev.
You can always go the skydrive / google drive / dropbox route that syncs your dev files to your home computer so you can have local copies on both.
Don't discount source control (though with that you can only make updates to what was checked in, so if you left the office without a checkin, you won't be able to do anything about it from home).
We are working on a project which is getting bigger and bigger.
Till now our work looked like this:
I have a web server, I'm coding with VIM directly over SSH
Another programmer send me new files I add them and integrate them (he have a copy of project and local server)
Designer sends me design I also integrate it.
It is pretty much waste of time, because every time they made change I have to integrate it.
Now we have a hosting which doesn't support SSH (I cannot use vim now). How should we work on a project like this? How should I set up my VIM to work on remote project (I don't want to download and upload every time I want to change file)?
You didn't mention your OS. That would be certainly hepful if you want a precise answer.
The first thing would be to find a better host. You can rent very decent dedicated servers for as low as 40 or 50 € or less. If your project is big and serious, 50 €/month or 100 €, or 200 € is perfectly acceptable and you can install/enable whatever you need. Depending on the size of your project, a VPS could be enough. Whatever the price, a web host without SSH access is worse than shit.
But you may not have any power on that area.
Since your server doesn't support SSH, a proper VCS is not an option. The only practical solutions I see are rather "old-school" but they work:
Solution A:
Download the whole site on your local machine with an FTP client.
Edit locally.
Test your changes with a local web server.
Upload the changed files when your tests are OK.
Solution B:
Connect to your server with an FTP client.
Use its "Edit Locally" feature to open the files in Vim.
Write your changes, the file is automatically updated on the server.
Solution C:
Use Vim's bundled netrw plugin: :e ftp://host/path/to/file. See :h netrw.
Note that the process will always be download -> edit -> save -> upload, whether you notice it or not. Depending on the solution you choose, the process can be horribly repetitive and inneficient or almost completely invisible.
But, seriously, get another server and use a VCS and a local server.
I recommend using version management software like git with SSH hooks that automatically upload changes to your server.
You can use a version manager, like git and make a git pull in the web server every time you have a stable version.
You collaborator can push the new content and you dont need manage the file youtself.
I want catch web screenshots with PHP. Because I also need some process with PHP, I do not want use any on-line screenshot service. I am willing to renting a free hosting or a virtual server hosting which cost less than 20 dollars per year.
As I know, virtual server can not upload exe files (like url2bmp.exe, webshot.exe, webscreencapture.exe, etc). And they all use linux system (it can not use new COM("InternetExplorer.Application")).
So, is there any possible cacth a web screenshot in virtual server with PHP? Thanks.
as a possible alternative, you can check out this project: http://code.google.com/p/wkhtmltopdf/
You can do this with Linux, it is seriously tricky though. You need FireFox, imagmagik and VNC installed.
Basically you get Firefox to open a new window in a VNC display, grab the screenshot of that display with imagmagik and then save it as a thumbnail. The hard part about this is getting the VNC portion to work, especially with a headless setup. But it is completely do-able.
However, it will probably be a ton easier just getting a Windows VPS.
Doing a search, found this which might work:
Taking website screenshot, server-side, on a Linux rented server, free
Ah and here is the post about what I described above:
Command line program to create website screenshots (on Linux)
You can take automated screenshots of websites using an open-source tool like pageres. It can also simulate various resolutions, testing responsive layouts.
I'm not sure whether it's relevant that your website is coded in PHP, or that you're mentioning .exe files. Are you new to web development?
Is there a way to distribute a PHP program like a desktop app, so that even if the user of the app doesn't have a local server environment setup on there PCs, the app will still work?
I was thinking, if there was some type of portable server environment program which includes PHP/Apache, then we could create a batch file which when clicked would start up apache in the portable program and launch the PHP app in the user's default browser. That way PHP apps could be distributed like desktop apps.
But the question is, is there such a portable server environment program that can be used for this?
Yes, if you google for XAMPP portable, you can find several versions of fully portable, fully functioning xampp servers for the go. You would have to make sure it contains all the security settings and extensions you need.
The file your user launches should be an .html file to be sure it opens in your browser. As you need to point the user to his own localhost to run your app (otherwise PHP won't be executed and he'd see a plain html file), you'd have to create a redirect, possibly using javascript or a simple "click here to start" link.
The XAMPP only provides half of the solution:
In addition to the XAMPP you can use Phar files that give you the ability to package your PHP applications as a unit for installation and/or deployment.
You can configure a separate php file which will handle any database creations and initial configuration which can be set to run on the first time.
For a helpful start guide consider the following link:
http://phpmaster.com/packaging-your-apps-with-phar/
Finally if you want to make it seamless (easier) to the user, consider writing a Batch script which will handle running some of the task required (Such as starting apache and mysql and running run.php). Take note of using relative rather than absolute directories to make script development easier.