How to setup web application created in PHP (with Xampp)? - php

I have created an administrative system for libraries which basically lets you register books, users, borrowings and all kind of stuff that happens in a library. To code and test it, I used XAMPP, in my own PC, using Apache PHP and MySQL to structure and develop the application.
It works, and has a very complete and efficient set of functions and utilities, that is why I plan to implement it in my school's library, that for years has been using Microsoft Excel as a tool to organize all the books and students.
The thing is: I don't understand how to setup this app as a local web application. The idea is to install the folders and files in the library computer so it can control the system locally and through a browser (using localhost to access the PHP application).
I know it is possible to simply install XAMPP manually and copy the folder to htdocs and then use it normally, but I want to eliminate the manual part, and have some sort of setup that lets any person install the app without having to understand how Apache or MySQL works.
Does anybody know what could I do? I have though of creating a series of batch files (the library PC uses Windows) and move folders, create shortcuts, etc. using normal cmd commands. It would be a better alternative, but still the user would need to go through XAMPP (or some other service) setup prompts.
Thanks very much

you can create a bash file to automate this process.

Related

"Minified" version of xampp?

I'm looking for a way to share my php applications with a colleague without using a server. My colleague isn't really versed in xampp and localhost stuff, so ideally, he shouldn't have to install or configure anything.
I'm already using SQLite to make my application more portable, but I need to figure out how to handle the php side of things. Is there a way to create a "mini" xampp or localhost that the php files can run on? Ideally, my colleague should just need to start up one program, at which point the localhost address would point to my files. Is something like that possible with xampp?
You can use ngrok. ngrok build a url for your localhost project. which you can share to your colleague or anywhere across the globe.
You can start a web server using the php executable:
php -S localhost:8000
http://php.net/manual/en/features.commandline.webserver.php
You can use Devserver. It's portable. You just have to put the Devserver folder (with your files in Local Directory) on a USB key.
It should be said that there are very, very few times where what you're talking about should be necessary. If this is a truly "personal use" case, you could just put the scripts online and set up an htaccess password for your friend. If it's software you're trying to distribute, you could create cloud access for it.
Having said that, I do have a piece of software in the wild that matches this description. The reason it needs to run its own server and be accessible locally is because it (a) runs in retail stores, (b) serves and receives data with a corporate android app only on the local network in those stores and (c) must continue to run with local data if the internet connection goes down at any given store.
The only way to do this at the moment is ship a physical mini PC stick, preloaded with XAMPP, the database, and the whole set of PHP scripts and a nice index.php file at the local root, to each and every store. In my case, this required building an internal update mechanism to push software updates as necessary. But you could probably just have your friend download a zip file with updates and replace his www root folder with it.
If you can afford $100 for a cheap PC on a stick, this is probably your best answer. It's definitely the fastest. You could wade into trying to compile your PHP code, but there is no complete solution for that.
It is actual question for me to, so I made a little research and from what I have read the most perspective way is to use a vagrant. You still will need to do a lot of configurations, but mainly on your side. Your college can deploy fairly easy and pain fry.
I found this article describing a basic workflow very useful.
Update #2: If for some reason vagrant or any other type of virtualization is not an option for you consider looking to portable xampp launcher instead

How to configure TFS build-definition for continous-intergration for a PHP-Project on Windows Azure Webrole?

I am running a PHP Project (Drupal-Multisite-Enviroment) on Azure web-role with WindowsAzurePHP SDK. Everything works pretty fine. Now I want to implement continuous-integration with TFS and i am wondering, if anybody has ever done it before, because i can't find any documentation about it.
I understand that the deployment process on Azure is connected to the build process on TFS. But what is the output of that azure-specific build-process? The deployment package *.cspkg and ServiceConfiguration.cscfg?
If so, do i just have to make a custom Build, that moves PHP files to a temp folder, calls the Azure SDK package-batch and pushes the package to Azure cloud afterwards?
I would appreciate it if you would share your experiences with me.
I have not done it before but yes... If you set your solution to build in Team Build you should get the Azure specific output only.
The easiest to get your PHP into the right place is with a pre or post build PowerShell.
https://github.com/tfsbuildextensions/CustomActivities/blob/master/Source/Scripts/GatherItemsForDrop.ps1
You should be able to use this PowerShell after build to put together your PHP with your azure bits that just got built.
Then create a post test PowerShell to deploy to Azure.
You can set PowerShell scripts to run by editing the build definitions and on the process tab opening the "advanced" sections.
Note: Make sure that you are using DefaulTemplate.12.xaml.

