i'm new to bluemix, and don't know how to change the default index to look to public folder of the zend application, so have a php starter build, pushed the application to server, and when i call my_url, it's showing the default index file, and when i type my_url/public it's showing the zend index page ( obviously ).I want when i type my_url/ to take me to public/ folder by deafult.
So has anyone had this kind of "problem"... Searched on their forums, but there is nothing about this case...
Check out the docs here. https://github.com/cloudfoundry/php-buildpack/blob/master/docs/usage.md
The easiest way to use the build pack is to put your assets and PHP files into a directory and push it to CloudFoundry. When you do this, the build pack will take your files and automatically move them into the WEBDIR (defaults to htdocs) folder, which is the directory where your chosen web server looks for the files.
Additionally if you place anything in the lib dir it will not be publically aviailable.
If you place a file in root of your app called .bp-config/options.json you can override the htdocs dir.
https://github.com/cloudfoundry/php-buildpack/blob/master/docs/config.md#httpd-nginx-and-php-configurations
WEBDIR Set a custom location for your web or public files. This is the root directory from which the web server will host your files and the root directory from which PHP-FPM will look for your PHP files. Defaults to htdocs. Other common settings are public, static or html. Path is relative to /home/vcap/app.
Related
I have a VPS and use PHP 5.5 and Apache 2.2 on a 64bit CentOS.
I have many domains on this VPS that used a shared library named core.
each Domain redirect to a directory with same name in apache html's directory. to be clear, this directory's structure is like this:
cd /var/www/html/
ls
core
site1_dir
site2_dir
site3_dir
site4_dir
...
for example http://www.site1.com root directory is /var/www/html/site1_dir
but there are many files and libraries in core that can't be address like this:
http://www.site1.com/../core/etc
so i created an empty folder, named core in each site's directory and i want to put a .htaccess file in them, in ordor to access core contents in each domains. for example:
http://www.site1.com/core/js/script.js must be a direct link from /var/www/html/core/js/script.js .
creating this .htaccess file is my question, and any other given options will be useful for me.
You should be able to create a symlink in each dir to the upper core dir and then work the files that way.
I have a development server at dev.mysite.com and I am working with coda and git to make commits and pushes to the repo which has a developmenet branch that points to my dev domain.
The file structure as of right now is this. As of right now does anyone see anything that I should reconsider changing. I'm asking this because of having a public_html inside the dev folder or what. With this setup currently when I load dev.mysite.com it shows the index of / which shows .gitignore, .git, and public_html.
../
/dev
/mysite.com
.git
.gitignore
/application
/public_html
/assets
index.php
/system
/mysecondsite.com
/application
/public_html
/assets
/index.php
/system
/sites
/mysecondsite.com
/application
/system
index.php
Does anybody have any ideas?
If you want to have a development environment and a production environment. While having the core files for CI outside of a public_html. You have to redefine your document root. I assume you are using a server the comes with cPanel as your means of administration for your server.
So that said, you go into your cpanel and where you defined your dev subdomain, you should be able to edit the document root folder. So on the server in your dev folder you will add a public_html like I gather you already have from the example above. And with your current folder settings for dev you add /public_html to the string that is the folder path now.
Once you do that allow a minute or two for it to delegate to the server from cPanel. And move your folders around as you see fit.
From there, you find the root index.php and open that up, find the references for your application folder and your system folder and change them to match the paths they should be looking for now. Likely using relative paths.. ie: ../../applications for example. Save your index.php
Assuming you have done everything in general correct your copy of CI should load correctly as it did when you didnt have everything in the folders split up like you want..
Am trying to use a config file for a database and rating script but the problem is the config file is in this directory :
website.com/include/config.php aka websitename/include/config.php
The rating script needs the config and is accessed like this:
include_once("config.php");
I want the config to be in:
"/files/website/"
A directory level up from the website root folder.
I have been trying with:
"../files/website/" and other variations but can not figure out how to link them.
I have managed to put one config file and access it, but with this ajax rating script the only way for it to work is to have the config in the /include/ folder next to:
rating_process.php - has this link : include("inc/config.php");
rating_functions.php - has this link : include_once("config.php");
rating_total_functions.php - has this link : include("inc/config.php");
Hope i've explained myself here
Right, looking at my hosting now:
$_SERVER['DOCUMENT_ROOT']; outputs this: /foldy/homepages/11/username/htdocs/webbysite
My index file is located at: /foldy/homepages/11/username/htdocs/webbysite/index.php
The included rating script is located in: /foldy/homepages/11/username/htdocs/webbysite/include/
I want the config to be in /foldy/homepages/11/username/htdocs/secretfiles/config.php
Am trying to some how go out of: webbysite folder and then into secretfiles (sibling folders)
I have tried adding ../ and so on, but am missing something obviously :(
Try
$configLocation = $_SERVER['DOCUMENT_ROOT'].'../files/website/config.php';
include_once($configLocation)
but the problem is the config file is in this directory
it is not a problem at all.
just keep it as is.
Concerning your particular problem, your problem is that you don't know where you want to put your file. /files/website/ is not likely a right path and it is apparently not one level high from webroot.
So, first of all make your mind about the right path to the directory and it's relative position to the web root
if you are concerned about security ( because your config file contains the db details ) i would place the db config file outside the site root folder and then require_once('../../dbConfig.php') from the script that's creating xml or json for your ajax
more exactly ...
your site folder might be here: /var/www/html
set a virtual host (done differently on Linux and Windows) and point your domain to a sub folder inside /html so that the new path to the site root is /var/www/html/site.
then place your config file in /var/www/html and call it from your scripts inside your /site folder using require_once('../dbConfig.php)`.
your db details are outside the site folder
I'm new to php and hope you can make me figure out whether I'm trying to do anything impossible.
I have two folders 'public' (root directory), and 'library' (all php files here), these folders are in same level of folder hierachy. my public/index.php is basically loading another php file (say aa.php) which is in 'library' folder on the loadup. Now I need to create a anchor link to file call bb.php which is also inside library folder.
I tried create anchor as follows
echo " my bb file
But I'm getting 404 error saying localhost/bb.php can not be accessed. I guess this is because bb.php file is not with in root directory and server is preventing direct access to this file.
Please help me to overcome this problem.
Thank you
If library/ and public/ are at the same level, the webserver will not be able to serve the files in library/. Typically, files in a library directory would be included by files in the public web folder.
If you need to use the bb.php directly, you will have to move it to public or a folder within public. And then from within public/bb.php you can include library files
/* public/bb.php */
include("/path/to/webroot/library/file.php");
Move bb.php into the folder "public".
So I must upload the CMS that I've been creating in the development environment to my company's server to show the client. But the software I created was built in the document root, and the company wants me to upload it to a folder on the server. Is there any way to set the document root dynamically with PHP, or to include an .htaccess or some such thing in a single folder on a server?
I suppose I could also juse create some global var with
$DOCUMENT_ROOT = dirname(dirname(__FILE__)));
And reference that at the beginning of my paths, but I am looking for a more elegant solution.
You're going to need to define a baseUrl that is available throughout your application. If the client is getting antzy to see your work, tell them to register a subdomain to throw it on.