I'm not even sure this is the right way to do this, but I am looking for some advice. I am developing on a Mac, but using VMWare to run this project in Windows.
I am using WAMPserver 2.2A. My directories look like this:
C:\Users\John Doe\Development\project-web\
C:\wamp\www\
What I would like, is to develop my project in project-web, but have a symlink in www so I can run it in the browser with apache. This is what I tried:
mklink project "C:\Users\John Doe\Development\project-web\"
I ran into some permissions errors when trying to approach it this way. I feel like this would be better than storing the project in \www\ but I might be wrong.
Any advice would be great!
Apache generally doesn't follow symlinks by default, as they can be trivially used to break out of the document root. I'd suggest looking into using an Apache Alias instead to create a virtual Apache folder that maps to your development directory
Related
On 16.04 Ubuntu, I want to run a cakephp app on the localhost to make some modifications. How can I do that?
Installed application has files in 3 different directories:
opt
etc
usr
I know apache files run on var/www/html but how can I move those installed files there to run the application? As far as I know, index.php is the start file of php projects but for cakephp, there is a default.ctp file for the main program page, of course there are other index.php files for other pages, and I am really stuck with that.
Thanks in advance.
Copy your CakePHP project to a subfolder in Apache document root, eg /var/www/html/myproject. Make sure you have mod_rewrite enabled. Then you should be able to access your project at http://localhost/myproject.
More info: CakePHP Installation
As for files located in etc, opt and usr, it depends what they are. If you can share what you have there, please do it, as it will help to decide what to do with them.
I suggest using virtual hosts to run your project.
https://support.rackspace.com/how-to/set-up-apache-virtual-hosts-on-ubuntu/
Enjoy...
A year ago, I decided to go with codeigniter instead of laravel, because codeigniter prooved to be easier to setup. I am now preparing for my next project and it seems as if codeigniter is now obsolete (at least most of the people seem to recommend laravel over codeigniter).
Now to my problem: I use a virtual ubuntu machine for developing web apps so I have a dev environment similar to the production environment (this helps me to avoid some problems (especially case-sensitivity...;)))
I installed composer and laravel and created a new laravel project named "quickstart" in /var/www/quickstart. I then followed their "getting started guide" (here: Guide). So far everything worked.
But here come the problems:
I have two other web applications in /var/www, so when I enter the ip of the machine I see the 3 directories.
Issue 1:
Normaly I'd expect that as soon as if I click on the "quickstart"-Directory in my browser, the webapp would get displayed, but I have to click a second time on "public", and then the webapp is displayed.
Issue 2: Of course, the links on the page are wrong too, because they reeer to (for example) "/task", which can't be found on the server.
The problem is that I'm not really experienced with apache configuration. I suspect it has something to do with VirtualHosts, but AFAIK you need to have root access to configure virtual hosts, and I do not have root rights on the dev environment.
Could you point out a way to me how I can make laravel work in a subdirectory in a way that I can just move the files and folders to my hoster as soon as I have finished the project? I'd like to then change only one file, and not all paths and URLs in all files ;)
Regards,
Christian
Thanks to Bogdan, I was able to figure it out. My hoster allows symlinks, so I did it like so:
I put the laravel installation in
/srv/web/quickstart
(quickstart is the name of the project). I then created the following symlink:
ln -s /srv/web/quickstart/public /srv/web/www/public
The document root of the apache is configured to
/srv/web/www/public
After that I just got a blank page. That was because I forgot to set the correct permissions on the storage-folder. So I set the following permissions
chmod -R 777 /srv/web/quickstart/storage
This is fine for a development environment. For production I'd recommend to only allow the webserver-user to write into that directory.
And voilĂ : Everything works!
Thank you for your help bogdan.
Christian
I am just starting to learn PHP development (wordpress specifically) and was wondering if there is a way to structure my PHP projects such that I don't need to create them inside the /var/www/ folder?
Specifically, I am coming from Ruby on Rails and it was very handy that I just had to type rails server into any directory which was initialized with Rails in my system and Rails would automatically associate the correct relative paths.
It is very cumbersome having to sudo each time into the /var/www/ folder and create the projects there. I would much rather have some sort of directory in my home directory where I can put all my PHP projects into.
I am using the standard LAMP (Linux, Apache, MySQL and PHP).
Laravel is quite similar to Rails; I've decided to go ahead and use it.
The command php artisan serve is essentially the laravel version of
rails server, and configures the document root to be the current directory, much like php -S localhost:8000.
I have a live site that is set up using ubuntu. All my files include a bunch of classes and they are all referenced at var/www/classes/class_name. My file structure is a lot different being on a wamp server.
I don't want to have to go through all my files and change the location to match that of the windows machine.
Is there an easy way to make my wamp server look in a windows directory structure when my php file says to look in var/www?
I don't want to have to go through all my files and change the location to match that of the windows machine.
You should be using relative paths anyway so that this isn't a problem. I strongly suggest going back and fixing your paths so that you can move your code to wherever it needs to be.
I have a live site that is set up using ubuntu.
You should be running your development code in an environment similar to where it will run in production. I suggest using a tool like Vagrant to manage a virtual machine for you that runs Ubuntu and whatever web server you run in production. When you do this, you can also map directories over in any way you like. (You should still solve your path problem though.)
What's the best way to deploy a PHP PDT Eclipse Project on Apache 2.2 on Ubuntu?
I already tried to find an Apache Eclipse server adapter but got no luck. Do you know any?
If not, what's the best way to deploy a PHP Project to Apache? Shell script? Ant script? Other solution?
I could put the project folder inside the Apache's www folder but I would prefer to have the project files on a cloned git repository outside of Apache.
I'm using Eclipse Helios SR1, PDT 2.2.1 and Apache 2.2.16.
Thanks in advance.
I came across this page looking for a Windows solution and found this little workaround in the meantime that might prove useful to someone:
Select Run > External tools > External tools configuration
Add a new configuration, name it Deploy or something
Set the location field to C:\Windows\System32\xcopy.exe
Set the argument field to ${workspace_loc}${project_path}\*.php c:\inetpub\wwwroot\${project_name} /s /y
Create the directory c:\inetpub\wwwroot\${project_name} manually so xcopy doesn't get confused
This will copy all your PHP files over to your webserver content directory in a subfolder with the same name as your project. The nice part is that you can run this deployment shortcut from the Run Tool button, right next to your Debug and Run buttons.
symbolic links!
ln -s /home/pedrosanta/Workspace/myapplication /var/www/myapplication/htdocs
setup your apache virtual hosts accordingly.
Or you could just set your virtual host's document root to your remote location.
DocumentRoot /home/pedrosanta/Workspace/myapplication
I found this question here on SO with a lot of useful answers:
Does anybody have a development/staging/deploying workflow with php/mysql?
I hope it helps!
Save to local, SVN (or other version control via Eclipse) to branch, branch to trunk, trunk to test, test to live. I can't say enough about how important version control and testing is in any sized environment.....even if it IS a colossal pain.
http://andrei.gmxhome.de/filesync + http://code.google.com/p/win-sshfs/ is remarkably good.
I use Apache with eclipe by configuring Apache path to the workspace folder,
in httpd.conf (d:/workspace/php/ is my project location)
Alias /php/ d:/workspace/php/
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
restart Apache and
http://localhost/php/somefolder/somefile.php
Cheers