apache2ctl
; if the examples below don't work for you, try replacing apachectl with apache2ctl
. You can generally start an installed Apache
server by using the command apachectl startIf this fails on a Linux or Mac OS X system because the command isn't found, use the find command to locate the
apachectl script file
find / -type f -name apachectlOn a Windows system, use the builtin search instead of the find command. If it’s reported as being in, say,
/usr/local/apache/bin/apachectl, try starting
Apache using that full path /usr/local/apache/bin/apachectl startApache should start, and you should be able to test it by loading the web page
http://localhost in your browser.
You
can stop the server by typing apachectl stopIf you make a change to the web server configuration file, you can stop and start the server in one go by typing
apachectl restartIf
you have an XAMPP installation, you can more easily start and stop the Apache web server using the XAMPP control scripts (Linux and Mac OS Xor control panel (Windows. Earlier, we described how to do this alongside our XAMPP installation instructions for each operating system.
Checking Whether Your Apache Installation Supports PHPOnce you’ve found your document root and have Apache running, you can check whether
it can serve PHP requests, and whether its PHP engine has support for MySQL.
Using a text editor, create the file
phpinfo.php so that it has one line with the following contents:
Save
this file with the name phpinfo.php in the document root directory. On a Linux or
Mac OS X system, you can check the file permissions
by listing the file,
ment_root>/phpinfo.php, for example ls -al /var/www/html/phpinfo.php
-rw------- 1 saied saied 20 Jul 22 11:35 /var/www/html/phpinfo.php
Here, only the user who owns the file (
saied
) has permission to read and write the file.
For the web server to read a file, the file should be readable by everyone. You can set the appropriate permissions as follows chmod u=rw,g=r,o=r path_to_document_root/phpinfo.php
Share with your friends: