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
Related
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.
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
I have Joomla installed in my computer, but recently have been writing php files that aren't related to the Joomla-managed site. For some reason, when I try to open those php files in the web browser using xampp (note: Joomla also is using xampp), the browser doesn't process the code w/in the tags as php code.
For example, after opening a basic page (a page with title "test", no content except in the body tags) in the web browser and going to the source code, the following is shows up in the source code:
<body>
<?php echo "hello"; ?>
</body>
instead of the HTML conversion. (i.e. just "hello")
Does anyone have an idea about what's going on here?
Thanks.
It's probably because PHP module isn't loaded in your apache. Be sure it is enabled
PHP is interpreted in the server, not the browser. Whatever's going wrong, you need to look at the SERVER side to resolve it.
My first guess: maybe you didn't suffix the file ".php" (so the server doesn't recognize it as a PHP file?)
Second guess: is the directory containing your PHP files configured to parse PHP?
If you have Joomla, you probably have PHP. You probably also have Apache.
So check your Apache configuration, and check your file naming conventions.
Is the file extension .php? The server doesn't magically know when you're serving php files, this is a good way to ensure it knows what you're doing.
Apache is looking into your localhost's defined root directory for files it can parse. In this case htdocs. This is the default for XAMPP. As far as Apache is concerned, it will not interpret any files outside of that folder.
if the problem in php module it better to re install php5 in to the system and it will work fine. probably the problem is in php module you should try re installing php in your system.
Just restart httpd service. It will work fine.
sudo systemctl restart httpd.service
if it has not worked please reinstall PHP once again.
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.
I am trying to run web application scripted in PHP on windows server 2008. I have configured PHP (as fastcgi) and IIS. Everything goes fine except the following scenario.
In the php.ini document "doc_root" edited with the correct root path for my php projects which is "c:\inetpub\wwwroot\". I created a new site on IIS and mapped it's path to "c:\inetpub\wwwroot\application1". When I try to open this site, I see that somehow (IIS or PHP no idea ) does nt run my new application on the path "c:\inetpub\wwwroot\application1". It tries to run on "c:\inetpub\wwwroot\", which returns 404 of course. What am I missing here ?
Check to see whether you are changing and loading Correct php.ini file using phpinfo()
For those who have the same problem;
I have figured out the problem. setting "doc_root" is not right. As I commented that property in php.ini file it got ok.
Also checking the following url was helpful:
http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7/
Its written there that you can make your php web sites use seperate php.ini files. I found this link really usefull.
Don t want to choose my answer as the right one but have to. Hope this helps.