Is it considered best practice to develop your php website directly within the htdocs folder?
The advantages, obviously, are that you can make a quick edit, navigate to localhost and instantly view the result.
When developing ASP.NET applications from visual studio, we usually publish our changes to IIS from the "development folder" and don't usually develop directly within 'inetpub' itself. Is there something similar for php development or developing within htdocs is just fine?
As long as the 'htdocs' folder is on a test server (or at least test folder, if you don't have a test server), it's generally considered fine. Like you say, it provides a more instant feedback.
For ASP, there are better solutions, like you have already stated.
Our company have done like this for 10 years. Nothing bad happened.
As we can see, phpeclipse, zend studio, and Myeclipse (for java web apps) are all using this kind of approach. After all, we need a web server to test and debug, and the folder under version control, the two have nothing conflict, it's convenient.
Related
We are a small team developing PHP applications in a LAN. Both on Mac and PC.
Individual developers check out and edit source code to their own machine, on which Apache is running. Local testing is then done over localhost.
For the DB, the application connects to a common MySQL installation, on a dedicated machine in the LAN. This works quite well because we rarely make (destructive) changes to the DB schema. This means that all the individual applications running access the same test data.
But uploaded files remain a problem: they are only uploaded to the dev's local machine, although a reference to them is stored in the central DB. This means that the other team members may be shown a broken link for a user uploaded image, that physically only exists on one devs local machine.
The ideal solution would be to have the entire persistance layer on a central machine. Any ideas on how best to achieve this?
Map a network folder or use a service like dropbox or similar. A local db is nice to have though and doesn't take up too much resources.
Basically you want some sort of shared filesystem. There are lots of options: a samba share, an NFS-mounted directory, Dropbox (or a similar service), etc. I would suggest looking into the available options to see what suits your infrastructure best.
i have dealt with this once and what i did was to use our NAS as the storage of everything. we developed our website on the NAS itself over FTP. it was like cloud development, IDE only on our side, every file we edited, image uploaded and so on was on the NAS. the website itself was also running on the NAS (since the NAS has the ability to be a server and have mySQL)
the NAS was turned from a network storage - to an actual local server.
By how I understood your question, i assumed you only needed to share uploaded resource (like images) and not develop in the same app at once.
First I suggest that you DON'T develop on the production machine at all.
Now, here are 2 ways you can do it though:
Modular Development:
you develop independently. You don't touch each other's code. you develop features separately from each other. that way, you won't be stepping into each other's shoes. this also promotes "loose coupling" which in le man's terms, "when one feature breaks, the other's won't"
you should check out this video on how you can break down your development into "modules". This is in JS though, but the architecture can still apply.
Version Controlled Development
Break your development into 3 layers:
Production (aka Stable) is the code that is public. You don't develop or touch code here. You only publish the code only when it is tested thoroughly. Also, this is NOT the public server. this is just the public code. however, what lives here is the actual replica of the public site.
Testing (aka Beta) is where you test your developed code. This system is for testing purposes only. You don't touch the code here either. You are just here to find bugs on your own. It's your "Quality Assurance Layer". This layer is also where your codes merge (discussed later)
Development (aka Alpha) is where you touch your code. Here, you share your code, test it, break it, try new features as well as fix the bugs you found in Testing
as you can see, you don't break your systems due to overwriting, or broken links etc.
Now, your development strategy. Use a version system like GIT (distributed) or SVN(central) and create 3 branches according to the ones above. For this example, this uses a distributed approach (i prefer it)
Assign a "maintainer/ring master" in your group who consolidates your work and publishes it to testing. What this maintainer does is to collect your "finished" developed code and puts it into his testing branch. anyone can then clone his testing branch to your testing branch to test your code. Whatever bug they/you find, you refine in the development and submit it to him again. only after that feature is quality assured, then the maintainer can publish it to the stable where he clones it to the public server.
After all that's done and when you have moved on, you just clone the stable branch to your development branch and you start anew. Now you have a fresh canvas to play with.Overwriting is handled by the version control system, and the maintainer. you need not worry about that.
as for resources, you would not want to bog down your local development system with arriving resources from the public server. version control systems also have "ignore lists" to prevent you from cloning some resources. clone only what's necessary. if you are developing a weather widget, you only need images for weather widget. you don't need images from the other widgets (unless neccessary)
I am developing an application with Ruby on Rails (will be more to come) and it has got to the stage where I would like to remotely host a development version, followed by a production one. I have done lots of rails development but I am reviewing my current setup and would like to make sure I do things the industry recommended way form now on.
I already have a dedicated server which is running parallels plesk and has several domains on it. I have currently had some success by creating a new user "passenger" to run the rails app and deploying via that user to an apps directory under
/var/www/vhosts/myrailsapp.com/subdomains/dev/
which is the parallels-format for site directories, deploying using capistrano and running the passenger module for apache. I have basically been putting my rails files where I would put them if it were a plain php site or similar and I was wondering if this was the way things are usually done?
I also found some information online which points at putting my rails apps under
/var/apps/
or similar, but then it would conflict with the parallels plesk way of doing things which could potentially cause issues, or could it?
I have already looked at solutions like Heroku and they won't quite work as I need to run other programs alongside my rails app on the same server to handle some real time server to server file syncing of files uploaded using the app. Added to this I need to ideally be able to host normal PHP applications alongside my RoR ones to make best use of the server.
How should I ideally go about implementing this sort of setup for secure hosting and deployment? If needs be (i.e my current setup is far less than ideal) you could assume I am starting from a vanilla ubuntu server install which I would be open to if it produced a nicer system to manage.
I figured many people would have had similar situations and so any advice from any of you veteran Rails/PHP developers or server admins would be greatly appreciated.
Many Thanks,
Peter
Normally it's a bad idea to put your Rails project files anywhere in your public html space because you don' want anybody to be able to put something like http://yoursite.com/config/database.yml and access sensitive information. Even if that's not possible under normal situations, it could still happen if you have problems with Passenger starting up correctly or something similar.
So I would recommend putting your Rails apps in /var/apps or /srv/apps (as we've done) and setup the Apache config to point your domain or subdomain to that directory.
If you want to have your app accessible by a subdirectory on an existing domain it takes some additional setup but that can also be done.
Its my first project with PHP, I am still learning phase. Designer is working on dreamweaver to design the web site. As I developer I only understand code and feel comfortable with working on eclipse.
How can we integrate the project, that we both are looking at the same file but with different software/IDE.
Secondly , I will be using XAMPP for Windows but I am confused how the designer will use apache.
All I am looking for what to tools and practices are used when Dev's are working eclipse and designer are working Dreamweaver ?
you should keep you code separated from the html in different files. have you looked into mvc architecture?
if you use an mvc architecture or similar separation of html and php source files, you guys should never really be working on the same files anyways.
if you choose not to, set up an svn (subversion) server so that you guys can work on your project independently of one another but stay in sync. it shouldn't matter what ide anyone uses. dreamweaver has functionality to use subversion for source control, test and production server setup for easy sets/gets. you basically set it up the same as an ftp.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Recommended server for Continuous Integration for PHP Project
Hi,
I'd like to try Continuous Integration. I'm mostly writing PHP application with Zend Framework to be deployed on linux server.
I took a look to Hudson, Phing, Ant, but all of these tools looks like at the mean time doing the same thing and not.
Do you have any feedback and good tutorials to start things?
Most wanted feature would be the ability to check PHPUnit test, change SetEnv setting in .htaccess file, runs somes scripts, adjust rewrite url settings (i'm using vhost locally), statistics, notifications, and others feature you think essentials.
Hudson got renamed, to Jenkins - not much more has changed with the code iteself, but there has been something of a rush of new projects around it.
In the PHP space, there are a couple to make it easier to setup and use though - jenkins-php.org, similarly, there is php project wizard which even further automates new projects within the structure of jenkins-php.
Phing and Ant are automation tools, you write XML with various commands and it acts upon them.
Most of the feature you are looking for are best dealt with by various different means.
Run PHPUnit test - Jenkins, with the tools within it, as setup by jenkins-php, and with the actual project created with PPW.
change .htaccess file - depending what yo are doing there, you may be able to setup your local development environment to avoid having different code. I try to keep changes only in the configuration .ini file - maybe a switch based on the local manchine hostname, or a SetEnv in the apache Vhost.
A number of the rest could be done by a deployment tool, like Capistrano. I've used it to deploy a couple of PHP-based sites and the relevant plug-ins to remove rails-ish behaviour and use more usual PHP setup are easy to install. http://capify.org has details of them
What's the ideal way of deploying CodeIgniter projects (or any PHP projects for that matter) from your local machines to the live site? I've been using subversion for checking out and updating the code from live sites for quite some time now. But there are others who say that this practice is not good since you do not need the svn metadata in the live site. I've also read a couple of articles where they use Capitrano to deploy PHP projects. What's your practice in PHP project deployment?
I use Phing for all my building needs.
I've created several tasks like, prod, staging, debug. When i want to push all data to my production server, i just use phing prod. This will checkout all code from my repo, do some config changes, run all static files like css and javascript through a minifier etc.
More info on Phing here:
Phing.info
http://www.slideshare.net/hozn/phing-building-with-php
I asked a similar question and a lot of people seemed to like Phing:
What is your preferred php deployment strategy?
I took a look at it and the config files were pretty intimidating. I'm interested to hear more on this subject.