What am I doing wrong while installing AMP? - php

So I am following TheNewBostons video guide:
https://www.youtube.com/watch?v=vQCIZOv1su0&list=PL6gx4Cwl9DGDdCg0Jli_WTZd5JIliDY62&index=3
(On how to manually install Apache, php and MySQL)
Getting to the 3rd video where I am about to make the "Tuna baby!" php file to test it out I get the error "404 Not Found". I don't have Notepad++ so I am just using Notepad and naming it .php at the end. If I only write localhost is says "It works!", so Apache is working.
Not Found
The requested URL /tuna.php was not found on this server.
The weird thing is that I had no problems while doing this on my main computer but now I am doing it on my laptop and seem to have the problem every time I try doing it. Had to uninstall everything with "Revo Uninstaller" to remove all the traces and so on so this should be a clean install.
Any idea why it is not working?

Installed Notepad++, saved the file properly as a php file and it worked.

Related

Issues when using PHP server in Visual Studio Code with Laragon

I am doing a Full Stack web developing course and I wanted to use the PHP Server extension for Visual Studio Code with Laragon serving as the virtual server. Problem is, when I right click on a .php file on VSC and try to "serve" it, the URL turns into something like this: localhost/laragon/www/IntroduccionPHP_POO_Inicio/namespaces.php, which yields a 404 error page.
If I remove the /laragon/www from the url so it looks like this:
http://localhost/IntroduccionPHP_POO_Inicio/namespaces.php, it works (I mean,
the .php file is loaded correctly) but PHP server doesn't update my page
automatically anymore.
I need to know if there is a way to tell PHP server to ignore the
/laragon/www path. Maybe some configuration that I am not aware of?
Btw, the php files I want to load with PHP Server are added to the VSC
workspace with their full path, which is c:\laragon\www. I don't know if that
is the problem and if so, how to solve it.
You should try to install MAMP or XAMPP instead of this. It will be more helpful. ;-)
MAMP : https://www.mamp.info/en/downloads/
XAMPP : https://www.apachefriends.org/index.html

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! :)

Apache downloads PHP files instead of displaying in browser when called via CMD (Ubuntu)

I've installed LAMP on my Ubuntu laptop with no apparent problems and successfully did the phpinfo() test by navigating to the file through the browser. But the same file is downloaded instead of executing when I'm trying to build from Sublime Text 3 using the following script:
{ "cmd": ["/opt/google/chrome/google-chrome" ,"$file"] }
That worked the first couple of times I tested it, but stopped right after I changed the name of the build system and hasn't been functioning since even after I reversed the change. How would I go about fixing the issue?
$file is "The full path to the current file, e.g., C:\Files\Chapter1.txt.".
Apache isn't causing the file to be downloaded; you aren't requesting it from Apache.
You need to translate $file into a URL on your HTTP server.

iis7 serving .php file

I have a old php applications which was earlier hosted on Apache 2.2. Now I am trying to host it on IIS 7.5. I installed php with WebPlatform installer. Then copied directory to inetpub\wwwroot folder. Added this directory as application in IIS. But when I browse search.php, it pops up save as file dialog in the browser - asking to save the file. Instead should return the html response which browser can show.
If put sample index.php with phpInfo() in it. It works properly but not the acutal PHP files. Have I missed any steps?
Any php guys out there? I tried reinstalling, even with xampp, but no luck :(
You have installed it but might not be configured properly. You should follow instructions over here

Apache doesn't execute my copied PHP files, but testing.php works

I've just installed LAMP on my Ubuntu 9.10 machine, and everything works fine except when I copy my PHP files from another computer.
The LAMP guides I've followed also made me create a phpinfo() test file, which works, but when I try to type in e.g. index.php absolutely nothing happens - just a blank page in FireFox. :(
The files are in the exact same directory.
I'm thinking it's probably something with permissions and so on, but since I'm new to both PHP and Ubuntu, I'm kind of lost. It's like I can't create a PHP file with my file browser, but only by using the terminal - like when I created the testing.php from the LAMP guide.
Whaddayaknow... I made an error, tried to:
echo "Hello" world
which, even though I'm a PHP noob, I clearly know is wrong.
I think I'll have to figure out how to enable some sort of error reporting, a blank page is clearly not good enough.
You mean you have a index.php (copied from another computer) and a test.php (edited by hand, with a call to phpinfo()) in the same apache directory, the second works from your browser and the first doesnt ?
That can be a permission issue, or some compilation error in your php.
About permissions, for files should be readable from the apache server (more precisely, form the user that runs the apache server). You can type chmod a+r index.php.
YOu can also check your apache error logs (location dependent on installation). In any case it's vital to know where the error logs are if your are developing a web site.

Categories