Extension PHP5 does not parse in XAMPP

前端 未结 4 2080
温柔的废话
温柔的废话 2020-12-06 08:35

I\'ve installed XAMPP Apache server and put my website into htdocs. I\'ve started Apache server. On my website I\'ve got files with extension PHP and with extension PHP5.The

4条回答
  •  悲&欢浪女
    2020-12-06 09:24

    I had to figure out how to do this again when I switched to an Ubuntu OS. The file that needs to be modified is called php5.conf.

    I installed apache 2, php5, phpmyadmin, mysql-server and rapache with the synaptic package manager (system> administration> synaptic package manager) and did not use XAMPP. If you have already installed XAMPP then the paths to php5.conf will be different, likely somewhere in the /opt/lampp file.

    With my install, the path to it is /etc/apache2/mods-avaible/php5.conf. Before it can be modified you must use the terminal to change the permissions to allow you to write to it. To get to it, open the terminal and type :

    cd /etc/apache2/mods-available
    

    and then line that changes the permissions:

    sudo chmod a+w php5.conf
    

    You can type the following to make sure the permissions have been changed:

    ls -l
    

    You should see a long list of files with the permission notions. The line for php5.conf should look like this (with the exception of the date and time):

    -rw-rw-rw- 1 root root  139 2009-12-06 22:35 php5.conf
    

    This means everyone has read and write permissions. You can change the permissions back when you get done if you want. For now proceed to make the changes you need by typing:

    nano php5.conf
    

    This opens the file in a kind of text editor. What you should see is this:

    
    AddType application/x-httpd-php .php .phtml .php3
    AddType application/x-httpd-php-source .phps
    
    

    Change the text to read as follows:

    
    AddType application/x-httpd-php .php .phtml .php3 .php5
    AddType application/x-httpd-php-source .phps
    
    

    Adding the .php5 to after the first AddType command.

    Press ctrl+x to exit and y to save changes. Then restart the computer. And then your files with the .php5 extensions should work!

    I can't believe that took me hours to figure out! Good luck!

提交回复
热议问题