Friday, October 31, 2008

autostart apache during boot

i just finished my apache, php, mysql installation for my new server.  i used Centos 5.1. Those not started when i reboot my server. Oh..i forgot to make it autostart during boot time. 

Here the steps to auto run apache or mysql during the boot time..

run command runlevel to check your current Centos run level

Running runlevel command on my centos linux machines displays default run level as 5.You must be wondering what runlevel has to do with by autostarting apache server. There is reason for that Linux uses different run levels to boot and you should know default runlevel where you would like to configure apache to autostart during boot.

Next you have to use magic command called chkconfig on fedora to list the apache (httpd) services runlevel:

[root@node12 ~]# chkconfig --list httpd

httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off

In chkconfig output off means apache (httpd) service is set with no autostart for associated runlevels. Since my default runlevel is 5 , I need to set apache to autostart in runlevel 5 using chkconfig. Here is how you can turn apache autostart for your default run level :

[root@node12 ~]# chkconfig --level 5 httpd on


If your default run level is 3 then you should use 3 in above command. You can also run 

 [root@node12 ~]# chkconfig --level 235 httpd on

to make ur apache run on level 2,3 and 5. 

Now to check if autostart is set as on during boot


Run checkconfig again :

[root@node12 ~]# chkconfig --list httpd

httpd 0:off 1:off 2:off 3:off 4:off 5:on 6:off

that's all..Centos your life!! 




configure: error: C compiler cannot create executables

Today I have tried to compile a software in a Linux machine, when I run

./configure

I got

checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking for multicast... checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: no acceptable C compiler found in $PATH See `config.log' for more details. 

Then I installed gcc with:

apt-get install gcc 

for Ubuntu and for Centos i used

yum install gcc 

and try again, this time I got:

and try again, this time I got:

checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking for multicast... checking for gcc... gcc checking for C compiler default output file name... configure: error: C compiler cannot create executables See `config.log' for more details. 

To solve this I had to install g++

apt-get install g++

And then when I tried again it worked, so to compile software with Linux it seems that you mostly need to install both

gcc and g++

Update: Thanks to Thadeu Penna a friend of the blog for this tip.

using

apt-get install build-essential

Will install all the basic tools for developing in Debian and I know it also works for Ubuntu.

enable and disable SElinux

Important

Changes you make to files while SELinux is disabled may give them an unexpected security label, and new files will not have a label. You may need to relabel part or all of the file system after re-enabling SELinux.

From the command line, you can edit the /etc/sysconfig/selinux file. This file is a symlink to/etc/selinux/config. The configuration file is self-explanatory. Changing the value of SELINUX orSELINUXTYPE changes the state of SELinux and the name of the policy to be used the next time the system boots.

[root@host2a ~]# cat /etc/sysconfig/selinux # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: #       enforcing - SELinux security policy is enforced. #       permissive - SELinux prints warnings instead of enforcing. #       disabled - SELinux is fully disabled. SELINUX=permissive # SELINUXTYPE= type of policy in use. Possible values are: #       targeted - Only targeted network daemons are protected. #       strict - Full SELinux protection. SELINUXTYPE=targeted  # SETLOCALDEFS= Check local definition changes SETLOCALDEFS=0 
Changing the Mode of SELinux Using the GUI

Use the following procedure to change the mode of SELinux using the GUI.

Note

You need administrator privileges to perform this procedure.

  1. On the System menu, point to Administration and then click Security Level and Firewall to display the Security Level Configuration dialog box.

  2. Click the SELinux tab.

  3. In the SELinux Setting select either DisabledEnforcing or Permissive, and then click OK.

  4. If you changed from Enabled to Disabled or vice versa, you need to restart the machine for the change to take effect.

Changes made using this dialog box are immediately reflected in /etc/sysconfig/selinux.

Configure PHP connection to Oracle DB – the RPM way

I have CentOS 4.4 box which I want to connect to Oracle DB 10g via PHP
There are 2 way to configure PHP to connect to Oracle DB using OCI:
A. Use PHP RPMs (which included all php module in RPM package) but nowadays oci8 module no longer provider by CentOS and you might use older version of PHP - easiest and quickest way
B. Use current version of PHP and enable oci8 via PEAR. You will get current PHP version with oci8 enable but still in RPM way

