Windows 8.1 Apache 2.4.20
PHP 5.5.15
When I run a php file only the code shows in the browser (chrome). I searched all over the internet but find no solutions. I tried altering the apache config with no success. Please help
Are you going through a fully qualified domain url? Or simply attempting to open a php file by double clicking or using the Open File option from the browsers file menu?
----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
Thanks for answering so quickly. I downloaded xammp from apache and friends. Using local host. I just sent a simple PHP file:
<?php
echo "PHP works";
?>
The output on the browser shows the code and not (PHP works)
I've been all over the internet and can't find a solution please help.
----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
I did not realize this was on Windows. You can remove the line I posted above, as that is the Path for Unix installations.
In any case, make sure your php file is executable, right clicking on the file, and setting the permissions for the Apache user to read, write, and execute.
Also, make sure you are opening your files similar to
in your browser, rather than file:///c:/xamp/htdocs/filename.php
----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
When I typed it in the way you said I got access forbidden error (no permission) Error 403. But the application I'm using is Laravel. Do I need to adjust the Apache config and localhost to point to the htdocs directory?
Applications (or Frameworks) are either installed in subdirectories of htdocs or you add Aliases to apaches httpd.conf pointing to other directories. This seems to be done already, otherwise you would only get 404 not found errors, not permission errors. If you started Apache as service, the account used by apache will need permissions to the Laravel directory. It may be easier to install Laravel into htdocs, as that inherits permissions.
If you start learning, you may start off with pure PHP first, and maybe a few basics about Windows file system permissions, services and system accounts?
It may be easier fpr you to find hosting including a preinstalled apache,php and Laravel.
I have full permissions set for both htdocs and laravel directories. At this point all I would like to do is make a simple PHP file and get apache to recognize it. I'm not familiar on how to start Apache as a service I a merely use a gui control pane. I do have artisan running as a service but the problem appears where it's running or not.
----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
>I have full permissions set for both htdocs and laravel directories
There often is a simple misunderstanding about Windows file system permissions. If you add the "account" All/everyone, this doesn't include some Windows system accounts. Anyway, this mostly only plays a role, if you run Apache as a service, if you start a normal process from the Xampp panel it'll run with your account and privileges.
As Vacunita said Apache itself will be configured for htdocs by default, so what did you actually do in apache config?
Xampp installs both apache and php and you just have to start Apache and php is executed, the whole xampp administrative panel you see when browsing
Then apache doesn't run. If you install xampp you get a xampp control panel installed, from where you can start apache http server, mysql database, filezilla ftp server (if installed) and mercury mail server (if installed). Look out for that and start apache from there.
After a normal install of XAMPP the htdoc will be configured and permissions granted and there is nothing to do but start apache. So uninstall and reinstall.
If 64bit systems could only run 64bit software you'd not have much more than the OS.
As far as I see there is no 64bit version of XAMPP downloads and you don't need one.
When you install change install location to C:\XAMPP for example or any other directory outside of program files, as system folders are only writable for setup via elevated priviliges during installs.
Also don't change any of the defaults. If asked whether to install Apache as service, don't, that also adds to the problem of htdocs access, as already said. By default two normal apache processes running with your own user account will be started by the xampp control panel, one for http, one for https.
If it still doesn't work, maybe something else on your system is already making use of port 80, eg IIS.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.