# How to Display phpinfo instead of save it.



## yuhuu (Jan 20, 2010)

i install php5.apache 2.2. help me :\

its display like this:


----------



## yuhuu (Jan 20, 2010)

i use putty. i installed the freebsd on server.


----------



## SirDice (Jan 20, 2010)

You need to configure apache. Make sure the php5 module is loaded.


----------



## yuhuu (Jan 20, 2010)

I am newbie in the FreeBSD. i had configure apache using this:


```
#vi /usr/local/etc/apache22/httpd.conf
#echo 'apache22_enable="YES"'>> /etc/rc/conf
```

and configure apache to use php5 using this:


```
#vi /usr/local/etc/apache22/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
DirectoryIndex index.php index.html
#echo 'accf_http_load="YES"'>>/boot/loader.conf
```

is it not enough yet? is there anything that i miss?


----------



## DutchDaemon (Jan 20, 2010)

Do you have this in httpd.conf?


```
LoadModule php5_module        libexec/apache22/libphp5.so
```

Try [cmd=]httpd -M | grep php[/cmd] to check whether PHP is actually activated or not.


----------



## SirDice (Jan 20, 2010)

Restart apache after you've made changes to httpd.conf.


----------



## yuhuu (Jan 21, 2010)

DutchDaemon : 

Here is the error when i put in httpd.conf


```
LoadModule php5_module        libexec/apache22/libphp5.so
```

i had restart the apache.

httpd: Syntax error on line 104 of /usr/local/etc/apache22/httpd.conf: Cannot lo   ad /usr/local/libexec/apache22/libphp5.so into server: Cannot open "/usr/local/l   ibexec/apache22/libphp5.so"


----------



## DutchDaemon (Jan 21, 2010)

Did you actually build and install the Apache module when you installed lang/php5? That option is *off* by default.

Run [cmd=]make config[/cmd] in /usr/ports/lang/php5 and check. Reinstall with that option *on* if it was off.


----------



## yuhuu (Jan 21, 2010)

I run the make config and had choose the apache option during the installation.


----------



## DutchDaemon (Jan 21, 2010)

If you don't have /usr/local/libexec/apache22/libphp5.so I can only suggest you do it over, as there is really only one source for it:


```
$ pkg_info -W /usr/local/libexec/apache22/libphp5.so
/usr/local/libexec/apache22/libphp5.so was installed by package php5-5.2.12
```


----------



## yuhuu (Jan 21, 2010)

DutchDaemon said:
			
		

> If you don't have /usr/local/libexec/apache22/libphp5.so I can only suggest you do it over, as there is really only one source for it:
> 
> 
> ```
> ...



do it over? do u mean reinstall back?


----------



## DutchDaemon (Jan 21, 2010)

Reinstall lang/php5.


----------



## yuhuu (Jan 21, 2010)

my friends help me. i dont know what he do. tq anyway


----------



## SirDice (Jan 21, 2010)

Do this:

```
pkg_delete -xf php5
cd /usr/ports/lang/php5
make rmconfig
make config (make sure you select the apache module)
make install clean
```


----------



## N74JW (Aug 30, 2010)

*In the same boat*

Hello,

I am in the same boat as the O.P. here is what I have done;

Built and installed Apache, MySQL and PHP from ports. Apache cannot resolve host name because I am not using an Internet-resolvable hostname, i.e. server.domain.local

Install: `cd /usr/ports/lang/php5`
`make config ; make install clean`
`rehash`

Post-install: added 'index.php' to httpd.conf, under the IfModule section.
              added AddType application/x-httpd-php .php and **-source .phps to httpd.conf
              copied php.ini-production to php.ini
              uncommented the session.save_path = "/tmp" in php.ini
              restarted Apache, with only the above error resulting.

I did reinstall PHP per the instructions at the end of this thread. Any idea what to do next? Thanks in advance.


----------



## Terry_Kennedy (Aug 30, 2010)

N74JW said:
			
		

> I am in the same boat as the O.P. here is what I have done;
> 
> [snip]
> 
> I did reinstall PHP per the instructions at the end of this thread. Any idea what to do next? Thanks in advance.



First, let's make sure you have an appropriate php5_module and that it is in the same place as the other Apache modules (this assumes Apache 2.2):


```
(0:33) new-gate:/tmp# cd /usr/local/libexec/apache22/
(0:34) new-gate:/usr/local/libexec/apache22# ls -l *php*
-rwxr-xr-x  1 root  wheel  3770966 Aug 28 19:20 libphp5.so*
(0:35) new-gate:/usr/local/libexec/apache22# ls -l *rewrite*
-rwxr-xr-x  1 root  wheel  164059 Aug 28 18:04 mod_rewrite.so*
```

Obviously, your dates and sizes may vary. If you have rewrite but not php, either php didn't install or it installed somewhere else (I've seen systems get confused when more than one Apache version is installed). If you have php but not rewrite, then your Apache modules are somewhere else and your system is confused. You can use the `# find` command to see where the rest of the modules are, in this case (may take a few minutes to complete while it searches the disk):


```
(0:41) new-gate:/tmp# find /usr -name mod_rewrite.so
/usr/local/libexec/apache22/mod_rewrite.so
```

Now, let's make sure that the necessary config stuff is loaded in httpd.conf. I'll post these as human-parseable diff output. Just open your /usr/local/etc/apache22/httpd.conf and make sure you've got these lines added. The indentation, +, and ! characters are just diff's way of showing changes - don't include them in the config file. Note that there are many, many ways to write Apache configuration files - this is just one way (which I confirmed works here), so try it this way and later you can work on points for style:


```
LoadModule userdir_module libexec/apache22/mod_userdir.so
  LoadModule alias_module libexec/apache22/mod_alias.so
  LoadModule rewrite_module libexec/apache22/mod_rewrite.so
+ LoadModule php5_module libexec/apache22/libphp5.so
 
  <IfModule !mpm_netware_module>
  <IfModule !mpm_winnt_module>

...

  #
  # DirectoryIndex: sets the file that Apache will serve if a directory
  # is requested.
  #
  <IfModule dir_module>
!     DirectoryIndex index.html index.shtml index.php
  </IfModule>
  
  #

...

      # file specified in TypesConfig for specific file types.
      #
      #AddType application/x-gzip .tgz
+     AddType application/x-httpd-php .php
+     AddType application/x-httpd-php-source .phps
      #
      # AddEncoding allows you to have certain browsers uncompress
      # information on the fly. Note: Not all browsers support this.
```

Now, make sure that Apache is restarted and using the new config file: `# /usr/local/etc/rc.d/apache22 restart`

You should see something like this:


```
(0:42) new-gate:/tmp# /usr/local/etc/rc.d/apache22 restart
Performing sanity check on apache22 configuration:
Syntax OK
Stopping apache22.
Waiting for PIDS: 1433.
Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22.
```

If you see any complaints from the sanity check, fix the errors in httpd.conf and try again.

If you don't get any complaints, try accessing a php script on your web server. If it still doesn't work, look in /var/log/httpd-error.log to see if there are any useful error messages in there.


----------

