CakePHP 3 - 500 Internal Server Error - php

I am using Ubuntu 17.04 and I have recently installed latest version of CakePHP. It works well on my localhost but not working on server. It just shows 500 Internal Error.
I already have CakePHP projects running on my server but only cakephp setups installed and uploaded from Ubuntu are not working on server.
Thanks in advance.

Before installing CakePHP3 we are needed to check some configuration in our server.
Make sure that you have the mbstring and intl extensions are enabled
in PHP.
Make sure that you have pdo_mysql enabled in PHP.
And php version should be 5.6 or greater.
For this go to cpanel and click Select php version and enable all
the required options from the list.
And Xampp
modification :
Open /xampp/php/php.ini
Change ;extension=php_intl.dll to extension=php_intl.dll (remove the semicolon)

You have to enable php-intl extension first
For Window Users (Xampp Server)
Path :- c:\xampp\php\php.ini
Uncomment :-
1. ;extension=php_intl.dll (Remove ;)
2. ;extension=php_mbstring.dll (Remove ;)
For Linux (Open terminal ctr+alt+t)
Run Command :- sudo apt-get install php-mbstring
sudo apt-get install php-intl
Now Run server bin/cake server

Related

PDOException “could not find driver” with heroku, postgres and laravel [duplicate]

pdo is working fine with mysql but with pgsql its giving error 'PDOException' with message 'could not find driver' I've installed php5-pgsql package which also includes pdo_pgsql
http://packages.debian.org/sid/php5-pgsql
This package provides a module for PostgreSQL database connections directly from PHP scripts. It also includes the pdo_pgsql module for use with the PHP Data Object extension.
my dsn is pgsql:dbname=DB;host=192.168.0.2
I am using Ubuntu 10.04
This message means you need to install and or activate postgresql extension in PHP
This solution works for me :
To install postgresql extension
[sudo] apt-get install php-pgsql
after, for activating it, uncomment pgsql and pdo-pgsql extensions in etc/php/$PHP_VERSION/apache2/php.ini file
Finally, type :
[sudo] /etc/init.d/apache2 restart
To restart apache server if you use apache such as was my case...
1) Have you enabled pgsql.so in php.ini (extension=pgsql.so)?
2) Is you Postgresql listenin on 192.168.0.2 interface? (You can check it by netstat -tpln)
3) How you authenticate your access into Postgresql?
Make sure you've uncommented the line that tells php where the Postgres driver is (usually extension=pgsql.so) in the main php.ini file.
I had the same issue. First of all - check is it enabled in php.ini. Uncomment extension=php_pdo_pgsql...
than set up extension directory!!
extension_dir = "ext" ; for your case it could be other dir.
and do not forget to restart server after changing the config.
Try to remove semicolon in front of
extension=pgsql
extension=pgsql.so
included in your php.ini file
You can do that from the XAMPP Control Panel.
Here is what I did to solve the problem.
Edit php.ini and remove ; from extension=pdo_pgsql. Also, add extension=pgsql.so to the php.ini file.
Make sure to restart the Apache server before you try to see the result.
I had the same problem with another solution. I lost my around 4 hours to solve this problem. Please check the following to solve this problem.
Check php.ini file and remove semicolon from this line
extension=pgsql
extension=pdo_pgsql
Restart your apache2 server
sudo service apache2 restart
Check if your PDO driver has updated in localhost phpinfo()
I did All the things right and still I had this problem. And you know why? Because I had several versions of php installed. So I was running php7.4 in my php cli but localhost was running on php7.2. So always check your php versions.
Check your php version on localhost and terminal cli
When you do not have postgresql installed on the same machine that is Apache and PHP; you have to install php-pgsql and don't have to add extensions in php.ini manually in Linux (in Windows yes), because redundancies are generated and this does not work (checked in error.log).
$ sudo apt install php-pgsql
Then you can check the existence of the extension enabled automatically in:
$ sudo nano /etc/php/7.0/apache2/conf.d/10-pdo.ini
Observations: In phpinfo() you will find the directory conf.d/ and the file error.log
GL
Just run php --ini and look for Loaded Configuration File in output for the location of php.ini used by your CLI
then check you have enabled the extensions correctly.
Copy libpq.dll from the PHP directory to Apache24\bin (or wherever your installation could be).

Getting error while install Magento 2.x

I tried to install Magento 2.x .But it gives an error PHP Extensions Check in PHP Extension intl. I tried to install intl extension by removing the semicolon from php.ini file and then restart the server.But it still gives the same error.
Please tell me ,How to install php_intl PHP Extension on local server?
Please follow below steps to solve the error
For Windows
Stop Wamp/Xampp services
Open Wamp/Xampp php.ini file
Remove semicolon (;) for the line
;extension=php_intl.dll
Restart your services
For Linux
Type command in terminal to install php intl extension
sudo apt-get install php5-intl
Restart php fpm services by writing below command in terminal
sudo service php5-fpm retsart

