Opening Yii Application causes download of index.php - php

I recently downloaded Yii in my linux-ubuntu system. After extracting the files to /var/www/vishnu/, I went for creating the first webapp.
What I have done is executing /var/www/vishnu/yii/framework/yiic webapp anyname in my command line. It succesfully created the application under /home/ti/anyname
But whenever I am trying to access it, It downloads the index.php file instead of opening the webapp home page! Why does this happen? I tried, the following Urls..
localhost/vishnu/anyname/ - Returns Not Found
home/ti/anyname/index.php- Downloads the file
home/ti/anyname/index-test.php- Downloads the file
I can see the files in file:///home/ti/anyname/ But can't open anything. When ever I click on it, it is being downloaded! Please share your solutions if you have any...

Thank you very much. I got it from this blog.
I changed the command such that, the webapp will point to my localhost itslef.
ie php /var/www/vishnu/yii/framework/yiic.php webapp /var/www/vishnu/yii/anyname/
Now its working... :)

Related

Laravel CSS files not found and No styling applied (Apache2 Ubuntu)

I have a application know as nexthour cms which I am running using apache2 on ubuntu. I have added all the configuration in apache2 and downloaded all the extensions in php. The nexthour appliaction is based on Laravel. The issue is that there is a server.php file in the root directory. When I ran this file for the first time it went through some steps for installation of the application. Once those steps were done it showed the application but no styling was being shown. The webpage was only showed text when opening server.php file and when I open links like login it takes me to the login page but no styling is applied. When I checked the css file location from source code it shows the path localhost/server.php/css/thecssfile.css but the file is not found.
When I open the public directory all the styling is being applied but the issue here is that it is not able to find the login page when I press login.
When I checked the login page location from server.php file it shows as localhost/server.php/login and it opens fine but still without any styling. Remember that server.php is not a directory it is a php file. Where do I find the login file in the folder as server.php is not a directory?
When I checked the login page location from public/index.php it is localhost/public/login file is not found and I checked the directory and there is no login file or directory.
What should I do in this case? I can not use the server.php file as there is no styling and I can also not use public/index.php as the login page is not found. Please help me out as I a complete noob in laravel or php and this is a application I have downloaded and not developed. Your help will be highly appreciated if someone could let me know whats happening here.
Update: localhost/public/index.php/login works fine but no styling show up here.
Got it all fixed just had to use sudo a2enmod rewrite to resolve this issue.

How Open PHP File

I like to try a simple PHP Project. I installed apache, mysql and phpmyadmin on my computer (linux- fedora). Everything worked fine so far - i can open and log in to phpmyadmin.
I created a simple "Hello World" php file to try. Sadly the browser wont open it. All I get is: "Not Found The requested URL /home/.../test.php was not found on this server." This is the URL into my browser "http://localhost/home/.../test.php"
Since I never worked with php before I figure it's a simple mistake. It seems I have saved the file at the wrong place. From what I have found out I need to save it at /var/www - but I cant find that directory on my computer.
Thank for the help in advance!
Save your File in htdocs folder and then run it in browser. or you can also make other folder inside htdocs folder.
Example: localhost/htdocs/test.php.

Troubles with XAMPP(or?)

I just started taking a PHP course and I'm having a lot of difficulties. I won't get anywhere unless this is resolved.
I got the course files downloaded and added them to htdocs folder but I can't run any new files I created. I get
Object not found! 404 error
I see them under localhost/coursefiles/whtever.php. I've google searched all day but can't find anyone else having this specific problem.
Would uninstalling and reinstalling XAMPP work? This is extremely frustrating and making me crazy.
First Check xampp manager Is your MySQL and Apache is in running state ?
Then Type Localhost in your browser , if Xampp Homepage is Coming It means Xampp is working Fine!
And again Checj your course files Extension they should have .php extension (if they are php files).
Create An folder In your Htdocs Folder With Abc(for example) and Write in browser's Url window "http://Localhost/Abc
if your Folder is opening and it's showing Files Then There must be a Problem with files! :)

PHP 404 Error Message

I have begun learning PHP using an eBook. The following strange results are happening: Per the book I have created two simple PHP files. They are named phpinfo.php and hello.php. Both files show in the user root directory. Both files show when I use the ls command in my mac terminal.
When I try to run them in my browser only the first one runs. The second results in a 404 error, File Not Found. How is this possible? Could an internal file mistake cause this?
Thanks
Thank you all. It was suggested that it would be easier to delete everything including the app and start over. So I did and then downloaded MAMP. That worked.

Using Brackets for PHP files

I currently have wampserver running and I'm trying to do live preview of a php file using Brackets.io. However when I click live preview I'm getting
Project settings for: Getting Started
Live preview base URL: ______________
I'm following this tutorial on running PHP scripts.
My php file is in C:/wamp/wwww/php_proj1/php1.php so I've been trying to put this in my "Base URL"
http://localhost/php_proj1/php1.php
However everytime when I type that and enter it, it just asks me for the "Live Preview Base URL" again and nothing happens. I also tried putting the URL in my 'File->Project settings' and that also didn't work. I'm just running a basic php script that echos some words.
It works when I manually type
http://localhost/php_proj1/php1.php
in my Chrome URL but not when I use Bracets live preview.
What am I missing or doing wrong? Do I need to config anything in my wampserver? I've just started learning php and using wampserver so I'm not entirely sure what I'm doing wrong.
Thanks!
EDIT: I'm following these 2 tutorials on doing this and it's just not working for me.
tutorial 1 and tutorial 2
EDIT2: Found my mistake.. I did not do File->Open Folder to open the folder that I was working on... Thanks to everyone that helped me with this, I will definitely not make this mistake again. sigh
The Live Preview Base Url should be set to the same url that you would use to launch your project in a browser.
So if you have a project in C:/wamp/wwww/php_proj1/ you would launch that project in a browser by entering http://localhost/php_proj1/php1.php therefore that is what Brackets is expecting to be entered into the Base Url field minus the actual script file name.
Remember the DocumentRoot of localhost is pointing to the folder C:/wamp/www/
So enter
http://localhost/php_proj1/
into the dialog that requests the Base Url.
Assuming you are editing the file php1.php at the time you clicked the Live Preview icon that is the script that will be run in the browser.
Oh and of course you have to have WAMPServer and therefore Apache up and running when you do this as it is running the code through Apache so that the PHP code can be interpreted.
Found my mistake. I did not do File->Open Folder to open the folder that I was working on...
Try the same thing but with a simple HTML file.
Try launching your project with PHP's built-in server. Open a terminal/cmd window and go to the folder php_proj1. Now execute php -S localhost:8000. Now set your Live preview path to http://localhost:8000/. If this one does work, then there may be a problem with Wamp.
Now remember that no matter what, you're not supposed to contain a file in the Live Preview path, but only a folder path. When you contain it, you get to this URL: http://server/file.php/file.php (double) and that's not exactly what you want...
If none of these work - there may be a problem with either your computer, Brackets, Chrome, or both. Try to reinstall them (Brackets first).
My two cents, is the name of the project php_proj1 ? If not you'll have to use http://localhost/ as your base URL.
Also (When you are using Brackets) check the content of the Chrome Network tab. F12 Developer Tools -> Network -> Filter -> Documents
Try to investigate the URLs, probably that'll give you some insight

Categories