pkgin search ap24-php pkgin install ap24-php73-7.3.6nb2 calculating dependencies...done. 2 packages to install: php-7.3.6 ap24-php73-7.3.6nb2 0 to refresh, 0 to upgrade, 2 to install 0B to download, 47M to install proceed ? [Y/n] Y installing php-7.3.6... php-7.3.6: copying /usr/pkg/share/examples/php/php.ini-production to /usr/pkg/etc/php.ini =========================================================================== $NetBSD: MESSAGE,v 1.1 2018/12/15 17:12:44 taca Exp $ To process PHP scripts, you will need a PHP-enabled HTTP server. You may either configure the HTTP server to use the PHP CGI binary located in /usr/pkg/libexec/cgi-bin/php or you may install a PHP module for your HTTP server, e.g. www/ap-php. =========================================================================== installing ap24-php73-7.3.6nb2... =========================================================================== $NetBSD: MESSAGE,v 1.6 2015/03/09 08:57:03 taca Exp $ In order to use this module in your Apache 2.x installation, you need to add the following to your httpd.conf file: LoadModule php7_module lib/httpd/mod_php7.so <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> =========================================================================== pkg_install warnings: 2, errors: 0 pkg_install error log can be found in /var/db/pkgin/pkg_install-err.log reading local summary... processing local summary... marking ap24-php73-7.3.6nb2 as non auto-removable
/usr/pkg/share/httpd/htdocs/
vi /usr/pkg/share/httpd/htdocs/phpinfo.php <? phpinfo(); ?>
vi /usr/pkg/etc/httpd/httpd.conf # si PHP 7.4 LoadModule php7_module lib/httpd/mod_php7.so # si PHP 8.0 LoadModule php_module lib/httpd/mod_php8.so <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch>
/etc/rc.d/apache restart Starting apache. [Mon Aug 05 13:16:48.401916 2019] [php7:crit] [pid 511:tid 139491774351360] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP. AH00013: Pre-configuration failed
Le terme thread-safe signifie qu'une fonction peut être implémentée de telle sorte qu'elle puisse être exécutée par plusieurs threads s'exécutant en même temps.
1. J'ai fait … FIX: Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe
vi /usr/pkg/etc/httpd/httpd.conf LoadModule mpm_event_module lib/httpd/mod_mpm_event.so #LoadModule mpm_prefork_module lib/httpd/mod_mpm_prefork.so PAR #LoadModule mpm_event_module lib/httpd/mod_mpm_event.so LoadModule mpm_prefork_module lib/httpd/mod_mpm_prefork.so
Apache se lance mais page blanche quand je vais sur phpinfo.php
2. fait …
vi /usr/pkg/etc/httpd/httpd.conf LoadModule cgid_module lib/httpd/mod_cgid.so
Apache se lance mais page blanche quand je vais sur phpinfo.php
3. fait …
vi /usr/pkg/etc/httpd/httpd.conf <IfModule dir_module> DirectoryIndex index.html index.php </IfModule>
Apache se lance mais page blanche quand je vais sur phpinfo.php
4. fait …
vi /usr/pkg/etc/httpd/httpd.conf <FilesMatch \.php$> SetHandler application/x-httpd-php #ajout SetHandler application/x-httpd-php-source </FilesMatch>
Apache se lance mais page blanche quand je vais sur phpinfo.php et affiche le code
<? phpinfo(); ?>
5. fait … how to install a lamp server
vi /usr/pkg/etc/httpd/httpd.conf <IfModule> AddType application/x-httpd-php .php </IfModule>
Apache se lance mais page blanche quand je vais sur phpinfo.php et affiche encore le code
à vérifier le lien symbolique entre apache et le module php
…
à voir php70-fpm doesn't include www.conf on NetBSD
php -v PHP 7.3.8 (cli) (built: Aug 7 2019 16:20:27) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies with Zend OPcache v7.3.8, Copyright (c) 1999-2018, by Zend Technologies
Starting apache. AH00557: httpd: apr_sockaddr_info_get() failed for acer.home.lan AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Solution pour faire fonctionner le module php dans apache !
Il faut activer la propriété 'short_open_tag' à 'On' dans php.ini !
Pour que le code entre les balises <? et ?> soit interprété comme du code PHP.
vi /usr/pkg/etc/php.ini #short_open_tag = Off short_open_tag = On