problems exporting Solar php5 root directory from localhost to live server or even other computer

Ok,
This seems like something that would be obvious, but I haven't been able to figure this out.
I just started using Solar PHP5 Framework http://solarphp.com. It is a great php5 framework. But with any new framework the is a learning curve.
Issue: Solar uses many pre-written scripts to make directories and files for you. Making it easy to rapidly deploy a site. Being that it uses these scripts, it makes symbolic links to files and directories. (Example: Chapter 1 in the manual) This is great until you need to export your entire root directory to upload to your server or make another instance on another development computer. The problem for me is, when I do this, the files are editable, but do not reflect any changes when I refresh a page. Its like it doesn't update any code. The only way I can accomplish changes or updates, is to (essentially) run the site set-up each time, which involves running all the setup scripts, setting up the DB connections, etc. This is a total pain.
Question Is there any advice out there on doing this where I can just export the working root directory, to easily upload to server or other dev machine, without having to run those scripts over and over again. I know its something easy but I do not know exactly what to search for.
Is the a certain method for exporting directories/files that use symbolic links?
You might try using rsync instead of ftp to deploy the site. rsync will respect symlinks. Of course you will need have ssh access or mount the server over ftp/sftp with FUSE. If youre using SVN you could also ssh into the server and do an svn export or checkout.

PHP Command Line running, zend framework set up problem

Im trying to learn how to set up a Zend framework web application from scratch. Ive been using Magento and I understand how powerful Zend is, but im over my head it seems like.
So I bought a book, developing web applications with Zend 1.8 by Keith Pope, and I cant even follow past the first chapter. The thing that is confusing the hell out of me is the whole command line deal.
Here is a passage from the book --
Once we have downloaded the Zend Framework release package, we need to do some basic installation before we can start creating our application. First, create a new directory within your web server's document root, from which the application will be served. The examples in this chapter use the directory name of helloZend. Next, copy the library and bin directories from the release package into the newly created directory. The library directory contains all of the Zend Frameworks
source files, and the bin directory contains the command line interface for the
Zend Framework. The Zend Framework is now installed and ready for use!
Creating the project structure
We are now ready to start creating the directory structure for our project. In order to do this, we are going to use the command line interface provided by the Zend Framework. This interface uses the Zend_Tool component that provides a whole host of commands that makes it very easy to get up and running with the Zend Framework in just a few minutes.
In order to create the project structure, open up your command line and change into the hellozend directory, and then run the following command:
For Windows users:
bin\zf.bat create project
For Linux and Mac users:
bin/zf.sh create project
Ok so Ive done all that. But up above in first part he says upload it to your web server, did that already. But then "open up your command line", how exactly do I do this? The only command line I understand I can access is Terminal, do I do something with Terminal or??? (Im on a mac) - I tried navigating straight to bin/zf.sh on my webserver and it brought up a what do you want to open this link with, I chose terminal and nothing happened.
Can someone clarify this for me? I realize this may be a stupid question, but I have zero experience working with non live servers and what not....
I've been a ZF developer for several years, but was working on a pre- 1.5 version up until very recently (not by choice) I found it easiest to build a local version on my machine via ZendServer CE, then once all was running and stable, port it over to my dev server. Because I have full root permissions locally, I didn't run into any issues of naming/permissions as I walked through the initial tutorial of new features and initial setup.
Also, don't miss Akrabat's tutorial on getting started the ZF. It's very well written and in some cases easier to understand than the quickstart: http://akrabat.com/wp-content/uploads/Getting-Started-with-Zend-Framework.pdf
I don't say this to developers often, but you are in over your head if you don't yet understand how to open and use a command-line shell. Your question is not stupid -- everyone has to get started somewhere. But Stack Overflow is a place for specific questions about programming, like "I tried X and it didn't do what I expected, how should I code it instead?"
All I can suggest to you is to start studying. I believe that it's counter-productive to try learning new tools at the same time as trying to get a project done. So spend some time just learning the Terminal interface and how to run things in that environment.
Google for "Mac Terminal tutorial" and a bunch of useful articles and YouTube videos come up. Start there.
I also recommend "Mac OS X: The Missing Manual".
Re your comment: Okay, I think I'm seeing the source of your confusion. What the excerpt is not saying is that you need to open a shell on the host where you're developing your ZF app. What I do is to develop the project on my local host (my Macbook) so I can have quick access for moving files around and so on. This means I run an instance of Apache running on my Mac.
Then at intervals, when the app is running and done with respect to a given milestone of functionality, I upload the whole set of files I developed to my production server.
Tell me if I'm getting warmer. I really can't tell what you know and what you don't know because of the way you've asked your question.
anyone who needs the basic understanding of connecting to a webserver via terminal or command line via ssh should read the following:
http://www.elated.com/articles/ssh-and-basic-commands/
Although, the information there didn't work with my particular webhost. I had to format the connect command like this:
ssh user#host -p 1234
Where 1234 is the servers port number, which you will need to get from your webhost if you dont know it.
To run that script, navigate to directory where you've uploaded it (you open terminal, connect to your server via ssh if you're doing this remotely).
After that execute it like this:
./zf create project your_project_name
It should create new dir named "your_project_name" and in it many other sub-directories for your application.
Also, I'd recommend that you go for http://framework.zend.com/manual/en/learning.quickstart.html instead that book - Quick Start really is great.

