I'm currently trying to teach myself PHP and MySQL using the MAMP stack. Everything has been going good up until I came across this problem.
I am reading a book and completing the exercises as I go and I'm at the point where I have to let the user upload an image and then store that image on the web server. The book states that to do that, you make use of HOST_WWW_ROOT to set the location for the web files that will be uploaded.
I have done exactly how the book says to, however it is not working.
Is it possible to use this HOST_WWW_ROOT on localhost or can it only be used on a live server?
Every book will use something like SITE_ROOT or HOST_WWW_ROOT to refer to the location where your web server's public directory is located at.
MAMP FAQ:
Where should I store my HTML and PHP pages?
By default, PHP and HTML Pages should be stored inside the MAMP "htdocs" folder which is located in the MAMP Application directory /Applications/MAMP. This folder is called "Document Root". You can change the path for the Document Root in the MAMP application's Preferences Panel:
Now, depending on the platform you are developing your application on, some books would use something like SITE_ROOT, WWW_PUB, WWW_ROOT, etc. but they all refer, as you said, to the location where your 'web files' are.
See if there are some side notes indicating the book conventions.
Related
I'm working on a project on localhost. Its kind of a company management application based on some php framework. Basically I'm a front-end developer and I've to fix some pages, their alignments and color scheme. I'm using firefox. Every single time when I've to change the settings of any page I've to go the php dev who built the app and they located file for me in the project, obviously they knew the file structure of the whole project. So is there any possible way, tool, addon or plugin that can identify the specific file (which is currently open in my browser) for me? so that I can reach the file on localhost directly and edit it right away rather than bothering the php developers all the time. Firefox inspect element can identify the css files though. Any help would be appreciated. Thanks
My company recently inherited a client with a handful of sites using Drupal, and being primarily a WordPress shop, we don't really know where to start.
We were given a file archive of the web root to put on a fresh server. I'm guessing that this is a multi-site Drupal install, because there are three folders inside my /sites/ directory: all, default, and a folder describing my client.
I added new databases for the sql dumps inside sites/default/data and sites/[client]/data and referenced them in the two settings.php files where my databases are being called.
I also changed the $sites variable in sites/sites.php to reflect my new server address.
However, when I go to [server-address]/user/login and enter my username and password, all I can get to is the Drupal 7 Starter Site. Obviously, this isn't the information that I need, and I need to access my client's site.
Any help on this would be greatly appreciated.
This question seems like a variation of the question Drupal to Drupal Migration : did you correctly restore the .htaccess file(s) also? Those are "hidden" ( filename starts with a '.'), not shown by default by some FTP transfer softwares.
If that doesn't help, maybe these questions might help:
Migrating Drupal Site on SAME server; :
https://stackoverflow.com/questions/27925677/migrating-live-drupal-site-to-localhost :
Here is my (probably very silly) newbie method of working on projects.
I have a directory C:\websites\ and I keep separate folders for all my sites in there.
Whenever I want to work on one of those sites, I copy and paste the files for that site from it's directory within C:\websites\ - for example:
C:\websites\website_one\*.* (just the files, not the directory) - and put those files straight in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\ - then open those files in notepad++.
It is extremely annoying to have to move the website I no longer want to work on for that day back to C:\websites\, and to move a different website into htdocs\ every time I want to work on a different website.
Could anyone help me with the standard way of structuring the directories of your local development sites?
I want to be able to access/work on my different projects more easily, and also be able to upload any of them for online testing and not have to change any links/includes because the directory structure doesn't match.
Locally, should I just replicate the web hosts directory structure in htdocs? For example:
htdocs\public_html\website_one
htdocs\public_html\website_two
Or something similar?
Thanks for any insight into this.
Since you work with Apache anyways, why not work with sub domains or url rewrites?
Heres a link to set up sub domains.
http://www.sitepoint.com/forums/showthread.php?394472-Setting-up-Subdomains-on-Localhost-Apache
Each site can be in its own folder, do keep in mind that includes or links should be based on the root of the website, not the root of the webserver.
I am working with a website built (not by me) on Zend framework.
I have made a small website (for a Facebook app) built on simple html with custom php (no Facebook API used), which, if put in public/ folder (so that it can be reached via *www.main_site.com/my_small_site*), does not work (I get Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration).
The php.ini on the website, however, contains allow_url_fopen = on, so my guess is that all my php files should be simply put somewhere in the application/ folder, instead of the public/ folder.
The websites don't use shared files, they are independent. And purchasing another hosting is an expensive option.
I am absolutely new to Zend, and learning how to make my own controllers/views will consume too much time, so this is the last option to consider.
How can I solve this problem?
Access .php located in application/ from *public/my_small_site/index.html*? (is it possible without touching the main website's public/index.php?)
Create a new view and put my small website there? (how can I make it accessible from the web?)
Still consider new hosting/subdomain options?
Any other solutions?
Thank you!
public/ is the correct place to put your Facebook app. The error doesn't lie - are you 100% sure the php.ini file you checked is the one being used? I'd suggest you create a phpinfo file as explained here https://kb.mediatemple.net/questions/764/How+can+I+create+a+phpinfo.php+page%3F#gs - this will let you view the configuration PHP is using. See what allow_url_fopen is set to there. If it is set to 'off', there might be a different php.ini file you need to change.
Otherwise, contact your host.
I have a PHP project setup in Netbeans (v6.8) where all the PHP files are on a remote server and in a single directory. Whenever I save files locally they are updated on the remote server via SFTP.
I now need to edit a remote JavaScript file to add some jQuery logic but the file is located within a different directory on the webserver. How to I add this JavaScript file such that when it is saved or updated it is transferred to it's own location on the server?
When I attempt to create the file locally within NetBeans it saves to the same directory as my PHP files. I would like to be able to continue using NetBeans rather than doing this all manually using an SFTP client and a text editor. Thanks in advance.
Since you're not getting any answers I'll offer a limited suggestion. I use netbeans, but not to automatically upload like you're doing so I may be way off here.
It sounds like you would either need to change your project to have a larger directory structure that would contain everything for this to work like you want it to. Gan you go up a level or two in the directory structure, and add containing folders in your local project to match?
The other option might be to create a second project for the javascript directory, and set that to go were it needs to go. You can create "project groups" in the project view which you can use to link them together. I know this is probably not ideal, but is hopefully easier than doing your uploads manually.