# Apache error



## aadryaan94 (Oct 2, 2013)

```
===>  Patching for p5-Locale-gettext-1.05_3
===>  Applying FreeBSD patches for p5-Locale-gettext-1.05_3
===>   p5-Locale-gettext-1.05_3 depends on file: /usr/local/bin/perl5.14.4 - found
===>   p5-Locale-gettext-1.05_3 depends on shared library: intl - found
===>  Configuring for p5-Locale-gettext-1.05_3
checking for gettext... no
checking for gettext in -L/usr/local/lib -lintl -I/usr/local/include... no
gettext function not found. Please install libintl at ./Makefile.PL line 18.
*** [do-configure] Error code 2

Stop in /usr/ports/devel/p5-Locale-gettext.
*** [build-depends] Error code 1

Stop in /usr/ports/misc/help2man.
*** [install] Error code 1

Stop in /usr/ports/misc/help2man.
*** [build-depends] Error code 1

Stop in /usr/ports/devel/autoconf.
*** [build-depends] Error code 1

Stop in /usr/ports/www/apache22.
*** [install] Error code 1

Stop in /usr/ports/www/apache22.
*** [build-depends] Error code 1

Stop in /usr/ports/lang/php55.
*** [install] Error code 1

Stop in /usr/ports/lang/php55.
root@mt2underworld:/usr/ports/lang/php55 #
```


----------



## SirDice (Oct 2, 2013)

On what version of FreeBSD?


----------



## DutchDaemon (Oct 2, 2013)

You should probably rebuild devel/gettext recursively. It's a known killer to skip a recursive gettext upgrade. You'll find several examples in /usr/ports/UPDATING. Try doing that before _anything_ else.


----------



## aadryaan94 (Oct 2, 2013)

9.1. I try to install php5, php53, php55 and nothing.


----------



## DutchDaemon (Oct 2, 2013)

Conflicting PHP versions will just make you sink faster.


----------



## aadryaan94 (Oct 2, 2013)

Can you tell me how to fix this error?


----------



## DutchDaemon (Oct 2, 2013)

Reading /usr/ports/UPDATING is hardly hard work. Use `# portupgrade -rf gettext` or `# portmaster -r gettext`, depending on what you use. This may not solve the problem, but this is a known cause of many other problems. As soon as you see any error with the word gettext, recursively reinstall gettext.


----------



## aadryaan94 (Oct 2, 2013)

```
root@mt2underworld:/usr/ports/lang/php55 # portupgrade -rf gettext
portupgrade: Command not found.
root@mt2underworld:/usr/ports/lang/php55 # portmaster -r gettext
portmaster: Command not found.
```

[size=-1]Don't work.[/size]
It doesn't work.


----------



## wblock@ (Oct 2, 2013)

ports-mgmt/portmaster or ports-mgmt/portupgrade must be installed before they can be used.  They are ports, just like other applications.


----------



## DutchDaemon (Oct 2, 2013)

If you do not use any tool to manage your ports you're more or less out of luck. Just running an indiscriminate `make install` everywhere will get you in trouble sooner or later.


----------



## aadryaan94 (Oct 2, 2013)

This is a virtual machine, I have installed only FreeBSD 9.1 and MySQL, and *I* use `make install clean`. So how can I install Apache and PHP on this machine?


----------



## DutchDaemon (Oct 2, 2013)

My reply stands.


----------



## aadryaan94 (Oct 2, 2013)

I don't understand...


----------



## wblock@ (Oct 2, 2013)

Apache and PHP are normal ports.  If the install of a port fails, it means something is wrong.  Finding the problem can be tricky, but is often due to poor procedure.  The error shown in post #1 implies that devel/gettext is not installed.  The ports system would normally have installed that as a dependency, so something has gone wrong.

Using ports-mgmt/portmaster will automatically handle a lot of the work.  Install it, then use it as shown above.

Installing Applications: Packages and Ports
Upgrading FreeBSD Ports


----------



## aadryaan94 (Oct 2, 2013)

```
To install the port: cd /usr/ports/ports-mgmt/portmaster/ && make install clean
To add the package: pkg_add -r portmaster
```
Done! But:

```
root@mt2underworld:/usr/ports/lang/php53 # portmaster -r gettext

===>>> /var/db/pkg/gettext does not exist
===>>> Aborting update

===>>> Killing background jobs
Terminated
===>>> Exiting
root@mt2underworld:/usr/ports/lang/php53 # make install clean
===>   php53-5.3.27 depends on file: /usr/local/sbin/apxs - not found
===>    Verifying install for /usr/local/sbin/apxs in /usr/ports/www/apache22
===>   apache22-2.2.25 depends on file: /usr/local/bin/autoconf-2.69 - not found
===>    Verifying install for /usr/local/bin/autoconf-2.69 in /usr/ports/devel/autoconf
===>   autoconf-2.69 depends on executable: gm4 - found
===>   autoconf-2.69 depends on executable: help2man - not found
===>    Verifying install for help2man in /usr/ports/misc/help2man
===>   help2man-1.43.3 depends on package: p5-Locale-gettext>=0 - not found
===>    Verifying install for p5-Locale-gettext>=0 in /usr/ports/devel/p5-Locale-gettext
===>   p5-Locale-gettext-1.05_3 depends on file: /usr/local/bin/perl5.14.4 - found
===>   p5-Locale-gettext-1.05_3 depends on shared library: intl - found
===>  Configuring for p5-Locale-gettext-1.05_3
checking for gettext... no
checking for gettext in -L/usr/local/lib -lintl -I/usr/local/include... no
gettext function not found. Please install libintl at ./Makefile.PL line 18.
*** [do-configure] Error code 2

Stop in /usr/ports/devel/p5-Locale-gettext.
*** [build-depends] Error code 1

Stop in /usr/ports/misc/help2man.
*** [install] Error code 1

Stop in /usr/ports/misc/help2man.
*** [build-depends] Error code 1

Stop in /usr/ports/devel/autoconf.
*** [build-depends] Error code 1

Stop in /usr/ports/www/apache22.
*** [install] Error code 1

Stop in /usr/ports/www/apache22.
*** [build-depends] Error code 1

Stop in /usr/ports/lang/php53.
*** [install] Error code 1

Stop in /usr/ports/lang/php53.
root@mt2underworld:/usr/ports/lang/php53 #
```


----------



## SirDice (Oct 3, 2013)

`portmaster lang/php53`


----------



## aadryaan94 (Oct 3, 2013)

Done. Apache and PHP were installed. But *I* can't connect to the MySQL database.

http://93.113.163.132/phpinfo.php
http://93.113.163.132/


----------



## SirDice (Oct 3, 2013)

You really shouldn't post that. The whole world now knows you have an unpatched 9.1-RELEASE.


----------



## aadryaan94 (Oct 3, 2013)

How I can resolve this "error"?


----------



## SirDice (Oct 3, 2013)

What error?


----------



## aadryaan94 (Oct 3, 2013)

Blank page.


----------



## SirDice (Oct 3, 2013)

Perhaps you should look in /var/log/httpd-error.log?


----------



## DutchDaemon (Oct 3, 2013)

Did you configure Apache and PHP to actually work with MySQL? Are the modules loaded correctly? This is a setup that has been documented in numerous places, also on the forums. How did you configure Apache, PHP and MySQL to actually talk to each other?


----------



## aadryaan94 (Oct 3, 2013)

I have installed Apache, MySQL. All is good. But, *I* installed PHP (*I* used this guide):