Lets begin

A. Use PHP RPMs packages
1. Install Apache if not installed
CODE:
# yum install httpd


2. Download Oracle Client Software -- if you are using GUI
or download Oracle InstantClient BasicLite (the rpm version) -- I choose this and install it.
to get latest version download it from http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html
CODE:
# rpm –ivh oracle-instantclient-basiclite-*.rpm

my copy of Oracle Instant Client BasicLite is here
http://www.am3n.profusehost.net/phpoci/oracle-instantclient-basic-10.2.0.3-1.i386.rpm

3. Install PHP and makesure you installed php-oci8 module, other modules you can install it if you like
CODE:
# rpm -ivh php-5*.rpm php-oci8-*.rpm php-pear-*.rpm

I am not using CentOS version because it's not provide oci8 module. But I am using PHP from Miracle Linux - Asianux which also look-like Redhat derivatives distro. They provide complete PHP module including oci8.
Download it from my mirror here.
http://www.am3n.profusehost.net/phprh4/

Info about Miracle Linux - Asianux
http://en.wikipedia.org/wiki/Miracle_Linux
Complete PHP modules from Miracle Linux
http://www.miraclelinux.com/update/linux/list.php?errata_id=249

4. Create local variable to connect to Oracle, for NLS_LANG you can set with your locale.
CODE:

# vi /etc/profiles
LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.3/client/lib
export LD_LIBRARY_PATH
NLS_LANG=AMERICAN_AMERICA.UTF8
export NLS_LANG


5. Update linux Library thingy... (locate the oracle library if you use differrent version)
CODE:
# echo /usr/lib/oracle/10.2.0.3/client/bin/ >> /etc/ld.so.conf
# echo /usr/lib/oracle/10.2.0.3/client/lib/ >> /etc/ld.so.conf
# ldconfig
# cd /usr/lib/oracle/10.2.0.3/client/lib/
# ln -s libclntsh.so.10.1 libclntsh.so
# ln -s libocci.so.10.1 libocci.so


6. (Re-)Start the Apache
CODE:
# service httpd restart


I have CentOS 4.4 box which I want to connect to Oracle DB 10g via PHP
There are 2 way to configure PHP to connect to Oracle DB using OCI:
A. Use PHP RPMs (which included all php module in RPM package) but nowadays oci8 module no longer provider by CentOS and you might use older version of PHP - easiest and quickest way
B. Use current version of PHP and enable oci8 via PEAR. You will get current PHP version with oci8 enable but still in RPM way

Lets begin

A. Use PHP RPMs packages
1. Install Apache if not installed
CODE:
# yum install httpd


2. Download Oracle Client Software -- if you are using GUI
or download Oracle InstantClient BasicLite (the rpm version) -- I choose this and install it.
to get latest version download it from http://www.oracle.com/technology/tech/oci/instantclient/instantcl
ient.html
CODE:
# rpm –ivh oracle-instantclient-basiclite-*.rpm

my copy of Oracle Instant Client BasicLite is here
http://www.am3n.profusehost.net/phpoci/oracle-instantclient-basic
-10.2.0.3-1.i386.rpm

3. Install PHP and makesure you installed php-oci8 module, other modules you can install it if you like
CODE:
# rpm -ivh php-5*.rpm php-oci8-*.rpm php-pear-*.rpm

I am not using CentOS version because it's not provide oci8 module. But I am using PHP from Miracle Linux - Asianux which also look-like Redhat derivatives distro. They provide complete PHP module including oci8.
Download it from my mirror here.
http://www.am3n.profusehost.net/phprh4/

Info about Miracle Linux - Asianux
http://en.wikipedia.org/wiki/Miracle_Linux
Complete PHP modules from Miracle Linux
http://www.miraclelinux.com/update/linux/list.php?errata_id=249

4. Create local variable to connect to Oracle, for NLS_LANG you can set with your locale.
CODE:

# vi /etc/profiles
LD_LIBRARY_PATH=/usr/lib/oracle/10.2.0.3/client/lib
export LD_LIBRARY_PATH
NLS_LANG=AMERICAN_AMERICA.UTF8
export NLS_LANG


