Setting Up PHP Push/Pull With Ubuntu Server - php

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?

Related

How do I use PHP locally with SQL Server

I am a desktop application / database programmer customizing an ERP application in a Windows environment. I have also done documentation with HTML and javascript on our intranet. I have not done any web programming.
I need to convert an Access 2003 application. Instead of using .Net I think it would be wiser to use HTML to allow access from a tablet. This app will display drawings based on certain lookup values (i.e. part number) stored in a SQL server database. After some research it seems PHP is the best choice. But the things I have found explain on a server supplying the pages and not running locally. I see Apache and IIS mentioned but are these needed if the pages will be loaded on a single machine (or multiple machines but all pages will be present in a single directory structure).
When I search for running pages locally I get pages accessing a databse locally. But the database will be on a server.
Can someone steer me in the right direction?
if you want to use PHP then if you put your application online you can use MySql for the database. You will not need to make any changes because any web server uses mysql with php.
If you want to use PHP with SQL server then you will need on your server to install the Microsoft Drivers for PHP for SQL Server . in the following link you will have the documentation:
[www.microsoft.com/en-us/download/details.aspx?id=20098][1]
PHP has a built-in webserver since 5.4.0: http://php.net/manual/en/features.commandline.webserver.php
If you have PHP (>= 5.4) on your machine, you already have a webserver.
If i understand your question correctly you want to have the database on the tablet. That is possible, simply by installing the web and database server locally. Restrictions might apply depending on your tablet (OS) manufacturer though.
You could also have a "regular" web server / database server setup, and use the localstorage of your tablet's browser to have the result pages available in offline mode, and sync your data when possible, using php and maybe ajax scripts.
Since you don't want the presented data to be web-accessible (or at least not public), but you do want the presentation to be through HTML-pages, I can come up with two ideas:
Use a scripting language to access MS SQL Server, extract the data, and present it as HTML. Since you like PHP, maybe Perl with a suitable DB-access library might be a good idea.
PHP as you suggest, some kind of web-server, and a rigorous lock-down configuration so that the webserver is only accessible locally. Depending on the sensitivity of your data, this might be the worse option.
Enable Internet Information Server on your Windows system (using "Turn Windows Features on or off in the control panel) and install PHP: http://php.iis.net/
Alternatively Apache xampp installs the Apache webserver, MySQL (when wanted) and PHP on your system: https://www.apachefriends.org/index.html. To connect to Sql Server you have to remove the semicolon ; before the extension=php_mssql.dll line in the php.ini.

How to run an php application without installing xampp on client system?

In my application i have to deploy my application on client system.
So is there any way to run my php application without installing xampp...
Because the client should access it as a readymade app without installing anything...
This is the description of my project...
We have to develop an application where the client will have our application he will connect to remote server
Then he will download the data from remote server...
Then he uses that downloaded data using that app
Here my requirement is the user may not have the knowledge of installing the xampp...
So is there any way to run the application in user system just by copying some files
U may suggest me a one click solution (like using installer which will include installation of xampp and copying my data into user system)
I really dont want to use any external software to render no database PHP pages so I did some digging and found that if you run php -S localhost:port in your working directory you basically start a server there.
S is a capital S and not s
I'm a big fan of server2go. I've used it to deploy PHP applications on CD/DVD. It comes with MySQL and is relatively easy to configure. I've even replaced their splash screen with my own so no one knows I'm using it. It's donationware, but I was impressed enough to donate:
server2go-web
With this application, you don't have to install all that other stuff. It's self-contained in this executable and directory.
EDIT: To clarify, server2go does not install anything on the client machine. It runs as an exe only when you specifically want it to. When you click on the .exe file, it launches your PHP application in a browser window, then you can right-click on the server2go icon in the system tray and close it when you're done.
EDIT2: One gotcha: if you want to save data to the MySQL db on the client machine, you'll need to copy serve2go to a directory on the client machine or run it on a writable USB stick. If you run this application off CD/DVD, it will be able to read data from the database, but not write.
The better way is to use PHP Desktop Application. It will allow you to run your PHP Script like a Desktop application and you don't need to install Xampp or any other web server to run.
PHP Desktop Application
After downloading the .Zip file unzips it to any folder that you like. After unzipping, Go to the folder, and there you can see a folder "www". Delete all the files contained in it and move all your php script to it.
Once you moved all your files into it. Run the .Exe file named "PHP desktop-chrome"
It will open your PHP Script really like a Desktop Application.
This script doesn't require any kind of server software like Xampp, Wamp, Etc installed in your PC.
You can either host the php application or install the application into one system as server and call in client system using the ip of the server system like the following
http://**ip address/php file name
If you don't want your client to install anything then you should create Client Server architecture, there is no another way.
PHP Application are not meant to be deployed on multiple clients. It's meant to be deployed on a webserver (your own server with sth. like IIS or XAMPP) so the clients can access it via their browser and doesn't have to install anything more.
If you want to deploy applications on the client pc's i recommened an other programming language like Java or C/C++.
I simply used xampp zip version so i copied my application into htdocs and the whole xampp is given to the customer so he simply running the application eazily without installation.
Make sure you have installed php from https://www.php.net/downloads.php. Once installed add it to path. Lastly type php -S localhost:8000
PHP needs to be installed on the machine it is running at in order to make sure it works. Since the app may grow and may require extension installing, PHP upgrading over time, hosting this on a client machine is not a very easy task in terms of management. You may want to host your project on a server and write a small bash script sending requests to the API.
If, for some reason you cannot host this on a server where your clients would send requests via the bash scripts, then you may want to install only PHP. If it does not need to listen to HTTP requests, then you do not need a server, you can just implement the PHP application and create a bash script so the user will be able to run it from the UI of their operating system.
No, you need some kind of server - Wamp, Xampp, etc.
You can host it online, and then he can just browse it from his PC.

Questions about Remote Test Servers

First, I am a complete novice when it comes to programming, so pardon my ignorant questions.
I hired two programmers to work on my project. They say they need a remote test server for testing things, before making it live, so that the changes are not live until all are okay.
My questions:
What are Remote Test Servers?
Why are they necessary?
Can they be set up with normal reseller or shared hosting?
How can you prevent the world from seeing what's on it?
Do you need a domain name for this?
How do I go about setting up a remote test server?
Any other comprehensive document to read up on this?
Thanks.
About Test Servers
A test server, in the case of websites, is used for changing around a website ( a copy ) without it being displayed to the public. This is done because, when a developer changes a webpage, the page will often seize to function or contain bugs due to incomplete changes of the source code. By putting these pages on a remote test server, the developers can use copies of the website - that are placed on this server - to make changes without affecting the pages that are being sent to the clients. You can actually configure this kind of server locally or remotely, depending on how you weigh the pros and cons.
Remote Test Server
You may set up a remote test server on sites like GoDaddy or DynDns. These services usually package a domain name with their server space. The benefit of this is that most of the 'set up' is already done for you. Also, as Silvertiger has pointed out, the service fees of this are usually quite low. This might be recommended because the massive amount of software your programmers may need is readily available on these servers. The only downside is that the only way to prevent the public from viewing this ( that I know of ) is to make it password protected. However, you may need public access anyway if your developers plan on working outside of your work environment.
Local Test Server
Alternatively, you may set up one of your own computer as a test server. The benefit of this is that the only fees you will have to pay are the costs of the computer ( it can be a low-end computer ). Since this computer would be connected to the network you wouldn't need a domain name, instead you will use an IP address assigned to the machine. It won't be hosted on the internet, so it's much easier to prevent other people from seeing it. The only downside is that your programmers must be within your network to work and setting this server up may be rather involved ( depending on the needs of your programmers ).
You will mainly have to download and configure all the appropriate software ( ie Apache, mySQL, PHP ) to get it working. This is typically done on a server OS ( ie Ubuntu Server ), but can be done on most operating systems. This process can also be made less painful by installing server software packages ( ie WAMP, LAMP, MAMP ), which include the basic software components your developers will need. I would recommend using Ubuntu. You may use Ubuntu Desktop if you'd like to keep a graphical interface during set up. Or, you may use Ubuntu Server - which saves a lot of memory by using a terminal-based user interface ( can make it more difficult to use ).
You may additionally consider adding a service called FTP to a local server. This is a service that allows you to remotely read and write to files on the server, and may be desired by your web developers for some of their editing programs ( Dreamweaver, for instance, can access files with FTP ).
As a side note, most developers should be familiar with setting up basic server software. In fact, it is usually part of the curriculum in webdesign. So, you may allow them to configure this software if you provide the computer for them. If you otherwise would like to configure it yourself, you may find some of the links following to be helpful.
Informational Links
General Web Servers
Wikipedia - general information on web servers
HowStuffWorks - information on how web servers work
Remote Servers
Godaddy - A common web hosting company from which you may use their service.
DynDns - ( as the aforementioned )
Local Servers
Ubuntu Server : A popular OS for servers
Apache : A popular HTTP server ( aka Web Server )
PHP : A commonly used language by web developers
LAMP : A package of basic server software for Linux ( Linux Apache mySQL PHP )
WAMP : A package of basic server software for Windows ( Windows Apache mySQL PHP )
MAMP : A package of basic server software for Mac ( Mac .. .. PHP )
Setting up LAMP : [Steps 1-5] A wonderful article on setting up a web server on Ubuntu.
A remote test server is a working php server that you can execute code on. It can be any server you have access to meaning that any reseller of hosting can provide you with a server but effectually it is just a web server you have access to. I presume you have a software that is asking for a remote test server like Dreamweaver or some other IDE.
I use my godaddy $8 a month hosting account account for testing..

Moving PHP site from one server to another

I have no idea about PHP.
I have PHP site hosted on Server A. Now I want to transfer the hosting to another company having Windows hosting on Server B.
Can I just transfer all the contents of WWWROOT folder of Server A to Server B? Will the site work that way? Or I do have to get the source, compile and publish it?
Thanks!
the process is this:
copy the content from server A to B (also db dump)
make sure your site is working on server B correct
set a redirect on server A to server B (usually in .htaccess file)
edit DNS entries to point to server B
wait that DNS changes have been picked up (note: as suggested by Emil you can reduce this time by lowering TTL setting on the DNS entries)
remove content from server A (end hosting)
PHP is not (usually) compiled, you should be able to simply copy the files and directories over and they should at least run. You may have to set up a database and connections to it, change some configuration in the scripts and you may or may not run into incompatibilities between different PHP versions and/or UNIX/Windows problems though, depending on how portable the scripts were written.
you don't need to compile anything. it's enough to copy project directory from one server to another. one thing can cause your project not working on ohter hosting, if there will not be installed some php-extensions that are required for you project.
and of course, if your project uses some databases, they must be created on new server
PHP scripts are source code and are compiled when needed. Simply moving the files is enough. Problems may occur if it is a package that has been isntalled on that server and may have some properties in various files about absolute paths to other files.
Also, issues will occur if the files are talking to a local SQL server or the such.
Many hosting companies offer a free (or sometimes payed) service to copy your website accross including any databases. Ask your hosting company for help.
No need to compile, however you have to make sure that the new server meets all the requirements of your application (e.g. server modules) and that paths are correctly configured. Also under some circumstances the PHP version can matter as well. Only one way to find out!

How to package PHP apps so they will work on any user computer?

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.

Categories