PHP显示为文本

PHP显示为文本,php,apache,laravel,redis,debian,Php,Apache,Laravel,Redis,Debian,修复可能很容易,但我花了4个小时试图找到它。。 这是我第一次和拉威尔一起工作。我正在Debian8上设置它。 此操作所需的所有模块都已安装。 问题是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

修复可能很容易,但我花了4个小时试图找到它。。 这是我第一次和拉威尔一起工作。我正在Debian8上设置它。 此操作所需的所有模块都已安装。 问题是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
然后单击链接(可能) 看看你能不能找到拉威尔的主页

如果成功,现在让我们创建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>
现在运行以下命令:

 sudo a2ensite YourProjectName.conf
还有这个

 sudo service apache2 reload

您是否尝试过运行
composer更新
composer安装
?这似乎解决了我在拉威尔吐出文字时最头疼的问题。以前也有同样的问题,但我永远记不清是什么解决了它

您是否已经将一个文件放入
/var/www/html/public
以查看Apache是否正常工作?是否成功重新启动了
apache2
?我看到您在重新启动其应用程序时错过了
sudo
service@GuyT是的,这就是问题所在@Raptor是的,我尝试使用sudo重新启动。只需将一个简单的
index.php
放在
文件夹中,检查Apache是否已启动。问题是我不是在本地做的。它在视频显示器上。当我尝试转到vds ip:800时,它抛出一个错误。我完成了上述所有操作。但同样的问题是:(对不起,我不知道你的服务器配置是什么,所以很难帮助你这么做:curl-sS | php sudo mv composer.phar/usr/local/bin/composer,当我执行'composer install'时,它会请求json文件。我认为composer需要在
usr/bin
中,而不是在
usr/local/bin
中,不确定这是ubuntu的东西还是仅仅是一个文件。)一般来说,composer(编辑,该死的输入快捷方式)在laravel项目的根目录下也有
vendor
目录吗?(再次编辑)-在laravel目录的根目录下也需要一个composer.json,我处理新项目的方式是运行
composer create project laravel/laravel{directory}
它抓住了包括供应商在内的一切
 sudo service apache2 reload