I have developed a python desktop application and application itself having setup page to change some configurations in the application and it is saved as a configuration file.
Now I need do to give web interface to change those configurations by using web browser remotely. But I need to change the same configuration file.
I can’t access any file outside the web root, So My first question is how can I edit that file which is located outside the web root.
more info : for web application I use LAMP stack and desktop application is python based.
someone suggest me to use CGI, Second question : Is that possible, if it is possible how I can I do it?
Probably by bind mounts (assuming Linux), so that the file is in it's original location as well as in the web root.
Or by priviledge separation. The web root sends a query to some worker job, that has access to all the needed files.
Related
I'm trying to make my php filemanager to be able to manage files outside the web-root. I'm using a router with OpenWRT. I have PHP5 and uhttpd (default Luci webserver) installed. The files are stored on a USB drive that's not always plugged in. The index.php is located in /www and the files are stored (when mounted) in /mnt/sda1.
I've been playing around with the permissions and user/groups with nog success.
Is there a way to do this? I don't want the filemanager itself running from the USB drive.
It seemingly isn't possible without a second webserver (different port) so I'm going to use a samba server that directs to a symlink to the /mnt/sda1 and use php to access the samba server.
I'm in the process of getting a Laravel 5 app working on Azure Web Apps and am encountering an issue via Laravel's temporary storage.
Any time a template renders, Laravel attempts to cache it to the local filesystem. Unfortunately, for some reason Laravel doesn't have permission to write to its storage directory.
I am deploying my application from my build server via FTP
I am running on the free-tier shared infrastructure (just while I'm getting set up)
My deployment server is running Linux
In this circumstance, it's obvious what the problem is. Unfortunately, what I don't understand is why my web server doesn't have access to write to the directories my FTP user uploads.
Ideally any solution offered will be one that I can automate as part of my deploy process.
According to http://clivern.com/working-with-laravel-caching/, you can change the directory of the cache files using the cache.php configuration file. I'd like to suggest you to use $_SERVER['DOCUMENT_ROOT'] to obtain the root folder of your web app, and then construct a path for the cache files.
I wish to use a PHP Framework such as Yii, however, it seems to set this up I need access to a terminal or console. Unfortunately my only access to the server is via an FTP client as it's shared hosting.
Does this rule Yii out as a framework?
all you need to do is
1 - have a copy of yii framework folder
2 - generate a new yiic webapp folder
3 - upload both folders, the framework folder can go to some hidden place yoursite.com/wawa/framework/yii, and you can just upload the files in your webapp folder to yoursite.com/
4 - edit the index.php in your generated web app, so it know where your framework/yii folder is. than you are set
5 - just make different copy of your webapp folder, so you don't need to generate them if you dont want to. just use different names, wont make a difference, as long as the webapp index.php knows where your framework folder is, than it will work
According to this post you can generated all files on your computer and then just upload the files to your shared hosting.
You only need a terminal for developing on your local server (it isn't a good idea to develop directly on a shared server). To use it on a shared server just upload it.
In the strict sense you don't need a terminal. You could write your files yourself. The yiic program only creates a couple of php files.
I am first in Yii. Installed the application locally. FTP-ing the application to the share server in directory /home/sloki/user/h11741/sites/example.com/www then create abcd directory within /www and put framework into it.
Edit your index.php line 4 to be: $yii=dirname(FILE).'/abcd/framework/yii.php';
You will get error message like this
Application runtime path "/home/sloki/user/h11741/sites/example.com/www/protected/runtime" is not valid. Please make sure it is a directory writable by the Web server process.
Change permission of directories /protected/runtime and /assets to 777. Test the web, when success change again permission both directories to 775.
Gut lak.
I have learned how to create a simple website with the Zend Framework. Now suppose I want to put it on some web hosting server. In my ZF project, I have a folder named public, which I want to appear as the root of the URL. I want my site to be visible and accessible as
http://www.mysite.com
while being served from a page like /public/index.phtml or similar.
How is this done?
If You want domain like www.mysite.com, u must buy somewhere one (for example ovh.org), there is not free *.com domain.
After that u could direct domain to your host computer (nice free hosting: 60free.ovh.org). There is PHP of course, so i think you could install Zend there.
You have to put the public_html files you're using with Zend_Framework in the root folder of your host. The host server will give you a folder which will be the root for that domain, put in there and you will not have /public/index.phtml in front of your domain name.
Do you already have a hosting server or are you looking for one?
Usually you can achieve your goal by using the tools provided by your hosting provider, some allow you to change the directory from which http://www.yoursite.com is server, set that to /public and you are done.
It really depends on the provider.
You'll need to deploy the entire Zend Framework directory structure to the host you end up using. In your Zend Framework directory structure, you have your public directory. This directory will need to be the one that your web server looks at as your document root. The setup for this is probably different based on which host you use. Some will have web interfaces and others will force you to edit an httpd.conf file.
I'm using Rackspace for our site and the default web location is /var/www/html/. We've deployed the entire site here so we have the following directories:
/var/www/html/application
/var/www/html/library
/var/www/html/public
/var/www/html/scripts
We then had to change our Apache config to point to /var/www/html/public instead of /var/www/html.
I'm using MAMP just for my development environment and haven't really understood the folder structure of /var/www/project-name/ on a web server. I'm wondering whether you're meant to point the web server to the htdocs folder or it's supposed to point to the root of the project folder?
The reason I ask is because libraries are meant to exist outside of the htdocs folder for security purposes, but how are they pointed to from the web application itself? Surely the web application can't access folders outside of the htdocs folder if the web server is pointing to the htdocs folder for the web application?
A simple solution is to have a folder structure like so:
/var/www/project-name/
+ webroot/
+ libraries/
Point your apache2 DocumentRoot to the webroot directory. Keep all the libraries that you don't want accessible from the web in the libraries directory. In your php code, use the include directive to access the libraries code.
The trick is to understand that php can include any file on your system it has read access to. A person browsing your website can only access files inside your webroot directory.
If you have multiple vhosts on the same server, it's pretty common to have each site in a directory under /var/www, and each of these have a htdocs folder, which is mounted as the web root. You can then have logs and application-specific libraries in a folder above the web root. Eg.:
/var/www/lolcats.com
/var/www/lolcats.com/htdocs
/var/www/lolcats.com/htdocs/index.php
/var/www/lolcats.com/lib
/var/www/lolcats.com/log
PHP can access any file in the filesystem for which the apache server user has the correct permissions. On a linux box running apache without virtual hosts, /var/www is a common place to use for your htdocs directory.
You place the libraries in PHP's include_path which is inaccessible to the general user.
It is a googd idea to map your local websites in directories in the same way as your domains work.
Often you have multiple websites on a single web hosting account, so setup virtual hosts to mirror the setup.
If your shared hosting is:
/var/www/root
/var/www/root/website1
/var/www/root/website2
/var/www/root/website3
Create 3 vitual hosts on your local PC but keep an identical file structure.
Also, use conditions in your config files to setup the site deifferently depending on the server file structure, to ensure the same config file works on both setups. This means you keep your one-step build process.