5. Update linux Library thingy... (locate the oracle library if you use differrent version)
CODE:
# echo /usr/lib/oracle/10.2.0.3/client/bin/ >> /etc/ld.so.conf
# echo /usr/lib/oracle/10.2.0.3/client/lib/ >> /etc/ld.so.conf
# ldconfig
# cd /usr/lib/oracle/10.2.0.3/client/lib/
# ln -s libclntsh.so.10.1 libclntsh.so
# ln -s libocci.so.10.1 libocci.so


6. (Re-)Start the Apache
CODE:
# service httpd restart



B. Use your current PHP version from CentOS
If you already install your PHP and don't want to replace it with older version and/or your current version of PHP didn't provide php-oci8 packages you can install it using the following steps
This how to is modification of PHP-OCI8 in Ubuntu Forum
http://www.ubuntuforums.org/archive/index.php/t-92528.html

1. Install Oracle InstantClient
download it from http://www.oracle.com/technology/tech/oci/instantclient/instantclient.html
CODE:
# rpm -ivh oracle-instantclient-basic-10.2.0.3-1.i386.rpm
# rpm -ivh oracle-instantclient-devel-10.2.0.3-1.i386.rpm

My copy is here
http://www.am3n.profusehost.net/phpoci/oracle-instantclient-basiclite-10.2.0.3-1.i386.rpm
http://www.am3n.profusehost.net/phpoci/oracle-instantclient-devel-10.2.0.3-1.i386.rpm

2. Configure linux library thingie...
CODE:
# echo /usr/lib/oracle/10.2.0.3/client/bin/ >> /etc/ld.so.conf
# echo /usr/lib/oracle/10.2.0.3/client/lib/ >> /etc/ld.so.conf

# ldconfig

3. Install oci8 via pear
Make sure you already install php-devel package (and have upgrade to latest version)

CODE:
# cd /usr/local/src
# pear download oci8
# tar xzf oci8-1.2.3.tgz
# cd oci8-1.2.3
# phpize
# ./configure --with-oci8=shared,instantclient,/usr/lib/oracle/10.2.0.3/client/lib/
# make
# make install

My copy of oci8 is here
http://www.am3n.profusehost.net/phpoci/oci8-1.2.3.tgz

4. Enable oci8
CODE:
# vi /etc/php.d/oci8.ini
; Enable oci8 extention module
extension=oci8.so


5. (Re-)Start the Apache
CODE:
# service httpd restart




Just want to make sure if your php is already configure with oci8 module create a php file with phpinfo() function
Create phpinfo file
CODE:
# vi /var/www/html/phpinfo.php


View phpinfo. http://yourserver/phpinfo.php
You should see something like this
CODE:

oci8
OCI8 Support enabled
Revision $Revision: 1.257.2.8 $
Active Persistent Links 0
Active Links 0
Oracle Version 10.1
Compile-time
ORACLE_HOME /opt/oracle/product/10.1.0
Libraries Used -Wl,-rpath,/opt/oracle/product/10.1.0/lib -
L/opt/oracle/product/10.1.0/lib -lclntsh
Temporary Lob support enabled
Collections support enabled

nstalling PHP and the Oracle 10g Instant Client for Linux and Windows

Updated for PHP 5.1.2


Author: Christopher Jones, Consulting Technical Staff, Oracle Corporation

Updated: January 2006

Oracle 10g Instant Client (free download available) is the easiest way for PHP to connect to a remote Oracle database, requiring installation of only three libraries.

The Instant Client libraries used by PHP access Oracle's current API, called OCI8. (This C interface takes its name from being first introduced in Oracle8.) PHP Oracle 8 Functions can call Oracle 8.1.7, 9.x, or 10.x directly, or optional abstraction classes like PEAR MDB2 and ADOdb can be used for convenience.

The older PHP "oracle" extension can also be used with Instant Client but it calls a deprecated Oracle API. New development with this extension is not recommended by the PHP community or by Oracle.

To use Instant Client with PHP 4 or 5 on Apache, follow the steps below. (See this section for details about 5.1.2 and its refactored OCI8 extension.) An existing Oracle database is needed; Instant Client does not include one.

Typically the database will be on another machine. If the database is local then Oracle components will generally already be available and Instant Client is not required.

Software Requirements:

