簡體   English   中英

PHP顯示為文本

[英]PHP Shown as text

該修復程序可能非常簡單,但是我花了4個小時來嘗試查找它。這是我第一次與Laravel合作。 我在Debian 8上進行了設置。安裝了該模塊所需的所有模塊。 問題是php顯示為文本。

到目前為止我嘗試過的是:

sudo apt-get update
apt-get install curl
sudo apt-get install -y build-essential
sudo apt-get install -y python-software-properties

sudo apt-get install -y php5
sudo apt-get install -y apache2
sudo apt-get install -y libapache2-mod-php5
sudo apt-get install -y mysql-server
sudo apt-get install -y php5-mysql
sudo apt-get install -y php5-curl
sudo apt-get install -y php5-gd
sudo apt-get install -y php5-mcrypt
sudo apt-get install -y git-core
sudo apt-get install -y phpmyadmin
apt-get install unzip

curl --silent --location https://deb.nodesource.com/setup_0.12 | bash -
apt-get install --yes nodejs
apt-get install --yes build-essential

sudo a2enmod rewrite

sudo /etc/init.d/apache2 restart

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

sudo apt-get update
sudo apt-get install tcl8.5

wget http://download.redis.io/releases/redis-stable.tar.gz
tar xzf redis-stable.tar.gz
cd redis-stable
make
make test
sudo make install
cd utils
sudo ./install_server.sh

Changed the document root here: /etc/apache2/sites-avialable
From DocumentRoot /var/www/html to DocumentRoot /var/www/html/public

Added this to the apache config.
Include /etc/phpmyadmin/apache.conf


/etc/redis/6379.conf
Uncommented:
#bind 127.0.0.1
bind 127.0.0.1

service redis_6379 restart
service apache2 restart

您將需要在apache文件夾中為您的項目創建一個conf,但在轉到laravel文件夾並運行之前:

php artisan serve

然后單擊鏈接(可能是http:// localhost:8000 ),看看您是否獲得laravel主頁。

如果成功,現在讓我們創建apache conf文件:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName  EXAMPLE.COM
    DocumentRoot /PATH/TO/YOUR/LARAVEL/PUBLIC/FOLDER
    <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    <Directory /PATH/TO/YOUR/LARAVEL/PUBLIC/FOLDER>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Require all granted
    </Directory>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Require all granted
    </Directory>

</VirtualHost>

將此文件放在

/etc/apache2/sites-available/YourProjectName.conf

現在運行這個:

 sudo a2ensite YourProjectName.conf

和這個

 sudo service apache2 reload

您是否嘗試過運行composer updatecomposer install 當Laravel吐出文字時,這似乎解決了我大部分的頭痛問題。 以前有過同樣的問題,但我永遠不記得確切地解決了什么

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM