# PHP not working



## ssppmm (Nov 19, 2020)

Hello, I'm trying to install Joomla on FreeBSD 12.1, but when I copy my server's IP on my client's browser, it shows the content of that file, but not Joomla's page, how can I fix it?

As you can see in the next code, it shows me the content of index.php but not Joomla's page.

I hope someone helps me, please.
Thank you.
 index.php 

```
<?php
/**
* @package    Joomla.Installation
*
* @copyright  Copyright (C) 2005 - 2020 Open Source Matters, Inc. All rights reserved.
* @license    GNU General Public License version 2 or later; see LICENSE.txt
*/

/**
* Define the application's minimum supported PHP version as a constant so it can be referenced within the application.
*/
define('JOOMLA_MINIMUM_PHP', '5.3.10');

if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<'))
{
    die('Your host needs to use PHP ' . JOOMLA_MINIMUM_PHP . ' or higher to run this version of Joomla!');
}

/**
* Constant that is checked in included files to prevent direct access.
* define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);

// Bootstrap the application
require_once __DIR__ . '/application/bootstrap.php';

// Get the application
$app = JApplicationWeb::getInstance('InstallationApplicationWeb');

// Execute the application
$app->execute();
```


----------



## SirDice (Nov 19, 2020)

Title has nothing to do with the issue. And please, don't post pictures of text. 


```
# pkg info -D mod_php74
mod_php74-7.4.12:
On install:
******************************************************************************

Make sure index.php is part of your DirectoryIndex.

You should add the following to your Apache configuration file:

<FilesMatch "\.php$">
    SetHandler application/x-httpd-php
</FilesMatch>
<FilesMatch "\.phps$">
    SetHandler application/x-httpd-php-source
</FilesMatch>

******************************************************************************

If you are building PHP-based ports in poudriere(8) or Synth with ZTS enabled,
add WITH_MPM=event to /etc/make.conf to prevent build failures.

******************************************************************************
```


----------



## ssppmm (Nov 19, 2020)

SirDice said:


> Title has nothing to do with the issue. And please, don't post pictures of text.
> 
> 
> ```
> ...


In directory /usr/local/etc/apache24/Includes/php.conf I have this:

```
<IfModule dir_module>
    DirectoryIndex index.php index.html
    <FilesMatch "\.php$">
        SetHandler application/x-httpd-php
    </FilesMatch>
    <FilesMatch "\.phps$">
        SetHandler application/x-httpd-php-source
    </FilesMatch>
</IfModule>
```
But I'm not sure if it's like this, because I have only followed the steps of a web page


----------



## SirDice (Nov 19, 2020)

Move that file to /usr/local/etc/apache24/modules.d/001_php.conf. And restart Apache. Then look for issues in /var/log/httpd-error.log


----------



## ssppmm (Nov 19, 2020)

I get all of this issues but I don't know it 

```
[Wed Nov 18 19:26:06.617392 2020] [mpm_prefork:notice] [pid 2164] AH00163: Apache/2.4.46 (FreeBSD) configured -- resuming normal operations
[Wed Nov 18 19:26:06.617894 2020] [core:notice] [pid 2164] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Wed Nov 18 19:36:20.576660 2020] [mpm_prefork:notice] [pid 2164] AH00169: caught SIGTERM, shutting down
[Wed Nov 18 19:36:21.202021 2020] [mpm_prefork:notice] [pid 2268] AH00163: Apache/2.4.46 (FreeBSD) configured -- resuming normal operations
[Wed Nov 18 19:36:21.202190 2020] [core:notice] [pid 2268] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Wed Nov 18 20:11:06.008984 2020] [mpm_prefork:notice] [pid 2268] AH00169: caught SIGTERM, shutting down
[Wed Nov 18 20:11:06.158300 2020] [mpm_prefork:notice] [pid 23249] AH00163: Apache/2.4.46 (FreeBSD) configured -- resuming normal operations
[Wed Nov 18 20:11:06.158698 2020] [core:notice] [pid 23249] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Thu Nov 19 09:35:30.497667 2020] [mpm_prefork:notice] [pid 23249] AH00171: Graceful restart requested, doing restart
[Thu Nov 19 09:35:30.612793 2020] [mpm_prefork:notice] [pid 23249] AH00163: Apache/2.4.46 (FreeBSD) configured -- resuming normal operations
[Thu Nov 19 09:35:30.612808 2020] [core:notice] [pid 23249] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Thu Nov 19 11:53:10.752255 2020] [mpm_prefork:notice] [pid 23249] AH00171: Graceful restart requested, doing restart
[Thu Nov 19 11:53:10.856431 2020] [mpm_prefork:notice] [pid 23249] AH00163: Apache/2.4.46 (FreeBSD) configured -- resuming normal operations
[Thu Nov 19 11:53:10.856445 2020] [core:notice] [pid 23249] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Thu Nov 19 11:53:58.943298 2020] [mpm_prefork:notice] [pid 23249] AH00171: Graceful restart requested, doing restart
[Thu Nov 19 11:53:58.950997 2020] [mpm_prefork:notice] [pid 23249] AH00163: Apache/2.4.46 (FreeBSD) configured -- resuming normal operations
[Thu Nov 19 11:53:58.951014 2020] [core:notice] [pid 23249] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Thu Nov 19 12:54:27.851783 2020] [mpm_prefork:notice] [pid 1078] AH00163: Apache/2.4.46 (FreeBSD) configured -- resuming normal operations
[Thu Nov 19 12:54:27.884047 2020] [core:notice] [pid 1078] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Thu Nov 19 12:55:37.771575 2020] [mpm_prefork:notice] [pid 1078] AH00169: caught SIGTERM, shutting down
[Thu Nov 19 12:55:37.844482 2020] [mpm_prefork:notice] [pid 1492] AH00163: Apache/2.4.46 (FreeBSD) configured -- resuming normal operations
[Thu Nov 19 12:55:37.844767 2020] [core:notice] [pid 1492] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
```


----------



## SirDice (Nov 19, 2020)

Those are normal start en stop messages.


----------



## ssppmm (Nov 19, 2020)

SirDice said:


> Esos son mensajes normales de inicio y fin.



And you don't know why doesn't it work?


----------



## SirDice (Nov 19, 2020)

Can't tell from the provided information. Did you name it 001_php.conf? The naming convention is rather strict:

```
# Third party modules
IncludeOptional etc/apache24/modules.d/[0-9][0-9][0-9]_*.conf
```

And how did you add the website? Did you modify httpd.conf? Or did you create a proper virtualhost configuration in apache24/Includes?



ssppmm said:


> I have only followed the steps of a web page


Please post that link here too, so we can check if that information is correct or not.

[_Mod: Changed the title of the thread, the original title had nothing to do with the problem_]


----------



## ssppmm (Nov 19, 2020)

I don't know what you mean, I'm so noob, do you refer where I created my subdomain's folder? I created it in usr/local/www/apache24/data it would look like  usr/local/www/apache24/data/subdomain_folder, shall I created my folder's domain on modules.s?

To add  the following, I put into /usr/local/etc/apache/extra/httpd-vhosts.conf

```
<VirtualHost *:80>
          DocumentRoot /usr/local/www/apache24/data/subdomain_folder
          ServerName subdomain
          ServerAdmin 
      
    <Directory "">
       DirectoryIndex index.html index.php
       Options FollowSymLinks
       AllowOverride All
       Require all granted
    </Directory>
    </VirtualHost>
