Illumadmin

Subscribe
Archives
March 21, 2024

Activate PHP with Apache on OmniOSce

┌ Open a terminal and switch to root

su -

┌ Install Apache

pkg install pkg:/ooce/server/apache-24

┌ Install PHP

pkg install pkg:/ooce/application/php-83

┌ Configure PHP

sed -i 's/;extension=curl/extension=curl/' /etc/opt/ooce/php-8.3/php.ini
sed -i 's/;extension=gd/extension=gd/' /etc/opt/ooce/php-8.3/php.ini
sed -i 's/;extension=mbstring/extension=mbstring/' /etc/opt/ooce/php-8.3/php.ini
sed -i 's/;extension=zip/extension=zip/' /etc/opt/ooce/php-8.3/php.ini
sed -i 's/;extension=exif/extension=exif/' /etc/opt/ooce/php-8.3/php.ini
sed -i 's/;extension=openssl/extension=openssl/' /etc/opt/ooce/php-8.3/php.ini
sed -i 's/;extension=fileinfo/extension=fileinfo/' /etc/opt/ooce/php-8.3/php.ini
sed -i 's/;zend_extension=opcache/zend_extension=opcache/' /etc/opt/ooce/php-8.3/php.ini
sed -i 's/;extension=mysqli/extension=mysqli/' /etc/opt/ooce/php-8.3/php.ini

┌ Restart PHP

svcadm disable svc:/application/php83:default && sleep 5 && svcadm enable svc:/application/php83:default

┌ Add the php user to the webservd group

usermod -G webservd php

┌ Add FilesMatch and Directoryindex to your virtualhost configuration (/etc/opt/ooce/apache-2.4/extra/www.myvhost.conf)

<VirtualHost 192.168.0.122:443>

    #[...]

  <FilesMatch "\.(cgi|shtml|phtml|php)$">
    SetHandler "proxy:unix:/var/opt/ooce/php/run/www-8.3.sock|fcgi://localhost/" 
  </FilesMatch>

  <Directory \"/var/www/www.myvhost.com\"> 
    AllowOverride All  
    Require all granted  
    DirectoryIndex index.php index.html index.htm  
  </Directory>' 

    #[...]

</VirtualHost>

┌ Configure Apache for PHP

sed -i 's/#LoadModule proxy_module libexec\/mod_proxy.so/LoadModule proxy_module libexec\/mod_proxy.so/' /etc/opt/ooce/apache-2.4/httpd.conf 
sed -i 's/#LoadModule proxy_fcgi_module libexec\/mod_proxy_fcgi.so/LoadModule proxy_fcgi_module libexec\/mod_proxy_fcgi.so/' /etc/opt/ooce/apache-2.4/httpd.conf

┌ Start Apache

svcadm disable svc:/network/http:apache24 && sleep 5 
svcadm enable svc:/network/http:apache24 && sleep 5
Don't miss what's next. Subscribe to Illumadmin:
This email brought to you by Buttondown, the easiest way to start and grow your newsletter.