SoftwareNotes
Oracle Instant ClientDownload the "Instant Client Package - Basic." On Linux, also download the "Instant Client Package - SDK."
Apache HTTPD ServerThe PHP community still recommends Apache 1.3
PHP - PHP Hypertext ProcessorVersion 4.3 or later

Enabling the PHP OCI8 Extension on Windows

The Instant Client binaries complement PHP's prebuilt binaries for Windows.

  1. Download the PHP binary zip file (not the installer build) and Apache. Install them following Installation on Windows Systems in the PHP Manual. OTN's PHP Developer Center contains links to useful background material such as "Installing Oracle, PHP, and Apache on Windows 2000/XP," which covers installation of a traditional, full Oracle 10g footprint (which is not required with Instant Client).

    Check that PHP is working before continuing. At this stage Oracle support is not enabled.

  2. Download the Instant Client Basic package for Windows from the Instant Client page on OTN. The zip file is about 30MB in size.

  3. Create a subdirectory (e.g., c:\instantclient10_1) and copy these libraries from the zip file:

    • oraociei10.dll
    • orannzsbb10.dll
    • oci.dll

    Collectively these three files are about 80MB in size.

    To use PHP's older "oracle" extension (enabled with "extension=php_oracle.dll" in php.ini), copy ociw32.dll instead of oci.dll.

  4. Edit the environment and add c:\instantclient10_1 to PATH before any other Oracle directories.

    For example, on Windows 2000, follow Start -> Settings -> Control Panel -> System -> Advanced -> Environment Variables and edit PATH in the System variables list.

    If a tnsnames.ora file is used to define Oracle Net service names, copy tnsnames.ora to c:\instantclient10_1 and set the user environment variable TNS_ADMIN to c:\instantclient10_1. A default service name can optionally be set in the user environment variable LOCAL.

    Set necessary Oracle globalization language environment variables such as NLS_LANG. If nothing is set, a default local environment will be assumed. See An Overview on Globalizing Oracle PHP Applications for more details.

    Unset unnecessary Oracle variables such as ORACLE_HOME and ORACLE_SID.

  5. Edit php.ini and uncomment the OCI8 extension:

    extension=php_oci8.dll 

    Set the extension_dir directive to the full PHP extension DLL path. In PHP 4 the DLLs are in the "extensions" sub-directory of the PHP software. In PHP 5 they are in "ext".

  6. Restart Apache.

To check the extension is configured, create a simple PHP script phpinfo.php where the web server can read it.

 

Load the script into a browser using an "http://" URL. The browser page should contain an "oci8" section saying "OCI8 Support enabled".

Enabling the PHP OCI8 Extension on Linux

To add Oracle connectivity on Linux, PHP needs to be recompiled.

