How to make an php project accessibile within svn repo? - php

Hey I've a svn repository with some php files and I want to run it over the browser. Just like a normal page. But if I go to the repo url (http://server-URL/svn) enter my username/pass, navigate to my php project and selecting the index.php it just shows me the content of the index.php but not the real rendered page.
How can I run my project?

Presumably you're using something like mod-svn in Apache to deal with your SVN repository.
If you want to run the PHP then you'll need to set up another virtualroot on Apache that isn't using mod-svn and give it a root directory which matches the location of the PHP files.
Basically, you can't manage the repository and parse the files from the same URL.

That's what I'd expect viewing the project contents through the svn interface. What you want is to actually upload the php project to a php-enabled website/host.

SVN is just a repository. You would want to "check out" the code to your local machine and have a PHP Web Server setup.
Of course, you could host it in a real website also.

Related

MAMP moodle project

I am working on a moodle based project, which I inherited from someone else. Having copied the files into htdocs folder and started MAMP, the files still don't show in the browser. Instead, the browser automatically initiates a download. I might be required to change the config file, however, since I do not have much experience with php and SQL I am not sure what exactly. My part of the project is to develop html and css, but need to be able to run it locally first.
What do I need to do to get the files run locally? The route I use is localhost:8888/whatever/whatever/index.php
In case someone else runs into the same problem - Apache downloads php files instead of reading them - here is what helped me.
.htaccess file may need changes if the application has changed servers.
Delete (at least rename if you don't want to remove it) config.php and run the application through the browser. It should initiate install automatically.
To run php and SQL I used MAMP.

Using gulp livereload with XAMPP

I been using gulp for front-end development lately and I find it very helpful.
I use XAMPP in windows for making PHP website some of which sometime include database operations.
Now, I have used gulp-livereload and gulp-connect for starting a server for front-end but then it won't process the PHP files.
All I want to do is, PHP livereload with database access. Like livereloading but via XAMPP's server(since it can process PHP).
yes, I have found a temporary solution for now.
See, it's just temporary but as long as you write PHP correct, you will get the work done. Let me tell you how I do it.
Though right off the start I want to tell you that this is not a proper way to approach this, you should use some MVC framework.
Anyway,
I have XAMPP installed under Windows 8.1 and XAMPP's htdocs is in my "C" Drive.
I then create a folder inside "htdocs" in which I put all my frontend + backend code.Basically, gulpfile.js is at the root, then there is a components folder in which all front-end sources reside. There is another folder at root called "www" inside which I put my index.php.
Then I load gulp-livereload instead of gulp-connect and I add the livereload.listen(); method and Tags in all the php files I want to reload.
Works very fine except when PHP throws an error, untill you correct that error, you have keep reloading the page manually.

PHP project with MySQL data on CD/DVD

Exist any way, how to place the PHP project with MySQL database on CD/DVD with full functionality? My client would like have his presentation on the CD and this CD he'd give his customers.
And the idea is, that these customers just put the CD into their PC and run the complet web presentation on their computer...
Is that sci-fi or exist any way to do that?
Thank you
The CD/DVD will have to have Apache/MySQL/PHP available to it - what you're looking for is a "portable webserver" to be run from the DVD. I used something called The Uniform Server some time back with pretty good success.
Well, the only solution I can see is not use a server-side language (seeing as there is no server here), but use only HTML+CSS+JavaScript to make your presentation, hard code the content with the HTML, and don't use a database.
Burn all of that on a CD (have an index.html page on the root folder) and when that is run from a browser, it should work.
Since most folks have internet access these days, I'd make an index.html file with a meta-refresh to a regular web page online. You can even make an autorun.inf that launches that file, but note that most computers have autorun functionality disabled these days.
You can checkout Server2Go. I only found it via googling so I can't speak as to how well it works, but it seems like it has everything you're looking for.
You can create an entire live Linux environment that they can boot off of a CD. Take a look at Knoppix. Their wiki has instructions for mounting the OS, customizing it, and recreating the disk image.
Another option might be to use VMWare ThinApp to virtualize your entire application bundle (MySQL Server, application server, etc.).
On your client computer set up the server, php plugin, and mysql. The server should point to the cdrom as the root directory. Then copy all the web files onto the dvd. Do not forget to create databases on the client computer.
I just tried CDsite from the SourceForge website. It came in handy for a similar requirement of mine. However, note, works only on Windows XP. The EXE file failed to run in Windows 7.

Rendering code using Apache/SVN on Ubuntu

I'm not sure if I'm missing the point here...
Our devs want the following...
On a LAMP server with SVN/WebDAV they want the root Apache directory to be a repository that they can all work on. However, setting the default Apache directory to a repo doesn't work as the files aren't stored as html/php files, instead in the SVN db structure to handle changes/revisions/etc.
Is there any way to do this? or would we have to have a separate repo that they copy files to/from the web root when developing?
You have to setup a separate svn repository and Hook Scripts. This hook scripts can checkout the code on every code change to your apache root. This is quite common an also used for automatic testing etc.

Using Version Control but still access the files normal way

I am trying hard to use version control but i am so used to old method of editing files directly via FTP that i am feeling confused what to do. So i am thinking of one solution and please help me with this if its possible or not
I have the user folder in Linux VPS system(Single VPS only)
/home/user/public_html2
Now that will be linked with Http://demo.server.com.
That directory will be version controlled with repo in the folder /usr/bin/repo/ so that i can commit the changes.
Now i will have another directory called
/home/user/public_html which will have the contents updated as the commit is done in /home/user/public_html2.
That /home/user/public_html will be linked with http://main.server.com
So that i keep working and editing files in public_html2 via FTP normal and test code as it is but main site is version controlled
Is it possible??
When you are using a version control system, why do you need to of to a FTP location to edit the files... It defeats the whole purpose.
Rather, checkout the files from the repository into your local machine and after the changes are done, commit the code.
If you don't want to use the version while working with the files on your local, simply export the code instead of checkout.
The problem I see from your approach is that the files / directories may go out of sync. Also, if there are multiple users working then this approach would bomb.
I would suggest to have the working copy of the files in your local machine and use them instead of mirroring them to another folder.
Maybe it's possible. But once you start to use version control systems, you should keep accessing your version controlled files through that system.
Or better, if you want to access files in "normal way" as you said, then if you access that files without committing any change then it should be ok. But if you want to modify them, you should always pass through your version control system, otherwise you could have problem with file versions.
You need a deployment script. Create a script to upload the files to the appropriate locations. Run this script whenever you wish to see your changes reflected on the site. If you wish to maintain two separate locations on a server running different versions, simply add a command line argument to the script to choose which location to upload to.
Use rsync instead of FTP if you can, to avoid transferring unchanged files every time.

Categories