PHP-5 mcrypt won't enable on nginx server ubuntu 14.04

I've been trying to install mcrypt extension for php5 on Ubuntu 14.04 ARM server running nginx.
PROBLEM
In phpinfo() I can only see the authors of mcrypt but the module itself is missing. I can't use mcrypt functionalities anywhere on that server.
WHAT I TRIED
Running php5 -m shows that mcrypt is installed.
In /etc/php5/fpm/php.ini I have the following extension = /usr/lib/php5/20121212+lfs/mcrypt.so. This I read in google after I tried only with extension = mcrypt.so. Neither gave result.
In /etc/php5/fpm/conf.d/20-mcrypt.ini I have this extension=/usr/lib/php5/20121212+lfs/mcrypt.so as well.
I restarted php5-fpm and nginx multiple times, I also tried php5enmod mcrypt which doesn't show any warnings or errors.
I created symlink between the .so and .ini file.
Any ideas?
Ok so it turns out that my only escape was to purge php5-fpm, reboot the server, then apt-get install php5-fpm, now everything is loaded correctly. I have no idea why this happens. If anyone has explaination I'll be happy to update my answer with it.

Enable XSL on Ubuntu 12.04

I am trying to enable XSL on Ubuntu 12.04 but its failing. I did this locally on my Ubuntu 13.04 and it was successful. Basically the following worked on my local computer.
apt-get install php5_xsl
edit php.ini file and add extension=php5_xsl.so
restart apache
I repeated the same procedures on my production server running Ubuntu 12.04 and PHP version 5.5.12 but the extension is not getting loaded from the phpinfo. I have also changed the extension=php5_xsl.so to extension=xsl.so because this is what in the extension directory.
I read that I might need to recompile PHP but I am not sure of this steps.
Try this:
sudo apt-get install php5-xsl
sudo php5enmod xsl
sudo service apache2 restart
Why:
http://www.lornajane.net/posts/2012/managing-php-5-4-extensions-on-ubuntu
What's happened here is that all debian-flavoured unixes have adopted
this standard for their PHP 5.4 packages, so if you're using debian,
ubuntu, or any of their relatives with PHP 5.4, you'll see a directory
structure like this. When you add a module to PHP, you'll add a file
to the mods-available directory enabling the module and adding any
config specific to it. If you want to enable the module, just do:
php5enmod http
This simply creates a symlink from the usual conf.d directory to point
to where the real files are in mods-available, prefixed with a number
that indicates the priority of the module. By default, the priority is
20.
Using this approach means we can toggle things on and off without
commenting out big chunks of config files and leaving them lying
around - if this seems familiar then that's no surprise; debian-like
linuxes manage their apache configuration in just the same way. Any
packages that you install using aptitude will use these exact same
commands to set up the configuration and then symlink it correctly. To
unlink, use the delightfully predictably-named php5dismod :)

PHP extension "curl" must be loaded. PHP extension "soap" must be loaded

I am very new to magento and currently I am getting "PHP Extension curl must be loaded" error during magento installation.
Can you help me?
If your server does not have curl installed on it you can type one of the following commands to install it:
For Debian/Ubuntu based systems you can type below command
sudo apt-get install php5-curl
sudo /etc/init.d/apache2 restart
For RedHat/CentOS based systems you can type (as root)
yum install php5-curl
/etc/init.d/httpd restart
This should install curl and have it start to work for you.
remove ';' from extension=php_curl.dll in php.ini , maybe you don't have active de mod.
Do and look if you have it active.
Before installing Magento or any other system take a look at the system requirements:
For Magento:
Supported Operating Systems:
Linux x86, x86-64
Supported Web Servers:
Apache 1.3.x
Apache 2.0.x
Apache 2.2.x
Supported Browsers:
Microsoft Internet Explorer 6 and above
Mozilla Firefox 2.0 and above
Apple Safari 2.x
Google Chrome
Adobe Flash browser plug-in should be installed
PHP Compatibility:
5.2
Required extensions:
PDO_MySQL
simplexml
mcrypt
hash
GD
DOM
iconv
curl
SOAP (if Webservices API is to be used)
Safe_mode off
Memory_limit no less than 256Mb (preferably 512)
MySQL:
4.1.20 or newer
InnoDB storage engine
SSL:
If HTTPS is used to work in the admin, SSL certificate should be valid. Self-signed SSL certificates are not supported
Server - hosting - setup:
Ability to run scheduled jobs (crontab) with PHP 5
Ability to override options in .htaccess files
To install CURL check this page depending on your platform
1: Find extension=php_soap.dll in php.ini and remove the semicolon(;)
2: Restart your Server
Josh's answer should work fine with PHP5, but if you're on PHP7 (for Debian/Ubuntu based systems):
sudo apt-get install php-curl
Then restart your server.
Also, no need to uncomment the extension in php.ini once this is done.
Sorry for adding an answer, not enough points to comment on che-azeh's answer, which should be:
sudo apt-get -y install php7.0-curl

Categories