The PHP Developer Center contains links to useful background material such as Installing Oracle, PHP, and Apache on Linux, which covers installation of a traditional, full Oracle 10g footprint (which is not required with Instant Client).

  1. Download and install Apache. For example, to install it in your home directory:
    cd apache_1.3.31 ./configure --enable-module=so --prefix=$HOME/apache --with-port=8888 make make install 

    Edit $HOME/apache/conf/httpd.conf and add:

    AddType application/x-httpd-php        .php AddType application/x-httpd-php-source .phps 
  2. Download PHP and untar it.
  3. Download the Basic and the SDK Instant Client packages from the Instant Client page on OTN. Collectively the two RPMs are about 30MB in size.
  4. Install the RPMs as the root user.
    rpm -Uvh oracle-instantclient-basic-10.1.0.3-1.i386.rpm rpm -Uvh oracle-instantclient-devel-10.1.0.3-1.i386.rpm 

    The first RPM puts the Oracle libraries in /usr/lib/oracle/10.1.0.3/client/lib and the second creates headers in /usr/include/oracle/10.1.0.3/client

  5. Backup and then apply this patch to PHP's ext/oci8/config.m4. The patch line numbers are based on PHP 4.3.9. This patch will not be necessary when PHP bug 31084 is fixed, most likely in PHP 4.3.11 and 5.0.4.

    If you are using PHP 4.3.9 or 4.3.10 you can save the patch to a file, e.g. php_oci8ic_buildpatch, and install it using:

    patch -u config.m4 php_oci8ic_buildpatch 

    The patch creates a new PHP configuration parameter: --with-oci8-instant-client[=DIR]. On Linux, by default, it uses the latest version of the Instant Client installed from the RPMs. A directory to the Oracle libraries can be specified to use a different version. In either case, the correct SDK headers will automatically be used.

    The new parameter is mutally exclusive with the existing --with-oci8 parameter.

    For reference: on non-Linux platforms, the Instant Client package is unzipped into a directory of your choice. The --with-oci8-instant-client parameter will need this directory explicitly specified; for example, --with-oci8-instant-client=/home/instantclient10_1. The Instant Client SDK should unzipped to the same directory as the basic package so the subdirectory of header files can be located by the revised configuration script.

  6. Rebuild the "configure" script in the top-level PHP directory.
    cd php-4.3.9 rm -rf autom4te.cache config.cache ./buildconf --force 
  7. Run configure with the new option. This example uses Apache installed in the home directory.
       ./configure \       --with-oci8-instant-client \       --prefix=$HOME/php --with-apxs=$HOME/apache/bin/apxs \       --enable-sigchild --with-config-file-path=$HOME/apache/conf 
  8. Rebuild PHP.
    make make install 
  9. Copy the PHP configuration to the location given by --with-config-file-path
    cp php.ini-recommended $HOME/apache/conf/php.ini 
  10. Set LD_LIBRARY_PATH to /usr/lib/oracle/10.1.0.3/client/lib and restart Apache.

    If a tnsnames.ora file is used to define Oracle Net service names, set TNS_ADMIN to the directory containing the file.

    It is important to set all Oracle environment variables before starting Apache. A script helps do that:

    #!/bin/sh  APACHEHOME=/home/apache  LD_LIBRARY_PATH=/usr/lib/oracle/10.1.0.3/client/lib:${LD_LIBRARY_PATH} TNS_ADMIN=/home export LD_LIBRARY_PATH TNS_ADMIN  echo Starting Apache  $APACHEHOME/apachectl start 
To confirm the extension is configured, create a simple PHP script phpinfo.php where the web server can read it.
 

Load the script into a browser using a URL similar to "http://localhost:8888//phpinfo.php". The browser page should contain an "oci8" section saying "OCI8 Support enabled".

Connecting to Oracle

Oracle connection information is passed to OCILogon() to create a connection. Tools linked with Instant Client are always "remote" from any database server and an Oracle Net connection identifier must be used along with a username and password. The connection information is likely to be well known for established Oracle databases. With new systems the information is given by the Oracle installation program when the database is set up. The installer should have configured Oracle Net and created a service name.

In new databases the demonstration schemas such as the HR user may need to be unlocked and given a password. This may also be done in SQL*Plus by connecting as the SYSTEM user and executing the statement:

ALTER USER username IDENTIFIED BY new_password ACCOUNT UNLOCK; 
There are several ways to pass the connection information to PHP. This first example uses Oracle 10g's Easy Connect syntax to connect to the HR schema in theMYDB database service running on mymachine. No tnsnames.ora or other Oracle Network file is needed:
$c = OCILogon('hr', 'hr_password', '//mymachine.mydomain/MYDB'); 

See Oracle's Using the Easy Connect Naming Method documentation for the Easy Connect syntax.

Alternatively, if /home/tnsnames.ora contains:
MYDB =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = mymachine.mydomain)(PORT = 1521))    (CONNECT_DATA =       (SERVER = DEDICATED)       (SERVICE_NAME = MYDB)     )   ) 

and the TNS_ADMIN environment variable was set to /home (before starting Apache), then the connection string could be:

$c = OCILogon('hr', 'hr_password', 'MYDB');        
If the environment variable LOCAL (on Windows) or TWO_TASK (on Linux) was set to MYDB then a connection to MYDB could also be made with:
$c = OCILogon('hr', 'hr_password'); 

Using Oracle

When the basic connection is working, try out a simple script, testoci.php. Modify the connection details to suit your database and load it in a browser. This example lists all tables owned by the user HR:

\n";  }   OCILogoff($conn);   ?> 
Troubleshooting

The Oracle PHP Troubleshooting FAQ contains helpful information on connecting to Oracle.