```
I think I followed the steps of this page https://computingforgeeks.com/how-to-install-php-7-3-on-freebsd-12/, but I'm not sure, sorry.


----------



## anlashok (Nov 19, 2020)

Looking at that page, you have probably only installed PHP itself. You will also need to install the Apache module that uses PHP to render the page, mod_php74

```
pkg install mod_php74
```


----------



## SirDice (Nov 19, 2020)

ssppmm said:


> I created it in usr/local/www/apache24/data


Don't do it there, it's part of the default Apache configuration, leave that as-is. Create a /usr/local/www/mysite directory to place your website in and configure the `DocumentRoot` accordingly. 



ssppmm said:


> To add the following, I put into /usr/local/etc/apache/extra/httpd-vhosts.conf


Not there. Create a /usr/local/etc/apache24/Includes/mysite.conf and put that configuration in there. Place a configuration file there for each website you want to run. The virtualhost configuration itself looks fairly good. Except you used an Apache 2.2 style access-control and the `Directory` should point to your `DocumentRoot`. 


```
<VirtualHost *:80>
  DocumentRoot /usr/local/www/mysite
  ServerName mysite.example.com
  ServerAdmin admin@example.com
      
  <Directory /usr/local/www/mysite>
    DirectoryIndex index.html index.php
    Options FollowSymLinks
    Require all granted
  </Directory>
</VirtualHost>
```


----------



## ssppmm (Nov 19, 2020)

SirDice said:


> Don't do it there, it's part of the default Apache configuration, leave that as-is. Create a /usr/local/www/mysite directory to place your website in and configure the `DocumentRoot` accordingly.
> 
> 
> Not there. Create a /usr/local/etc/apache24/Includes/mysite.conf and put that configuration in there. Place a configuration file there for each website you want to run. The virtualhost configuration itself looks fairly good. Except you used an Apache 2.2 style access-control and the `Directory` should point to your `DocumentRoot`.
> ...


I'll try it tomorrow and I'll let you know if it works, thank you so much for your help!


----------



## ssppmm (Nov 19, 2020)

anlashok said:


> Looking at that page, you have probably only installed PHP itself. You will also need to install the Apache module that uses PHP to render the page, mod_php74
> 
> ```
> pkg install mod_php74
> ```


Yes! You're right, I didn't have it installed, thank you!


----------



## ssppmm (Nov 19, 2020)

SirDice said:


> Don't do it there, it's part of the default Apache configuration, leave that as-is. Create a /usr/local/www/mysite directory to place your website in and configure the `DocumentRoot` accordingly.
> 
> 
> Not there. Create a /usr/local/etc/apache24/Includes/mysite.conf and put that configuration in there. Place a configuration file there for each website you want to run. The virtualhost configuration itself looks fairly good. Except you used an Apache 2.2 style access-control and the `Directory` should point to your `DocumentRoot`.
> ...


Following your steps, I get "The requested URL was not found on this server"


----------