What's the best process / app for automated deployment of PHP apps?

There's another post on SO relating to .NET -- not us. Pure PHP. Trying to find the best way/process to deploy stable version of our PHP app. I've seen an article on Capistrano, but am curious what else is out there. Aside from the obvious reasons, I'm also looking to add some scripting so that the SVN rev number gets added in there as well.
Much thanks.
I've used a home-grown script for quite some time. It will (based on an application configuration file):
Run svn export on the repository based on a tag.
Package the export into a tar or zip file, which includes the tag in the name.
Use scp to copy the package to the appropriate server (QA or release).
Connect to the server with ssh to install the package and run post-install scripts.
The application configuration file is part of the project. It can tell the script (at step 2) to strip paths and otherwise process specified files. It also specifies server names and how to handle externals.
I've recently migrated the script to support Git as well as Subversion. I'm also probably going to migrate it to PHP since we're now running in a mixed (Linux and Windows) set up, with Linux now in the minority.
I have plans to automatically call the script with post-commit hooks, but haven't had the need to implement that just yet.
Coincidentally, I was just reading about an Apache Ant/gnu make like build tool called Phing. What I like about it is the ability to write custom extensions in PHP!
I don't know if it works for deploying an app live, but phpUnderControl is a continuous integration suite (which I'm just now starting to look into). If it doesn't support doing deployments natively, it can probably be extended to do them.
Chris Hartjes has a nice view on this: Deployment is not a 4 letter word
We're using Webistrano, which is a web frontend for Capistrano, to deploy a few dozen projects. It's built as a Ruby on Rails app, and provides a nice, centralized and consistent user interface for Capistrano deployments.
Instead of having cap recipes in every project, and running command-line tools, Webistrano stores the recipes in its database, and allows you to attach the recipes to multiple projects and stages. This reduces duplication of scripts.
Also nice is that all deployment logs are stored so there's an auditing trail. Who deployed which revision to the live server, that sort of thing.
As you requested, the Revision number is stored in the deployed project as well.
All in all, we're very pleased with it.

Categories