Yii "framework" sub-folder not visible from apache? [error 403] - php

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/

Related

Why does my Notepadqq editor does not recognize LAMP www folder and sub-folders?

Attempting to get LAMP working on my 32-bit Ubuntu 18.04 machine. I believe the set-up is close to correct. I have all Apache2, mysql, and PHP software installed. I have an index.php file located in folder /var/www/bookcorner directory which shows up as it should if I enter localhost/index.php in the browser address bar. This file may be edited in nano while saving the changes. However, I cannot use my editor Notepadqq (or presumably others) to edit the file.
Going through the file manager, I can select the file and open it in Notepadqq, but I cannot save it. I get the error, "folder does not exist". If I try a 'Save As' with Notepadqq, I do not see any folders past /var in the directory structure, though they obviously exist. The www folder and subfolders do not show up in Notepadqq.
There are three folders under /var/www which are
bookcorner
html
michaelsbookcorner.com
I have ownership of all of these folders
michaelsbookcorner.com is a live site at Infinityfree.net
I somehow got Apache2 to point to bookcorner for now which is fine. Eventually I would like to select between different websites but I only have one for now existing in another directory. I wish to begin utilizing LAMP rather than uploading PHP files to my hosting site all the time.
What settings/permissions/etc could I have missed here in order to get this working properly?

How to run PHP files on XAMMP on A Mac

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.

PHP can't copy file to Dropbox folder in Windows

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.

php url and folder name

I just installed the latest MAMP on Mac, and found this hard to understand:
The document root seems to be "~/MAMP/htdocs", because "localhost" will open the index.php file under this folder.
However, "localhost/MAMP/?language=English" opens "~/MAMP/bin/mamp/index.php". I know that in URL strings between "/"s are not necessaries folders, but if they are not folders, how was it constructed and how does the system know where to find the right files?
I know this is a pretty basic question which I can probably get answers by myself, but I don't know what key word to search. Tried "php url construction" and "php url folder" but no luck. So a proper keyword suggestion is also appreciated.
It is setup by default by MAMP. If you open up MAMP/conf/apache/httpd.conf in a text editor and scroll down to around line 368/369 and specifically line 408 you will see that it is an Apache Alias. it is setup for easy navigation, instead of having to type http://localhost:8888/bin/mamp you can just type http://localhost:8888/MAMP. It is also setup as an Alias to ensure that you can still access the web tools if you change the document root from something other than /Applications/MAMP/htdocs.
Are you sure http://localhost:8888 has the docroot set to ~/MAMP/htdocs as you suggest? Reason I ask is that looking at your first image the text says the docroot is /Applications/MAMP/htdocs. Also the docs say it should be in the /Applications/MAMP/htdocs. I think the issue is that you do not have MAMP in the Applications folder where it needs to be.
https://www.mamp.info/en/documentation/
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:
Also please note this https://www.mamp.info/en/documentation/#q8
Will MAMP work if the MAMP folder is not located in the Applications
directory?
No. In order to work properly the MAMP folder has to be located in the
Applications folder.

Security risk in setting PHP file permissions to full

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.

Categories