Laravel Installation on Apache - index.php issues - php

I've been encountering a slew of issues with a fresh install of Laravel on Ubuntu recently but this latest one has me baffled. I was receiving the WSOD with zero errors in apache/php logs or laravel logs, despite having debug set to true and error display in PHP enabled. I updated the index.php file in public to add a die("Test"); line just to see if that was at least working.
It was, which was great - Test displayed on the site. However, now it won't go away. I've tried updating the text to something else, completely removing the line, etc., artisan cache-clear, composer cache clear and dump-autoload, and I've cleared out any cached items in the storage folders. I've cleared my personal cache and tried different browsers, also, so it's not a personal cache issue. I also tried restarting apache.
All of my chmod permissions should be correct at this point (bootstrap/cache is 755, all of the storage and subfolders are 755). I have had laravel write to the log for another issue (from CLI - a test I did just to make sure permissions were working) so that shouldn't be the problem.
I have this working perfectly fine in laragon on my local Windows machine but have had nothing but issues getting this guy up and running on this Ubuntu server. I have another prod instance of laravel that never gave me this much trouble, either, on another Ubuntu server (and usually it was just a permissions issue). Really not sure what to do at this point or what information might be useful. Hoping that someone else has run into something similar and can shed some light....

what kind of error show's the file /var/log/apache2/error_log?
what is the content of your laravel file storage/logs/laravel.logs?
how did you configure the vhost?
did you install laravel with composer?
give us more information please

Turns out the problem lay with the opcache PHP extension. This was enabled on all versions of PHP installed on my prod environment by default and wasn't something I was utilizing on my dev environment. Writing a test to clear opcache resolved this particular problem and I have since disabled the extension, as I was not intending to use it, anyways.
If anyone else runs into this problem and wants to disable, I simply went through WHM Easy Apache 4 and removed the opcache PHP extensions and then edited the php.ini files for all versions of PHP to set any opcache enabled type of flags to 0 (off).

Related

How to disable the cache on server side for php file on Apache?

this question is similar to: disable php files caching for debugging
Currently, I try to debug a PHP website but I discover that there is some cache problem. When I update a PHP file, the update may or may not be available right now. I even deleted the index.php and the Website was still working.
This is not a browser cache problem because I use Chrome Incognito + Chrome Developer with "Disable Cache" checked + "Empty cache and Hard reload".
I think the problem come from the fact that PHP were upgraded to 7.3.XX (from 5.X) and there's a OPcache module enabled by default.
Is there a way to ignore this module. This website is on a shared hosting plan so I may not be able to edit config files.
EDIT: OPcache was not activated in the Cpanel. I also downgrade to PHP 5.6 and the problem is still here.
New observation: Before the PHP downgrade, I got a info.php file that print the phpinfo(). It was and is still showing 7.3 as version (cache?). I created a copy of that file and named it info2.php. This one is showing 5.6 as as PHP version. So there is still a cache somewhere.
Also, is this possible that the .htaccess file is also cached?
If your hoster has enabled user.ini files you can drop an ini file in your project directory containing:
opcache.enable=0
PHP Manual - Opcache config

Need help in configuring WAMP (phpMyAdmin)

So I have been looking on the net for hours now and I can't solve my problem.
I have wamp installed (WampServer Version 3.1.7 64bit).
I want to open phpMyAdmin through wamp. (I have the phpMyAdmin5.0.2 installed and phpMyAdmin.conf is configured).
I have several php versions installed.(this was done through the process of trying to fix the solution alone).
When I try to open phpMyAdmin I get this error message: [1]: https://i.stack.imgur.com/ZEMaX.png .
I have tried configuring php.ini file (by de-commenting mysqli) it didn't change a thing.
Here's my php.ini file joined in the google drive link: https://drive.google.com/file/d/1fQuVoh5vhRX-MHhYL3zMQ4xNkstO-4Ch/view?usp=sharing .
I have configured extension_dir tp the php/ext folder.
I have similary configured my windows path to the php/ext.
Nothing I try works. Any help is welcome.
Thank you.
Since you're using WAMP, which should include all the pieces you need already working, but also have several PHP versions installed, it sounds like you're installing more than you need which is causing conflicts.
Assume you have no data in your database or web pages that you need to preserve, I suggest removing everything; get rid of WAMP and any extra Apache, PHP, or MySQL/MariaDB installations you have. Clean up (delete or move out of the way) any leftover configuration files, then reinstall WAMP. If you have trouble after installing only WAMP and no other PHP installation, then report back here details of the error. WAMP should come to you working and all ready to go, so if there is a problem, it will be helpful to start from a known base installation without extra configuration files or executable that will cause conflicts.
I'll also point out that the very top of the file you posted states that it's used only for the PHP Command Line Interface, so this is not the configuration file used by anything running through your webserver (like phpMyAdmin or your site). It's a little confusing that there are really two PHP instances (one for the command line and one that runs through the webserver), but in this case you would be looking for the file in wamp/bin/apache/apache2.x.y/bin/php.ini

Code only works if I use the Xdebug extension