Oracle's SQL*Plus command line tool can be downloaded from the Instant Client page to help resolve environment and connection problems. Also see the SQL*Plus Instant Client Release Notes.

Check the environment used by SQL*Plus is the same as shown by phpinfo.php.

Windows Help

If the phpinfo.php script does not produce an "oci8" section saying "OCI8 Support enabled", verify that "extension=php_oci8.dll" is uncommented in php.ini.

If PATH is set incorrectly or the Oracle libraries cannot be found, starting Apache will give an alert: "The dynamic link library OCI.dll could not be found in the specified path." The Environment section of the phpinfo() page will show the values of PATH and the Oracle variables actually being used by PHP.

If php.ini's extension_dir directive is not correct, Apache startup will give an alert: "PHP Startup: Unable to load dynamic library php_oci8.dll."

Linux Help

Carefully check config.m4 was patched correctly. If "configure" fails, check the config.log file. Revert config.m4, remove caches files, run ./buildconf --force and configure, and verify that the problems are related to the changes made.

Make sure the timestamp on "configure" is current. Remove any cache files and rebuild it if necessary.

Set all required Oracle environment variables in the shell that starts Apache.

For PHP 5.1.2 and Later

The "re-factored" OCI8 extension introduces new syntax for Instant Client support. The re-factored extension was first included in PHP 5.1.2. It is also available frompecl.php.net/package/oci8 and pecl4win.php.net/ext.php/php_oci8.dll for earlier versions of PHP.

If you have installed the Instant Client RPMs as described in this Technical Note, configure PHP with:

./configure \     --with-oci8=instantclient,/usr/lib/oracle/10.1.0.3/client/lib \     --prefix=$HOME/php --with-apxs=$HOME/apache/bin/apxs \     --enable-sigchild --with-config-file-path=$HOME/apache/conf 
If you are using the Instant Client Basic and SDK zip files then change the --with-oci8 option to the unzipped directory, e.g:
--with-oci8=instantclient,$HOME/instantclient10_1  
To tell if you have the re-factored extension, check the output of phpinfo(). It will show seven directives with an "oci8." prefix. These are not present in the previous incarnation.

Conclusion

I hope this article has been helpful. Questions and suggestions can be posted on the OTN Instant Client or PHP forums.

Thursday, October 23, 2008

Disable SELinux on CENTOS 5

To check and see if SELINUX (secure linux) is installed and running on your Red Hat ES 5 (CentOS 5, etc) server, use a text editor to open /etc/selinux/config:

vi /etc/selinux/config

Inside you should see a line that says

SELINUX=*some value*

Where *some value* is either enforcingpermissive or disabled. To shut SELINUX off, set the variable todisabled. To receive a set of errors to see what services would be affected if SELINUX was running, set it toperimissive. If you are sure all your services, daemons and everything else is set up with correct SELINUXpermissions, you can set it to enforcing.

If you're getting an error after compiling and installing an Oracle OCI8 module for PHP you might want to setSELINUX to permissive or disabled until you are able to resolve the permission problem.

If you have to change the setting you should reboot the server to make sure the change takes effect system wide.

Wednesday, October 22, 2008

install apache, mysql and php on centos

Below are the steps to install LAMP (Apache, PHP and MySQL in Linux) using Yum:-

  • Go to CentOS and download a copy of CentOS Linux and install it (i’ll not go thru the how to install CentOS with you here)
  • Once your CentOS is installed. Open a terminal (if you are using X-Window), and type yum install httpd and follow on screen instruction to install apache web server
  • Once apache web server has been installed, type yum install php
  • Once php installed try to install it's extension type yum install php-common php-gd php-mcrypt php-memchache php-mhash php-mysql php-xml
  • Once PHP installed successfully, type yum install mysql-server mysql
  • Once everything finish, type service httpd start to start your apache web server, screen will show you if web server service successfully started
  • type service mysqld start to start your mysql server
  • Once both services is running, you can point your browser to http://localhost and you should see a welcome page from CentOS
  • If you see that welcome page, you just installed everything successfull.
  • To test if php is running, go to /var/www/html and create an index.php file with the content below

    and refresh your browser again. If you see a purple PHP information page showing all the php configuration variables, then php is running now.
  • Congratulation, you just successfully installed LAMP in your machine.