Instructions
Installation of Curl module
Let's install Apache curl module along with Apache 2 webserver and PHP.# apt install libapache2-mod-php php-curl
Restart the Apache webserver:# service apache2 restart
Check for curl module state
Insert the following lines into a new PHP script eg. curl-check.php
within /var/www/html/
directory:<?php
echo 'Curl: ', function_exists('curl_version') ? 'Enabled' . "\xA" : 'Disabled' . "\xA";
?>
Make the script executable and use curl
command to render the output of curl-check.php
php code:# chmod +x /var/www/html/curl-check.php
# curl localhost/curl-check.php
Curl: Enabled
curl-check.php
within /var/www/html/
directory:<?php
echo 'Curl: ', function_exists('curl_version') ? 'Enabled' . "\xA" : 'Disabled' . "\xA";
?>
Make the script executable and use curl
command to render the output of curl-check.php
php code:# chmod +x /var/www/html/curl-check.php # curl localhost/curl-check.php Curl: Enabled
Disable PHP curl module
To disable curl php module execute:# phpdismod curl
# service apache2 restart
# curl localhost/curl-check.php
Curl: Disabled
# phpdismod curl # service apache2 restart # curl localhost/curl-check.php Curl: Disabled
Enable PHP curl module
To enable curl php module execute:# phpenmod curl
# service apache2 restart
# curl localhost/curl-check.php
Curl: Enabled
# phpenmod curl # service apache2 restart # curl localhost/curl-check.php Curl: Enabled
You can either use service or /etc/init.d/ command as follows on Debian Linux version 7.x or Ubuntu Linux version Ubuntu 14.10 or older:
Restart Apache 2 web server, enter:
# /etc/init.d/apache2 restart
OR$ sudo /etc/init.d/apache2 restart
OR$ sudo service apache2 restart
To stop Apache 2 web server, enter:
# /etc/init.d/apache2 stop
OR$ sudo /etc/init.d/apache2 stop
OR$ sudo service apache2 stop
To start Apache 2 web server, enter:
# /etc/init.d/apache2 start
OR$ sudo /etc/init.d/apache2 start
OR$ sudo service apache2 start
A note about Debian/Ubuntu Linux systemd users
Use the following systemctl command on Debian Linux version 8.x+ or Ubuntu Linux version Ubuntu 15.04+ or above:## Start command ##
systemctl start apache2.service
## Stop command ##
systemctl stop apache2.service
## Restart command ##
systemctl restart apache2.service
We can view status using the following command:$ sudo systemctl status apache2.service
● apache2.service - The Apache HTTP Server Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2021-02-24 20:39:39 UTC; 5 days ago Docs: https://httpd.apache.org/docs/2.4/ Process: 115 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) Process: 15247 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS) Main PID: 128 (apache2) Tasks: 6 (limit: 4672) Memory: 16.4M CGroup: /system.slice/apache2.service ├─ 128 /usr/sbin/apache2 -k start ├─15254 /usr/sbin/apache2 -k start ├─15255 /usr/sbin/apache2 -k start ├─15256 /usr/sbin/apache2 -k start ├─15257 /usr/sbin/apache2 -k start └─15258 /usr/sbin/apache2 -k start Feb 27 00:00:23 ubuntu-db-mgmnt systemd[1]: Reloaded The Apache HTTP Server. Feb 28 00:00:23 ubuntu-db-mgmnt systemd[1]: Reloading The Apache HTTP Server.
Tidak ada komentar:
Posting Komentar