You are on page 1of 2

Home About Linux System Administration Bash Scripting WordPress Business Miscellaneous

Home / Linux System Administration / Using phpinfo to Display Info (Including Version Number) of your php (Linux)

Using phpinfo to Display Info (Including Version Related Posts

Number) of your php (Linux) 1. Enabling php in Apache on Linux (CentOS 6)


 Posted on September 1, 2014 by  Ahmed Amayem by Loading the Module in httpd.conf
2. Installing Different Versions of php Using
yum on Linux (CentOS 6)
An easy and quick way to find out what php version your apache server is using is to use the phpinfo() function. To 3. Viewing the Apache Modules Available on
do this we will create a file with <?php phpinfo() ?> in it and access it through our server by opening it in a browser. your Disk (Linux (CentOS 6))
4. Replacing (yum-plugin-replace) one yum

Deciding Where to Put the PHP File install package (php) with another on Linux
(CentOS 6)
On CentOS 6 the default directory for html documents is /var/www/html/ . Let’s go to that directory: 5. Installing WordPress Step 5: Running the
WordPress php Install Script
[ahmed@amayem /]$ cd /var/www/html/

Or if you want to go to a custom directory you may do that but we will have to change some apache configuration to
point it to that directory.
Linux System Administration

Make a PHP file Search… 


[ahmed@amayem html]$ sudo "<?php phpinfo() ?>" > test.php
‐bash: test.php: Permission denied Table of Contents 
Looks like even sudo isn’t working here, we will have to change to root: Deciding Where to Put the PHP File

Make a PHP file


[ahmed@amayem html]$ su
Password: Point Apache to the Directory that Contains the PHP
[root@amayem html]# sudo echo '<?php phpinfo() ?>' > info.php File (if not using the default html directory)

Opening the file from a browser


Now we need to give the file the proper rights. Let’s check what other files are there and copy that:
Getting Plain Text ‘‘
[root@amayem html]# ls ‐l in*
References
‐rwxr‐xr‐x 1 root root 2175 Nov 13 2013 index.html
‐rw‐r‐‐r‐‐ 1 root root 19 Aug 29 17:59 info.php
Upgrading Self-Installed Ghost on Linux
So we need to add the execute rights: Server (CentOS 6)
[root@amayem html]# ls ‐l in*
‐rwxr‐xr‐x 1 root root 2175 Nov 13 2013 index.html Different Methods of Backing up and
‐rwxr‐xr‐x 1 root root 19 Aug 29 17:59 info.php Automating Backups of Ghost on Linux
(CentOS 6)
That looks good.

Creating a WordPress MultiSite Network on

Point Apache to the Directory that Contains the PHP File (if not Linux (CentOS 6)

using the default html directory) Setting Up Pretty Permalinks in WordPress


WITHOUT htaccess on Linux (CentOS 6)
If you decide not to use the default directory then we will have to adjust the Apache config. Go to the Apache config
file. In CentOS 6 it is found here /etc/httpd/conf/httpd.conf . Let’s go there and access it:
Setting Up Pretty Permalinks in WordPress
[root@amayem html]# cd /etc/httpd/conf/ Using htaccess and mod_rewrite on Linux
[root@amayem conf]# vi httpd.conf (CentOS 6)

Go to the bottom of the file by entering G . If NameVirtualHost *:80 is commented then uncomment it (remove the #
at the beginning of the line). Paste (copy and paste in vi here) the following at the end while replacing the values to
what your values would be.

<VirtualHost *:80>
ServerName info.amayem.com
ServerAlias www.info.amayem.com
DocumentRoot /var/www/html
</VirtualHost>

Exit insert mode qith Esc or ctrl+c and save by entering :x . Now Apache needs to be restarted to get this new
configuration.

[root@amayem conf]# apachectl restart

Now time to serve the new page.

Opening the file from a browser


Open a browser and go to your serverName/info.php , for example for me according to the setup above it would be
info.amayem.com/info.php . Here is what it would look like:
Getting Plain Text ‘‘
If you get a white page with the plain text <?php phpinfo() ?> at the top then you probably don’t have php installed
or if it is installed then it is not enabled, in which case check the following:

1. Installing php using yum


2. Enabling ‘php’ in apache

References
1. Cyberciti’s phpInfo page

Share the knowledge!

        
This entry was posted in  Linux System Administration and tagged  apache, Linux, php, phpinfo, technical.
Bookmark the  permalink.

 This article was helpful  3 people found this article useful

 Installing Different Versions of php Using yum on Enabling php in Apache on Linux (CentOS 6) by
Linux (CentOS 6) Loading the Module in httpd.conf 

Ahmed Amayem has written 90 articles


A Web Application Developer Entrepreneur.

  

About Stay Connected


This is a personal reference and educational tool, which I hope may be beneficial to others as well. Enjoy.
 

© Copyright 2015 | Privacy Policy

You might also like