I'm running XAMPP on Ubuntu, and I copied the lampp folder to /opt/. I also downloaded CodeIgniter to htdocs/, and created and modified some files in it, including changing their permissions. Are there files in CodeIgniter that I shouldn't set permission to full, because maybe then once I upload them onto a server anyone can see their contents?
Ideally, your CodeIgniter should be setup such that the application and system folder lie outside your document root. Only the index.php file along with any assets (images, javascript, css etc.) should lie within the document root.
As for file permissions, 755 works fine. There's no need for full permissions 777.
Related
I have saved a PHP file to my Applications/XAMMP/htdocs directory and I want to run it in a browser.
I have used all sorts of url combinations including:
http://localhost/xammp/htdocs/HelloWord.php
http://localhost/xammp/HelloWord.php
amongst others and I cannot find the right url.
I am using XAMPP on a Mac Majove.
If you installed the XAMPP VM version, then you can probably access it via http://192.168.64.2/HelloWord.php (check the General tab in the XAMPP app for the IP address)
If you installed the native version, then I guess it is
http://localhost/HelloWord.php
The htdocs/ folder is the document root. Its content is served under the server address. Neither the xampp nor the htdocs folder will be part of the URL. The paths are relative to the document root, and you shouldn't be able to access parent directories above htdocs/ (although server-side code such as PHP has access to the file system and may work with files outside of the document root).
First of all, expecting the php file to have information that can be visualized in a web browser, inside xampp if you have the .php file in the htdocs folder you should be able to visualize it like this:
http://localhost/HelloWord.php
Found it by trial and error, quite different from what I took from various instructions on line:
http://localhost/HelloWord.php
XAMPP's default root should be "htdocs" or "www". Put your PHP files into those folder and try again.
if it is not work, find the configuration of Apache and PHP in XAMPP folder.
I'm using the PHP copy function to copy a file from one folder to another. But if the folder I'm copying to is a Dropbox folder, it doesn't work. This works fine and the file is copied into the test2 folder:
copy('c:/test/test.txt','c:/test2/test.txt');
This doesn't work and the file is not copied:
copy('c:/test/test.txt','c:/Dropbox/test.txt');
Dropbox is my root Dropbox folder. Does anyone know of why this is happening and what I can do to fix this? I'm using IIS and PHP on Windows Server. Thanks in advance.
Make sure your path is exactly as it appears to be. Also consider case sensitivity. That is usually a problem that throws me off. Also make sure that all permissions to the 3rd party app are validated.
So I figured out the issue. It was an issue with the permissions on the Dropbox folder. For some reason when Dropbox created the folder, it doesn't allow the folder to inherit permissions. To fix this, I right-clicked on the Dropbox folder, selected Properties, went to the Security tab, clicked on Advanced, and then selected enable inheritance.
This allows the Dropbox folder to inherit permission from it containing folder and fixed my issue.
I'm trying to give access to a php uploader to write uploaded files to folders outside of apache's scope.
Folder c in this case represents the root of Windows Server 2012
The apache folder:
/cygdrive/c/apache24 (c:\apache24)
The php folder:
/cygdrive/c/php
The uploader folder:
/cygdrive/c/apache24/htdocs/uploader
Uploader directive:
define('RELATIVE_UPLOAD_DIR', '/cygdrive/c/Users/myusername');
define('UPLOAD_DIR', rtrim(dirname($_SERVER['SCRIPT_FILENAME']), '/') . '/' . RELATIVE_UPLOAD_DIR);
The uploader will upload files to the uploader's folder, but i am trying to upload files to Windows Users folder.
/cygdrive/c/Users/myusername
How can i enable the Users folder and subtree in php.ini so the uploader can write files to it?
In a *Nix environment you would have to make the target directory writable by the apache process owner. If you don't know what that is, take a look in the httpd.conf file. Look for two lines like:
User _www
Group _www
That user must have write access to any target directory. I guess it's just the same in Windows.
I must admit to not liking the idea of writing to user directories though. Might be better to have a rethink on what you are trying to do and find a way to keep userland safe and secure, whilst giving them access to the data.
I'm having quite a weird problem here.
I have just pasted the Yii folder into my htdocs folders and, for some reason, apache can't see one specific folder within the Yii folder, which is called "framework". I.e., when I type http://localhost/yii , apache correctly lists all sub-folder within the Yii folder except for the "framework" folder!
When I try to call this folder directly from the browser (i.e. writing http://localhost/yii/framework) I get a 403 Access forbidden error.
I'm at a loss here, why isn't apache listing one single folder? The folder which it cannot see is no different from the ones it can see.. I've even removed the read-only attribute from all folders within htdocs but to no avail.
P.S.: my OS is windows Vista sp2
I'm not sure why you are even trying to view the framework folder directly. It does have an .htaccess file in it which says "deny from all". Just make sure you have the correct path for the "yii.php" file inside the framework folder set in the index.php file in your web root.
PHP can include files that are inside "deny from all" folders but you can't browse them directly via a web browser.
Try working through one of tutorials from the start:
http://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app
http://www.larryullman.com/series/learning-the-yii-framework/
I have a plesk panel and root dedicated server on 1and1. I'm using custom programed php script to upload the files and create the folders to server. I have the upload folder named upload_data_folder with the 777 permission.
The scenario is the following:
I want to create folder in my upload_data_folder and than upload files in that newly crated folder. I'm doing this over php script so every file or folder that I create has apache user and the group as the owner.
I'm successfully crate the folder in my upload_data_folder and that folder is owned by apache, has apache as a group and has 777 premission. Then When I try to upload some files to that newly created folder It can't.
I think the problem is with some owner permission but if anyone has some idea what this can be I would be very grateful
It was my custom made script. huuu I solved the problem. The php safe mode was turned on. After I turned it off everything works perfectly.
By default apache document root is /var/www/html/. If plesk is installed document root will have a path like:/var/www/httpdocs for non-secure sites. Thus secure sites are stored in /var/www/httpsdocs.