When I started my latest project I learned how to use the xdebug extension and I have been using it ever since. Now I am ready to spin up a server and go in to production with this project and my site doesn't fully work. The frontend pages seem to work, which are php based as well, but the backend endpoints that query the database and return some data to the frontend always are returning a 500 status code. So I attach xdebug and figure out how to run it remotely and the pages all start working without any code changes. I go in to the php.ini file and turn it back off and the pages continue to work. Since this is an AWS EC2 server, I delete the instance and create a new one running the same initialization scripts I wrote to install all the software and I get the exact same issue. The server doesn't work until I follow the xdebug install instructions and restart apache2. And like before even when I unattach the xdebug extension via the php.ini file, the code continues to work. Even after the system is rebooted it still continues to work so whatever is being fixed appears to be permanent.
What would building and attaching the xdebug extension, and restarting Apache2, do to the a LAMP stack that would make my code work, even after the extension has been turned off? My server is being built with scripts that run various apt-get install commands with no binaries provided by me as it all is community provided programs. Like clockwork it breaks every time I rebuild the machine until I apply the extension. I can automate that in to my build scripts if I have to, but it is driving me a bit nuts that I don't understand what is happening.
When the server sends a 500 error, normally you get an entry to the php_error.log. So first check this file. Maybe there is some difference in memory limits, max. post variables etc.
I would suggest you to try to find calls of any xdebug specific functions such as var_dump() or any prefixed by xdebug_ in your code:
https://xdebug.org/docs/all_functions
What would building and attaching the xdebug extension, and restarting Apache2, do to the a LAMP stack that would make my code work, even after the extension has been turned off?
Installing one piece of software can bring with it another. If you sudo apt install php-xdebug without php installed, it will install php.

Laravel templates/controllers not updating on save

I'm running a Laravel 4 for a simple app on OS X.
Basically, changes to controllers and templates don't take effect for a long time after I save changes to those files. For example, I add a word to /app/views/index.blade.php, and don't see any change when constantly refreshing my browser for another minute or so. This makes iterative development understandably painful.
I have tried to chmod 777 app/storage/ and all enclosed files, which has no effect. I have also verified this is not a browser cache issue, because it happens (a) in both Chrome and Safari, and (b) regardless of clearing the cache in those browsers. The problem still occurs even when the app is in "local" and not "production" mode.
I should mention that I am running an updated DP version of OS X 10.9 Mavericks. I can't imagine that would have any effect on Laravel, though.
Edit
I tried calling clearstatcache() in start.php to see if that had any effect, and the problem still remained.
This isn't a laravel issues but a PHP 5.5.3 + MAMP. OP Cache is on by default. see this answer for more: Stop caching for PHP 5.5.3 in MAMP
Having the same issue as as autibyte (note: also recently upgraded to Mavericks, but besides File System permissions not sure how this would be impacting) --- but my blade templates no longer seem to be updating. I've tried permissions + clearing out the views folder. No joy.
I was able to fix the issue by uninstalling MAMP (the app package), then installing PHP, Nginx, and MySQL with homebrew. Now all of my templates update, yay! I am pretty sure that the problem lied with the combination of Apache and Mavericks.
I had the same issue and tried for almost 1 hour to fix the problem. All I did was to restart my computer and then everything worked like a charm for me. Some times computers misbehave and the only solution is to restart or do a cold boot.

Best PHP download to keep all my options open?

In the past, I used WAMPserver on windows to parse PHP for me. This is a pre-configured package, focussed on working with MySQL.
When I tried to run PostgreSQL, I got error messages that said that my version of PHP wasn't compiled to work with PostgreSQL.
So, I've recently uninstalled WAMP and every associated with it. I've downloaded Apache 2.2.11 with openSSL, installed as admin(you know, run the command prompt as administrator, cd to the directory where the download was done and have it executed, so the install was done as admin).
That's that. I now have Apache installed, "it works" shows up, so I'm that far.
Now I'm wondering, do I download the exe and install, or the zip, or something else.
What is the best thing to do to make sure that the PHP on my system can handle everything I can ever throw at it?
Also, PHP first, or MySQL/Postgre first.
And lastly, what about PEAR? I need PEAR installed, which isn't standard on Windows. I'm guessing the pear.bat file in the PHP downloads will do that for me?
EDIT: I see one close vote, yet no comment as to why. It makes me wonder how people who are so lazy and rude got to have somany points.
I would recommend downloading the zip package, as configuring php is not really that difficult, and it allows you to add features as needed.
As for whether first to install php or MySQL/PostgreSQL, - it does not really matter. You can install them in any order.
Your guess regarding PEAR is quite correct
i haven't used wamp before, so i can't comment on that
i do however use xampp which sounds very similar
in xampp if i want to enable postgres support i edit the php.ini file and uncomment the postgres section of the ini file, same with any of the extensions that i need
perhaps this might be an alternative you can try if you get stuck
There are many ways to setup a HTTP server/PHP/database machine. Sometimes the behaviour of your development setup will differ from the live server's.
I would recommend finding out the setup your web host is using, then getting a vmware appliance image that fits that as close as possible and get any additional software using it's package manager (which is easier that installing stuff on Windows).
Setup a file sharing link between the VM and the host, make sure you can view the VM's port 80 in a browser running in your host OS and you're set.

Categories