For some reason when I create a project in netbeans and go to run the project it also loads the xxamp index file and not the project index file that is apart of the codeigniter installation.
http://screencast.com/t/qOSH80wPgvf
Edit:
Here is my file tree I have right now set up for my project. Why Netbeans creates an important files folder I have no idea for my CI project. I have edited the index file to have the application and system variable to both have the ../system or applicaton as its value. I have changed the Web Root inside the project properties to have a value of public_html and I have also changed the value of the Index File field to say index.php.
After doing this and running the project I would expect to get the default Welcome to Codeigniter page and I don't. I am receiving a message that shows the following. Any ideas on why this is?
Object not found!
The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.
If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.16
Projects
- MyFirstProject
- Source Files
- application
- public_html
- assets
index.php
- system
- Test Files
- Important Files
- Include Path
I've tried doing some additional research on the topic and have yet to come up with a solution.
Edit 2:
Any ideas from anyone?
Your problem is likely related to your choice of folder layout. Which I assume you do, for "security reasons". That said, NetBeans isn't a server. Its an IDE, so you can't manipulate it the same way you would the server.
Most servers by default define your "root" folder as "public_html" or "www" as far as where it looks by default to serve files for public consumption. Through the use of PHP you can tell the index.php that comes with CodeIgniter to look up one directory outside of the defined root and have it read the file(s) accordingly.
However, to setup a project in netbeans and have all files and folder accounted for accordingly you need to tell it that all your files start in whatever folder they reside. So it can load all the files and read from them respectively. This in essence and in respect to server logic is telling it that the folder that houses
application
public_html
system
is the define root path. So inadvertantly by breaking out of the design of codeigniter and placing the core files outside of what would be your defined root on the server is breaking your project. There is not an index.php depicted in your listing above at the same level that those folders are in. If there is, its the index.php for xxamp that keeps loading for you by default.
What you need to do is stop trying to implement your "security measures" and put them in the right order. Or.. not include that folder in your project telling it the one with assets and index.php is the root path. If netbeans is smart enough it will find the files and folders outside like the server will.
Right click on your project and go to properties. Make sure that in the run configuration the URL is correct and the index file is properly set up and matches your directory in xxamp.
after downloading codeigniter open index.php file and there set your path correctly to your
application folder because i think you putted your index.php inside public_html folder so
the path which is set by default in index.php is not working and can not find application folder, try to fix it and it will work fine your problem is not with netbeans.
Related
We recently have adquired the credentials to fully play with our website hosted outside.
So we need to mount it locally on a XAMPP stack to fully deploy the site and asociated database.
It've been already done, and everything seems to work properly except for the images in the site.
It is a DRUPAL site. Some images are "full path coded", so they work as we can expect, but major of them are just relative path coded.
Now, I've everything mounted on localhost. Let's say the folder with the site it's called "web".
Then i've everything on:
c:/xampp/htdocs/web/.......
So I access to it via: http://localhost/web/
I've tested that all the non viewing images, if I append the "http://localhost/web/" on the 'src="/site/..."' they are accessible and look right.
So, is there a way to via .htaccess add the "http://localhost/web/" on those URLs who hasn't it? It doesn't only happens with images, it's just related with all the links, urls, srcs, whatever which is just "relative pathed".
I've already tried the "RewriteBase /web", but it doesn't work.
Need help to solve this so, please.
In summarize, the site online is just mounted on the root, so everything works, fully or just relativetly pathed. But in my case, I've got the development site inside a folder, so I need it to work too!
Much appreciated.
If this is a Drupal 7 site (might work for Drupal 6) make sure you have a tmp directory set. Go to admin/config/media/file-system and look for the temporary directory. Also confirm that you have this directory on your root, which for XAMPP is the htdocs folder.
This might be a file permission that can be caused by incorrect .htaccess settings (This link may help: https://www.drupal.org/node/2140629) in the folder set as your temporary directory.
This may also be a document root error. You can change that by editing the DocumentRoot setting in C:\xampp\apache\conf\httpd.conf.
This stackoverflow link may help if none of the above suggestions bear fruit: https://drupal.stackexchange.com/questions/30113/configuring-the-temporary-directory
When I echo "PHP_SELF" in localhost running on xampp, I get the project folder as the echoed text e.g.
// index.php
<?php echo $_SERVER["PHP_SELF"]; ?>
The answer is
/a3-ver-9.0/index.php
but if I was on a server with a domain, that line would just return "/index.php"
Is there any way I can temporarily changes the default root in xampp to reflect this?
The reason is because I use absolute paths from root to include resources e.g. images.
however these absolute paths will not work if the root is not set correctly!
Cheers
EDIT
To make things more clear...
I have a website with php files that return parts of the page e.g. header.php and footer.php etc.
I have an installation of wordpress and in the wordpress template, I include these files. and because im including these files from different directories, the paths inside the included files must be absolute.
however the files in the header.php are included like:
<img src="/images/image1.jpg" />
now this include is correct, and when I've finished the project and upload it to my server it will correctly retrieve the image.
but when working with localhost, the root folder "/" is the folder where ALL my local projects are kept.
So i need a way to temporarily change the localhost root for each project, so i dont have to mess about changing a load of paths when the project is ready for upload!
Hope this made more sense
However when working on local host
Best way to solve this is using virtual hosts for your projects locally.
So something like www.project.local actually shows your project.
Here is a tutorial how to achieve this in xampp.
Okay, now I see what you mean, here you go this will help you, just change the root to the folder of your current project, for example:
"C:/xampp/xampp/htdocs/a3-ver-9.0/"
So, i'm a total noob with codeigniter but i'm getting by.
I have a domain name on iPage. Currently, I am using codeigniter w/ my codeigniter project inside htdocs which is inside XAMPP. Everything is working great on localhost, but I am totally lost on where to start concerning how to put my project onto my web hosts server.
There is not much to it.
The following part, does not really belong here, but I guess I like to start from the beginning.
You need a domain name and hosting space(with a php server ofcourse).
The hosting provider will provide you with ftp access and a control
panel to access your files. You need to add nameservers to your
domain name to associated it with your hosting space.
www.yourdomain.com/ will point to your hosted files. (This might take a couple of days to take effect).
To answer your question:
Now, you can simply upload the contents of your project to your home
directory on the hosting server. You can organize it the way you want
with subfolders etc. You'll also need to make server specific changes
like mentioned here
You might also need to check if any php libraries need to be enabled on your server.
CodeIgniter is installed in four steps:
Unzip the package.
Upload the CodeIgniter folders and files to your server. Normally the index.php file will be at your root.
Open the application/config/config.php file with a text editor and set your base URL. If you intend to use encryption or sessions, set your encryption key.
If you intend to use a database, open the application/config/database.php file with a text editor and set your database settings.
If you wish to increase security by hiding the location of your CodeIgniter files you can rename the system and application folders to something more private. If you do rename them, you must open your main index.php file and set the $system_path and $application_folder variables at the top of the file with the new name you’ve chosen.
For the best security, both the system and any application folders should be placed above web root so that they are not directly accessible via a browser. By default, .htaccess files are included in each folder to help prevent direct access, but it is best to remove them from public access entirely in case the web server configuration changes or doesn’t abide by the .htaccess.
If you would like to keep your views public it is also possible to move the views folder out of your application folder.
After moving them, open your main index.php file and set the $system_path, $application_folder and $view_folder variables, preferably with a full path, e.g. ‘/www/MyUser/system’.
Reference: https://www.tmdhosting.com/codeigniter-hosting.html
I have a shared hosting account in which I want to install my symfony 1.4 and deploy and application. I bumped into some issues because of the inability to change the apache config on the production server.
the structure of my web server is:
hosting_account_name
html <--- public folder
I then moved all files in symfony local app folder to my hosting_account_name and put the web folder content in html
So i got the following structure:
hosting_account_name
apps
cache
config
data
html
css
js
index.php
.htaccess
frontend_dev.php
lib
log
plugins
test
and i added the line bellow to config/ProjectConfiguration.class.php
$this->setWebDir($this->getRootDir().'/www');
I have a couple of issues though:
1. when i access the frontend_dev.php no images are due to the fact that symfony expects some files to be under a sf/ folder. Should I move the files there?
2. Index.php gives an error. Even with display errors set to yes and 500 internal server error is presented.
Also i had to set my permissions to 777 on cache and log. Their are under the folder html so that's ok for security right?
First, you said that the "public" folder is html, but you used $this->setWebDir($this->getRootDir().'/www');. Is it html or www? (Just to make sure)
Then: setting the sf_web_dir should work like you expected, so that shouldn't throw any errors.
To link the /sf Symfony folder, you will need to add something to your apache configuration. As described on the first page of the Jobeet tutorial, you will need to add an Alias to the /lib/vendor/symfony/data/web/sf.
If you don't have access to the httpd.conf, you could also add this to your .htaccess.
777 for log and cache is ok. It's what the default project:permissions task does as well.
So I've pulled a repository from github into my htdocs folder. But when i go to the http://localhost, all I get is a list of the folders in the App (vs seeing the app display in the browser).
i.e, my app is displaying a bulleted list as seen below. Usually i can get php pages up and running if they have a simple page right in the htdocs directory (index.php, etc). but this app is more sophisticated & doesn't have that.
I'm a beginner, so i'm sure this is something small I'm overlooking...but some help would be much appreciated.
Index of /
-App
-Config
-Core
-etc
-etc
-etc
Thanks,
Something has to pass control to an "index.php" or some other controller that will handle the request and spit out the html you want to see. If the app is supposed to do something, you can try maybe checking the .htaccess file to see what it's supposed to be forwarding to. If all is set up correctly and still not working, then maybe the master httpd.conf has something like AllowOverride None that is preventing the rules/directives/etc in the htaccess from executing correctly