AWS Subdomain not picking up correct files - php

I am new to AWS and need some help. I have a php website which is hosted on EC2 instance.
Let us say abc.com. However, I also created a subdomain xyz.abc.com.
abc.com has a folder public_html which has a file test.php and xyz.abc.com folder has a file test.php.
Whenever, I am using the url xyz.abc.com/test.php; the file that is getting executed is not the one in xyz.abc.com folder but of abc.com public_html folder. Hence the file that is executed is abc.com/test.php despite I am running xyz.abc.com/test.php.

Related

Not opening folder in localhost

I just installed WAMP server to start practicing PHP. I created a folder in www directory. However, when I try to run the file from localhost it does not run.
For ex, I created a folder "test" in www directory. I saved an php file called "test.php" inside the test folder. Basically I have saved it in www --> test --> test.php.
I started localhost in my browser. I found test folder there. But when I click that test folder, instead of opening as "localhost/test", it is opening as just "test/". How to make sure that the folder, when clicked inside localhost, should open as "localhost/
When I type as "localhost/test" in my browser, it works fine. But when I go to localhost and click on "test" folder it does not open.
Please help me to overcome this.
Thanks in advance
Just create new virtual host in wamp using your current directory path to test directory.

How to correctly transfer folders to 000webhost server from filezilla?

I am a complete beginner at building websites so I apologize if I'm not using the correct terms when describing my problem.
I used filezilla to transfer a website onto my server hosted by 000webhost. I placed the folder with all the files into the public_html folder. When I try to open the site, I get the message :
You see this page because your website doesn't have "index.php" or "index.html" file in public_html folder.
It's able to recognize and process the index.php file when I upload the single file directly into the public_html folder, but not when it's in a folder that's uploaded into the public_html folder. Is it not able to process any of the files within the folder that I uploaded unless I remove them from the folder? Or am I not transferring the folder to the right place?
are you sure you didn't upload the folder itself instead of the "contents" of the folder there ? you need to ensure that, when you browse to the public_html folder on the FTP server (with filezilla) you can see the index.php file as well as other files and subfolders,and not just 1 folder.
i don't know 000webhost, but under public_html, you should have something like this :
public_html
-> index.php
-> other_pages.php
-> images/
-> css/
-> blabla/
and not :
public_html
-> your_folder/ # containing index.php
in filezilla, browse to your folder locally, and "select all files and subfolders" in it, and upload them all to public_html on the server

localhost does not render website, only index of, using mamp

Using mamp, I have my document root set to htdocs folder. Inside that folder I have the folder with the contents for the site. When I connect to localhost, the page that renders is "Index of /" and then a bullet point with the name of the folder within htdocs.
How can I get the full page to render? What am I doing wrong?
A request to localhost looks for files in the htdocs folder. If it doesn't find an index file (html,php,etc) it displays all the folders in the directory. If your website lives at htdocs/mywebsite then you need can view the website at localhost/mywebsite.
Otherwise you can move the entire contents of mywebsite into the htdocs folder itself.
it sounds to me that you have put your files in a folder in the htdocs
so to access you need to point your browser to the folder
instead of localhost/mywebsite
you would need to type localhost/mywebsite/thenameofyourfolder
In MAMP preferences, have you set the root folder to the folder you are attempting to serve?
Ensure your httpd and hosts files are configured correctly too!
nano /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf

Folder structure while hosting a php app

I have a simple php application and I need to host it. I have created a free account in 000webhost.com . They have provided me ftp credentials. In my local machine, the directory structure for the project is as follows:
C/wamp/www/myproject
Also I have placed the framework yii from http://www.yiiframework.com/ in the same path above.
When I log in to ftp for the free server account, I can only see the public_html folder. I do not know where I should place myproject and yii folders to host the project successfully.
I have already created database in this free server space using phpmyadmin.
You have to put the contents of the local folder /myproject in the remote /public_html
just try to upload your files into this folder.
if you upload the whole folder myproject, you have to call it with
http://mydomaingivenbymyprovider.com/myproject

Problem with uploading files on root linux server

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.

Categories