```
cd /usr/ports/lang/php53 && make install clean

Make sure you select to build the apache module.






â€¢FreeBSD 9.1-RELEASE
â€¢apache22-2.2.24
â€¢mysql-server-5.5.30
â€¢php5-5.4.11
â€¢php5-extensions-1.7
â€¢phpMyAdmin-3.5.7
â€¢WordPress v3.5.1


Install Apache 

Navigate to the Apache server port and build it:




cd /usr/ports/www/apache22 && make install clean 

Once Apache has been successfully installed, add the following line to /etc/rc.conf so that the Apache server will start automatically at system boot. 




echo 'apache22_enable="YES"' >> /etc/rc.conf 

Now letâ€™s start Apache to make sure it works:




/usr/local/etc/rc.d/apache22 start 

Point your web browser to the host name or IP address of the FreeBSD host youâ€™ve installed Apache on and you should see the venerable â€œIt Works.â€





Install PHP

Next, weâ€™ll build PHP. Before we proceed, however, we need to add a configuration option so that PHP build includes support for the Apache server. Start with the following commands:




cd /usr/ports/lang/php5 


make config 

A menu should come up allowing you to select/deselect various build options. You should select â€œBuild Apache moduleâ€ by highlighting the option with the arrow keys and hitting the space bar, then hit Enter, which should bring you back to the command prompt. Now proceed with building the port:




make install clean 

Now letâ€™s add the requisite extensions to PHP to round out its capabilities. Before we build this port though weâ€™ll want to add support for both MySQL and MySQLi (an improved interface to MySQL) in order to communicate with the MySQL server. 




cd /usr/ports/lang/php5-extensions/ 


make config 

In the corresponding menu you should select â€œMySQL database supportâ€ and â€œMySQLi database support,â€ then proceed with building the port:




make install clean 





Configuration

Now that we have the requisite ports built and installed itâ€™s time to configure them. First, letâ€™s create the file /usr/local/etc/php.ini to hold our PHP options. The simpliest way to do this is to copy the file /usr/local/etc/php.ini-development which will add the default settings for new PHP installations. This configuration is suitable for development purposes, but NOT necessarily for production purposes. If your plans include a production server, then among other things, and before going online with your site, you should consider copying /usr/local/etc/php.ini-production instead and consult the recommendations at http://php.net/manual/en/security.php. 




cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini 

Now letâ€™s configure Apache. Open the file /usr/local/etc/apache22/httpd.conf in your favorite editor and look for the following line:




DirectoryIndex index.html 

And change it so it reads as follows:




DirectoryIndex index.html index.htm index.php 

Then append the following lines to the end of the file in order to support PHP files as well as phpMyAdmin, which normally lives outside of the Apache document root. Note: if you elected not to install phpMyAdmin, then you need only add the two AddType lines:








1 AddType application/x-httpd-php .php 


2 AddType application/x-httpd-php-source .phps 




Include etc/apache22/extra/httpd-languages.conf 

Then open the language settings file /usr/local/etc/apache22/extra/httpd-languages.conf and add the following line to the end of the file:




AddDefaultCharset On 

Now restart Apache:




/usr/local/etc/rc.d/apache22 restart
```

Works, but *I* can't connect to the MySQL database.


----------



## chatwizrd (Oct 3, 2013)

A blank page usually means there are PHP errors causing it not to load. You really need to follow the advice of @SirDice and look at what is in the file /var/log/httpd-error.log. It probably is displaying some errors causing the page not to load correctly.


----------



## aadryaan94 (Oct 3, 2013)

Not really:

```
[Thu Oct 03 16:36:32 2013] [error] [client 86.126.9.103] File does not exist: /usr/local/www/apache22/data/favicon.ico, referer: http://93.113.163.132/
[Thu Oct 03 17:22:21 2013] [error] [client 107.1.17.23] PHP Warning:  phpinfo() [<a href='function.phpinfo'>function.phpinfo</a>]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Helsinki' for 'EEST/3.0/DST' instead in /usr/local/www/apache22/data/phpinfo.php on line 2, referer: http://forums.freebsd.org/showthread.php?t=42260
[Thu Oct 03 17:22:24 2013] [error] [client 107.1.17.23] File does not exist: /usr/local/www/apache22/data/favicon.ico
```


----------



## aadryaan94 (Oct 3, 2013)

Nobody? I need this "option" on my virtual machine.


----------



## SirDice (Oct 4, 2013)

We don't know what's wrong just by looking at a blank page. We don't know what script does the connection to your MySQL database. We don't even know if MySQL is running properly. If you don't supply any information we can't really help you. We're good but we're not clairvoyant, we have no idea what you are trying and can't look on your screen. Supply some information and we may be able to find the error.


----------



## aadryaan94 (Oct 4, 2013)

Ok. When I try to connect from other server, it works! But from my server it doesn't work. MySQL is good, but I have a problem with PHP.


----------



## freethread (Oct 4, 2013)

aadryaan94 said:
			
		

> Not really:
> 
> ```
> [Thu Oct 03 16:36:32 2013] [error] [client 86.126.9.103] File does not exist: /usr/local/www/apache22/data/favicon.ico, referer: http://93.113.163.132/
> ...


 
Normally the above arrors are only warnings, check your php.ini if any, it should be located in /usr/local/etc directory. You also need to set the PHP log file, by default (if I'm not wrong) it's not created untill you set a valid location (directory) with right permissions (www user) and set newsyslog to rotate it (and Apache logs too) or your drive will be full in few days (depending on your server traffic and drive capacity).

That sort of "errors" are related to Apache httpd, MySQL server and PHP configuration, not to FreeBSD OS or any other OS, read their respective installation/configuration manuals or at least ask a specific question as @DutchDaemon suggested.


----------

