1
votes

It's my first webpage and everything was ok until I had to set up server and install PHP to star coding the back end part.

I installed MySQL 1.4, Visual Studio 2015, VC14, Apache 2.4 and PHP 7.1.

MySQL is running as well as Apache. I was able to open localhost:8080 with the message "It works" but when I try localhost:8080/test.php it opens a 404 page not found.

The error log in Apache folder says:

[php7:error] [pid 3276:tid 956] [client ::1:65240] script 'C:/Apache24/htdocs/test.php' not found or unable to stat

The test.php file is on Apache24/htdocs.

I've already tried so many options, installed and deinstalled versions of PHP, Visual Studio, and nothing. Thank you for helping me.

Here is the httpd file which I edited:

  1. I added those 4 line at the beginning:

    AddHandler application/x-httpd-php .php AddType application/x-httpd-php .php .html LoadModule php7_module "c:/php7/php7apache2_4.dll" PHPIniDir "c:/php7"

  2. Definde the SeverRoot:
    Define SRVROOT "c:/Apache24" ServerRoot "c:/Apache24"

  3. Changed the Listen port
    Listen 8080

  4. List item

    Changed the ServerName localhost: ServerName localhost:8080

  5. DocumentRoot
    DocumentRoot "c:/Apache24/htdocs" "c:/Apache24/htdocs">

1
ServerName needs to be domain (without port).Tajgeer
did you check the file permissions to make sure apache can read test.php ?A. Onder
@Tajgeer I removed :8080 and still not workingTainara Freitas
Did you try getting any other resource from the same directory, a picture, an HTML file, text file , ..etc ?Accountant م
@AccountantمBefore installing Apache I was testing my webpage by using node. I alwayd had to open cmd > cd -folder- > http-server then the page localhost:8080/.....html and it was working pretty well. Now even this method works since I installed MySql and ApacheTainara Freitas

1 Answers

0
votes

put your test.php at folder XAMPP/htdocs. XAMMP Panel, turn on Apache and MySQL. Then open your browser and type localhost/test.php